version: 1 policy: pullRequests: public tasks: $let: user: ${event.sender.login} head_branch: $if: 'tasks_for == "github-pull-request"' then: ${event.pull_request.head.ref} else: $if: 'tasks_for == "github-push"' then: ${event.ref} else: ${event.release.target_commitish} head_rev: $if: 'tasks_for == "github-pull-request"' then: ${event.pull_request.head.sha} else: $if: 'tasks_for == "github-push"' then: ${event.after} else: ${event.release.tag_name} repository: $if: 'tasks_for == "github-pull-request"' then: ${event.pull_request.head.repo.html_url} else: ${event.repository.html_url} taskboot_image: "mozilla/taskboot:0.4.3" in: $if: 'tasks_for == "github-push" || (tasks_for == "github-pull-request" && event["action"] in ["opened", "reopened", "synchronize"])' then: - taskId: {$eval: as_slugid("lint_test_task")} created: {$fromNow: ''} deadline: {$fromNow: '1 hour'} provisionerId: proj-relman workerType: ci payload: maxRunTime: 3600 image: "rust:bookworm" command: - "/bin/bash" - "-cx" - "apt update && apt install -y python3-full && rustup component add clippy rustfmt && rustup toolchain install nightly && curl -L https://github.com/est31/cargo-udeps/releases/download/v0.1.35/cargo-udeps-v0.1.35-x86_64-unknown-linux-gnu.tar.gz | tar xz -C /usr/local/cargo/bin --strip-components 2 && curl -L https://github.com/rustsec/rustsec/releases/download/cargo-audit%2Fv0.16.0/cargo-audit-x86_64-unknown-linux-musl-v0.16.0.tgz | tar xzv -C /usr/local/cargo/bin --strip-components 1 && git clone --quiet ${repository} && cd rust-code-analysis && git -c advice.detachedHead=false checkout ${head_rev} && git submodule update --init && python3 -m venv myenv && . myenv/bin/activate && pip3 install --quiet pre-commit && pre-commit run -a --show-diff-on-failure && pre-commit run --show-diff-on-failure -c .pre-commit-audit-config.yaml && cargo test --workspace --verbose --all-features --no-fail-fast -- --nocapture && cd enums && cargo build --verbose --all-features" metadata: name: rust-code-analysis lint and test description: rust-code-analysis lint and test owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml - taskId: {$eval: as_slugid("build_documentation")} created: {$fromNow: ''} deadline: {$fromNow: '2 hour'} provisionerId: proj-relman workerType: ci payload: maxRunTime: 3600 image: "rust:bookworm" command: - "/bin/bash" - "-cx" - "git clone --quiet ${repository} && cd rust-code-analysis && git -c advice.detachedHead=false checkout ${head_rev} && cargo install mdbook --no-default-features --features output --vers \"^0.1.0\" && cargo doc --release && cd rust-code-analysis-book && mdbook build && tar -zvcf /book.tar.gz book/" artifacts: public/book.tar.gz: expires: {$fromNow: '2 weeks'} path: /book.tar.gz type: file metadata: name: rust-code-analysis documentation description: rust-code-analysis build documentation owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml - taskId: {$eval: as_slugid("ccov_test_task")} created: {$fromNow: ''} deadline: {$fromNow: '1 hour'} provisionerId: proj-relman workerType: ci payload: maxRunTime: 3600 image: "rust:bookworm" env: CODECOV_TOKEN: 4df01912-087e-489a-be28-25aa911cb9d2 CARGO_INCREMENTAL: "0" RUSTFLAGS: -Cinstrument-coverage -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off RUSTDOCFLAGS: -Cinstrument-coverage -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off LLVM_PROFILE_FILE: rust-code-analysis-%p-%m.profraw command: - "/bin/bash" - "-cx" - "apt-get -qq update && apt-get -qq install -y zip && curl -L https://github.com/mozilla/grcov/releases/download/v0.8.6/grcov-v0.8.6-x86_64-unknown-linux-gnu.tar.gz | tar xz && rustup component add llvm-tools-preview && git clone --quiet ${repository} && cd rust-code-analysis && git -c advice.detachedHead=false checkout ${head_rev} && git submodule update --init && cargo test --workspace --verbose --all-features --target x86_64-unknown-linux-gnu && ../grcov . --binary-path ./target/ -s . -t lcov --llvm --branch --ignore-not-existing --ignore '/*' -o lcov.info && bash <(curl -s https://codecov.io/bash) -f lcov.info" metadata: name: rust-code-analysis grcov test description: rust-code-analysis grcov test owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml - taskId: {$eval: as_slugid("windows_test_task")} created: {$fromNow: ''} deadline: {$fromNow: '1 hour'} provisionerId: proj-relman workerType: win2022 payload: maxRunTime: 3600 command: - set VSWHERE=%programfiles(x86)%\Microsoft Visual Studio\Installer - set VS_BINS=VC\Tools\MSVC\*\bin\Hostx64\x64 - set RUSTUP_INIT_PATH=%CD%\rustup-init - set CARGO_PATH=%USERPROFILE%\.cargo\bin - set PATH=%RUSTUP_INIT_PATH%;%CARGO_PATH%;%VSWHERE%;%PATH% - set VSWHERE_CMD=vswhere -latest -products * -find %VS_BINS% - FOR /F "tokens=*" %%o IN ('%VSWHERE_CMD%') do (SET LIB_PATH=%%o) - set PATH=%LIB_PATH%;%PATH% - rustup-init -yv --default-toolchain stable ^ --default-host x86_64-pc-windows-msvc - git config --global core.autocrlf input - git clone --quiet ${repository} - cd rust-code-analysis - git -c advice.detachedHead=false checkout ${head_rev} - git submodule update --init - cargo test --workspace --verbose --all-features --no-fail-fast -- --nocapture mounts: - content: url: https://win.rustup.rs/ file: rustup-init\rustup-init.exe metadata: name: rust-code-analysis windows test description: rust-code-analysis windows test owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml - taskId: {$eval: as_slugid("check_tree_sitter_mozcpp")} dependencies: - {$eval: as_slugid("lint_test_task")} - {$eval: as_slugid("windows_test_task")} created: {$fromNow: ''} deadline: {$fromNow: '1 hour'} provisionerId: proj-relman workerType: ci payload: maxRunTime: 3600 image: "rust:buster" command: - "/bin/bash" - "-cx" - "git clone --quiet ${repository} && cd rust-code-analysis && git -c advice.detachedHead=false checkout ${head_rev} && ./check-grammars-crates.sh tree-sitter-mozcpp" cache: rust-code-analysis-mozilla-central-repository: /cache artifacts: public/json-diffs-and-minimal-tests-mozcpp.tar.gz: expires: {$fromNow: '2 weeks'} path: /tmp/json-diffs-and-minimal-tests-mozcpp.tar.gz type: file scopes: - "docker-worker:cache:rust-code-analysis-mozilla-central-repository" metadata: name: rust-code-analysis check tree-sitter-mozcpp description: rust-code-analysis check tree-sitter-mozcpp grammar owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml - taskId: {$eval: as_slugid("check_tree_sitter_mozjs")} dependencies: - {$eval: as_slugid("lint_test_task")} - {$eval: as_slugid("windows_test_task")} created: {$fromNow: ''} deadline: {$fromNow: '1 hour'} provisionerId: proj-relman workerType: ci payload: maxRunTime: 3600 image: "rust:buster" command: - "/bin/bash" - "-cx" - "git clone --quiet ${repository} && cd rust-code-analysis && git -c advice.detachedHead=false checkout ${head_rev} && ./check-grammars-crates.sh tree-sitter-mozjs" cache: rust-code-analysis-mozilla-central-repository: /cache artifacts: public/json-diffs-and-minimal-tests-mozjs.tar.gz: expires: {$fromNow: '2 weeks'} path: /tmp/json-diffs-and-minimal-tests-mozjs.tar.gz type: file scopes: - "docker-worker:cache:rust-code-analysis-mozilla-central-repository" metadata: name: rust-code-analysis check tree-sitter-mozjs description: rust-code-analysis check tree-sitter-mozjs grammar owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml - taskId: {$eval: as_slugid("check_tree_sitter_rust")} dependencies: - {$eval: as_slugid("lint_test_task")} - {$eval: as_slugid("windows_test_task")} created: {$fromNow: ''} deadline: {$fromNow: '1 hour'} provisionerId: proj-relman workerType: ci payload: maxRunTime: 3600 image: "rust:buster" command: - "/bin/bash" - "-cx" - "git clone --quiet ${repository} && cd rust-code-analysis && git -c advice.detachedHead=false checkout ${head_rev} && ./check-grammars-crates.sh tree-sitter-rust" cache: rust-code-analysis-mozilla-central-repository: /cache artifacts: public/json-diffs-and-minimal-tests-rust.tar.gz: expires: {$fromNow: '2 weeks'} path: /tmp/json-diffs-and-minimal-tests-rust.tar.gz type: file scopes: - "docker-worker:cache:rust-code-analysis-mozilla-central-repository" metadata: name: rust-code-analysis check tree-sitter-rust description: rust-code-analysis check tree-sitter-rust grammar owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml - taskId: {$eval: as_slugid("check_tree_sitter_java")} dependencies: - {$eval: as_slugid("lint_test_task")} - {$eval: as_slugid("windows_test_task")} created: {$fromNow: ''} deadline: {$fromNow: '1 hour'} provisionerId: proj-relman workerType: ci payload: maxRunTime: 3600 image: "rust:buster" command: - "/bin/bash" - "-cx" - "git clone --quiet ${repository} && cd rust-code-analysis && git -c advice.detachedHead=false checkout ${head_rev} && ./check-grammars-crates.sh tree-sitter-java" cache: rust-code-analysis-mozilla-central-repository: /cache artifacts: public/json-diffs-and-minimal-tests-java.tar.gz: expires: {$fromNow: '2 weeks'} path: /tmp/json-diffs-and-minimal-tests-java.tar.gz type: file scopes: - "docker-worker:cache:rust-code-analysis-mozilla-central-repository" metadata: name: rust-code-analysis check tree-sitter-java description: rust-code-analysis check tree-sitter-java grammar owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml - taskId: {$eval: as_slugid("check_tree_sitter_kotlin")} dependencies: - {$eval: as_slugid("lint_test_task")} - {$eval: as_slugid("windows_test_task")} created: {$fromNow: ''} deadline: {$fromNow: '1 hour'} provisionerId: proj-relman workerType: ci payload: maxRunTime: 3600 image: "rust:buster" command: - "/bin/bash" - "-cx" - "git clone --quiet ${repository} && cd rust-code-analysis && git -c advice.detachedHead=false checkout ${head_rev} && ./check-grammars-crates.sh tree-sitter-kotlin" cache: rust-code-analysis-mozilla-central-repository: /cache artifacts: public/json-diffs-and-minimal-tests-kotlin.tar.gz: expires: {$fromNow: '2 weeks'} path: /tmp/json-diffs-and-minimal-tests-kotlin.tar.gz type: file scopes: - "docker-worker:cache:rust-code-analysis-mozilla-central-repository" metadata: name: rust-code-analysis check tree-sitter-kotlin description: rust-code-analysis check tree-sitter-kotlin grammar owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml - taskId: {$eval: as_slugid("check_tree_sitter_python")} dependencies: - {$eval: as_slugid("lint_test_task")} - {$eval: as_slugid("windows_test_task")} created: {$fromNow: ''} deadline: {$fromNow: '1 hour'} provisionerId: proj-relman workerType: ci payload: maxRunTime: 3600 image: "rust:buster" command: - "/bin/bash" - "-cx" - "git clone --quiet ${repository} && cd rust-code-analysis && git -c advice.detachedHead=false checkout ${head_rev} && ./check-grammars-crates.sh tree-sitter-python" cache: rust-code-analysis-mozilla-central-repository: /cache artifacts: public/json-diffs-and-minimal-tests-python.tar.gz: expires: {$fromNow: '2 weeks'} path: /tmp/json-diffs-and-minimal-tests-python.tar.gz type: file scopes: - "docker-worker:cache:rust-code-analysis-mozilla-central-repository" metadata: name: rust-code-analysis check tree-sitter-python description: rust-code-analysis check tree-sitter-python grammar owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml - taskId: {$eval: as_slugid("check_tree_sitter_typescript")} dependencies: - {$eval: as_slugid("lint_test_task")} - {$eval: as_slugid("windows_test_task")} created: {$fromNow: ''} deadline: {$fromNow: '1 hour'} provisionerId: proj-relman workerType: ci payload: maxRunTime: 3600 image: "rust:buster" command: - "/bin/bash" - "-cx" - "git clone --quiet ${repository} && cd rust-code-analysis && git -c advice.detachedHead=false checkout ${head_rev} && ./check-grammars-crates.sh tree-sitter-typescript" cache: rust-code-analysis-mozilla-central-repository: /cache artifacts: public/json-diffs-and-minimal-tests-typescript.tar.gz: expires: {$fromNow: '2 weeks'} path: /tmp/json-diffs-and-minimal-tests-typescript.tar.gz type: file scopes: - "docker-worker:cache:rust-code-analysis-mozilla-central-repository" metadata: name: rust-code-analysis check tree-sitter-typescript description: rust-code-analysis check tree-sitter-typescript grammar owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml - $if: 'tasks_for == "github-push" && head_branch[:10] == "refs/tags/"' then: taskId: {$eval: as_slugid("test_mozilla_central")} dependencies: - {$eval: as_slugid("lint_test_task")} - {$eval: as_slugid("windows_test_task")} created: {$fromNow: ''} deadline: {$fromNow: '1 hour'} provisionerId: proj-relman workerType: ci payload: maxRunTime: 3600 image: "rust:buster" command: - "/bin/bash" - "-cx" - "git clone --quiet ${repository} && [ ! -d \"/cache/gecko-dev\" ] && git clone --quiet https://github.com/mozilla/gecko-dev.git /cache/gecko-dev || true && pushd /cache/gecko-dev && git pull origin master && popd && mkdir -p /tmp/mozilla_central_output && cd rust-code-analysis && git -c advice.detachedHead=false checkout ${head_rev} && cargo build --release --workspace --all-features && cargo run --release -p rust-code-analysis-cli -- -p /cache/gecko-dev \ -j4 --metrics -O json -o /tmp/mozilla_central_output" cache: rust-code-analysis-mozilla-central-repository: /cache scopes: - "docker-worker:cache:rust-code-analysis-mozilla-central-repository" metadata: name: rust-code-analysis mozilla-central test description: rust-code-analysis-cli tested on mozilla-central owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml - $if: 'tasks_for == "github-push" && head_branch[:10] == "refs/tags/"' then: taskId: {$eval: as_slugid("publish_crates")} dependencies: - {$eval: as_slugid("test_mozilla_central")} - {$eval: as_slugid("build_documentation")} created: {$fromNow: ''} deadline: {$fromNow: '2 hour'} provisionerId: proj-relman workerType: ci scopes: - secrets:get:project/relman/rust-code-analysis/deploy payload: features: taskclusterProxy: true maxRunTime: 3600 image: "${taskboot_image}" env: TASKCLUSTER_SECRET: project/relman/rust-code-analysis/deploy command: - "/bin/sh" - "-cx" - "git config --global user.email moz-tools-bot@moz.tools && git config --global user.name moz.tools Bot && git clone --quiet ${repository} && cd rust-code-analysis && cd tree-sitter-ccomment && taskboot cargo-publish --ignore-published && cd .. && cd tree-sitter-preproc && taskboot cargo-publish --ignore-published && cd .. && cd tree-sitter-mozjs && taskboot cargo-publish --ignore-published && cd .. && cd tree-sitter-mozcpp && taskboot cargo-publish --ignore-published && cd .. && taskboot cargo-publish --ignore-published && cd rust-code-analysis-cli && taskboot cargo-publish --ignore-published && cd .. && cd rust-code-analysis-web && taskboot cargo-publish --ignore-published" metadata: name: "rust-code-analysis crates publishing on crates.io ${head_branch[10:]}" description: rust-code-analysis crates publishing on crates.io owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml - $if: 'tasks_for == "github-push" && head_branch[:10] == "refs/tags/"' then: taskId: {$eval: as_slugid("build_linux_release")} dependencies: - {$eval: as_slugid("publish_crates")} created: {$fromNow: ''} deadline: {$fromNow: '2 hour'} provisionerId: proj-relman workerType: ci payload: maxRunTime: 3600 image: "rust:buster" command: - "/bin/bash" - "-cx" - "git clone --quiet ${repository} && cd rust-code-analysis && git -c advice.detachedHead=false checkout ${head_rev} && cargo update && cargo build --workspace --release && cargo package --all-features && pushd rust-code-analysis-cli && cargo package --all-features && popd && pushd rust-code-analysis-web && cargo package --all-features && popd && cd target/release && tar -zvcf /rust-code-analysis-linux-cli-x86_64.tar.gz rust-code-analysis-cli && tar -zvcf /rust-code-analysis-linux-web-x86_64.tar.gz rust-code-analysis-web" artifacts: public/rust-code-analysis-linux-cli-x86_64.tar.gz: expires: {$fromNow: '2 weeks'} path: /rust-code-analysis-linux-cli-x86_64.tar.gz type: file public/rust-code-analysis-linux-web-x86_64.tar.gz: expires: {$fromNow: '2 weeks'} path: /rust-code-analysis-linux-web-x86_64.tar.gz type: file public/Cargo.lock: expires: {$fromNow: '2 weeks'} path: /rust-code-analysis/Cargo.lock type: file metadata: name: rust-code-analysis linux release build description: rust-code-analysis linux release build owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml - $if: 'tasks_for == "github-push" && head_branch[:10] == "refs/tags/"' then: taskId: {$eval: as_slugid("build_windows_release")} dependencies: - {$eval: as_slugid("lint_test_task")} - {$eval: as_slugid("windows_test_task")} created: {$fromNow: ''} deadline: {$fromNow: '2 hour'} provisionerId: proj-relman workerType: win2022 payload: maxRunTime: 3600 command: - set VSWHERE=%programfiles(x86)%\Microsoft Visual Studio\Installer - set VS_BINS=VC\Tools\MSVC\*\bin\Hostx64\x64 - set RUSTUP_INIT_PATH=%CD%\rustup-init - set CARGO_PATH=%USERPROFILE%\.cargo\bin - set PATH=%RUSTUP_INIT_PATH%;%CARGO_PATH%;%VSWHERE%;%PATH% - set VSWHERE_CMD=vswhere -latest -products * -find %VS_BINS% - FOR /F "tokens=*" %%o IN ('%VSWHERE_CMD%') do (SET LIB_PATH=%%o) - set PATH=%LIB_PATH%;%PATH% - rustup-init -yv --default-toolchain stable ^ --default-host x86_64-pc-windows-msvc - git clone --quiet ${repository} - cd rust-code-analysis - git -c advice.detachedHead=false checkout ${head_rev} - cargo build --workspace --release - 7z a rust-code-analysis-win-cli-x86_64.zip "target\release\rust-code-analysis-cli.exe" - 7z a rust-code-analysis-win-web-x86_64.zip "target\release\rust-code-analysis-web.exe" mounts: - content: url: https://win.rustup.rs/ file: rustup-init\rustup-init.exe artifacts: - name: public/rust-code-analysis-win-cli-x86_64.zip expires: {$fromNow: '2 weeks'} path: rust-code-analysis\rust-code-analysis-win-cli-x86_64.zip type: file - name: public/rust-code-analysis-win-web-x86_64.zip expires: {$fromNow: '2 weeks'} path: rust-code-analysis\rust-code-analysis-win-web-x86_64.zip type: file metadata: name: rust-code-analysis windows release build description: rust-code-analysis windows release build owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml - $if: 'tasks_for == "github-push" && head_branch[:10] == "refs/tags/"' then: $let: linux_cli: rust-code-analysis-linux-cli-x86_64.tar.gz linux_web: rust-code-analysis-linux-web-x86_64.tar.gz win_cli: rust-code-analysis-win-cli-x86_64.zip win_web: rust-code-analysis-win-web-x86_64.zip in: taskId: {$eval: as_slugid("deploy_release")} dependencies: - {$eval: as_slugid("build_linux_release")} - {$eval: as_slugid("build_windows_release")} - {$eval: as_slugid("test_mozilla_central")} - {$eval: as_slugid("build_documentation")} created: {$fromNow: ''} deadline: {$fromNow: '2 hour'} provisionerId: proj-relman workerType: ci scopes: - secrets:get:project/relman/rust-code-analysis/deploy payload: features: taskclusterProxy: true maxRunTime: 3600 image: "${taskboot_image}" env: TASKCLUSTER_SECRET: project/relman/rust-code-analysis/deploy command: - "/bin/sh" - "-cx" - "git config --global user.email moz-tools-bot@moz.tools && git config --global user.name moz.tools Bot && git clone --quiet ${repository} && cd rust-code-analysis && taskboot retrieve-artifact --output-path=. --artifacts=public/book.tar.gz && tar xfz book.tar.gz -C rust-code-analysis-book && ./rust-code-analysis-book/deploy-to-GitHub-Pages && taskboot git-push --force-push github.com/mozilla/rust-code-analysis moz-tools-bot gh-pages && taskboot github-release mozilla/rust-code-analysis ${head_branch[10:]} --asset Cargo.lock:public/Cargo.lock ${linux_cli}:public/${linux_cli} ${linux_web}:public/${linux_web} ${win_cli}:public/${win_cli} ${win_web}:public/${win_web} && rm -rf book.tar.gz" metadata: name: "rust-code-analysis release publication ${head_branch[10:]}" description: rust-code-analysis release publication on Github owner: cdenizet@mozilla.com source: ${repository}/raw/${head_rev}/.taskcluster.yml