From ac8830c2dc718415f6c1a13458e6b68fef63bf1e Mon Sep 17 00:00:00 2001 From: Oliver Gould Date: Sun, 13 Feb 2022 18:05:45 +0000 Subject: [PATCH 1/3] ci: Use cargo-action-fmt to annotate PRs `cargo-action-fmt` reads `cargo` output and generates GitHub action errors that properly annotate source locations. This change updates our CI workflows to use `cargo-action-fmt` so that errors are more clearly annotated. Signed-off-by: Oliver Gould --- .github/workflows/beta.yml | 9 +++++++-- .github/workflows/build.yml | 9 ++++++--- .github/workflows/check-each.yml | 12 ++++++++---- .github/workflows/lint.yml | 18 ++++++++++++++---- .github/workflows/nightly.yml | 9 +++++++-- 5 files changed, 42 insertions(+), 15 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index fc1744ad17..124fe1f293 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -10,6 +10,7 @@ on: - cron: "30 7 * * 3" env: + CARGO_ACTION_FMT_VERSION: v0.1.2 CARGO_INCREMENTAL: 0 CARGO_NET_RETRY: 10 RUST_BACKTRACE: short @@ -26,6 +27,10 @@ jobs: timeout-minutes: 20 continue-on-error: true steps: - - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + - run: | + curl --proto =https --tlsv1.3 -vsSfLo /usr/local/bin/cargo-action-fmt "https://github.com/olix0r/cargo-action-fmt/releases/download/release%2F${CARGO_ACTION_FMT_VERSION}/cargo-action-fmt-x86_64-unknown-linux-gnu" + chmod 755 /usr/local/bin/cargo-action-fmt - run: rustup toolchain install --profile=minimal beta - - run: cargo +beta build --release -p linkerd2-proxy + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + - run: cargo +beta fetch + - run: cargo +beta build --release -p linkerd2-proxy --message-format=json | cargo-action-fmt diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7356450edb..0417d25741 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,6 +14,7 @@ on: - .github/workflows/build.yml env: + CARGO_ACTION_FMT_VERSION: v0.1.2 CARGO_INCREMENTAL: 0 CARGO_NET_RETRY: 10 RUST_BACKTRACE: short @@ -24,7 +25,9 @@ jobs: timeout-minutes: 20 runs-on: ubuntu-latest steps: + - run: | + curl --proto =https --tlsv1.3 -vsSfLo /usr/local/bin/cargo-action-fmt "https://github.com/olix0r/cargo-action-fmt/releases/download/release%2F${CARGO_ACTION_FMT_VERSION}/cargo-action-fmt-x86_64-unknown-linux-gnu" + chmod 755 /usr/local/bin/cargo-action-fmt - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 - - env: - CARGO_RELEASE: "1" - run: make build + - run: cargo fetch + - run: cargo build --release -p linkerd2-proxy --message-format=json | cargo-action-fmt diff --git a/.github/workflows/check-each.yml b/.github/workflows/check-each.yml index ec669dbf95..5f62d39f9e 100644 --- a/.github/workflows/check-each.yml +++ b/.github/workflows/check-each.yml @@ -15,6 +15,7 @@ on: - .github/workflows/check-each.yml env: + CARGO_ACTION_FMT_VERSION: v0.1.2 CARGO_INCREMENTAL: 0 CARGO_NET_RETRY: 10 DEBIAN_FRONTEND: noninteractive @@ -28,8 +29,8 @@ jobs: container: image: docker://rust:1.56.1-buster steps: - - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 - run: apt update && apt install -y jq + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 - run: cargo fetch - name: list crates id: list-crates @@ -50,10 +51,13 @@ jobs: matrix: crate: ${{ fromJson(needs.enumerate.outputs.crates) }} steps: - - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 - - run: cargo fetch + - run: | + curl --proto =https --tlsv1.3 -vsSfLo /usr/local/bin/cargo-action-fmt "https://github.com/olix0r/cargo-action-fmt/releases/download/release%2F${CARGO_ACTION_FMT_VERSION}/cargo-action-fmt-x86_64-unknown-linux-gnu" + chmod 755 /usr/local/bin/cargo-action-fmt - name: install meshtls-boring build deps if: matrix.crate == 'linkerd-meshtls-boring' run: apt update && apt install -y clang cmake - - run: cargo check -p ${{ matrix.crate }} --frozen --all-targets + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + - run: cargo fetch + - run: cargo check -p ${{ matrix.crate }} --frozen --all-targets --message-format=json | cargo-action-fmt diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1b0d0bda25..3798bf2caa 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,6 +11,7 @@ on: - .github/workflows/lint.yml env: + CARGO_ACTION_FMT_VERSION: v0.1.2 CARGO_INCREMENTAL: 0 CARGO_NET_RETRY: 10 RUST_BACKTRACE: short @@ -23,9 +24,13 @@ jobs: container: image: docker://rust:1.56.1-buster steps: - - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + - run: | + curl --proto =https --tlsv1.3 -vsSfLo /usr/local/bin/cargo-action-fmt "https://github.com/olix0r/cargo-action-fmt/releases/download/release%2F${CARGO_ACTION_FMT_VERSION}/cargo-action-fmt-x86_64-unknown-linux-gnu" + chmod 755 /usr/local/bin/cargo-action-fmt - run: rustup component add clippy - - run: cargo clippy --all --exclude=linkerd-meshtls-boring + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + - run: cargo fetch + - run: cargo clippy --all --exclude=linkerd-meshtls-boring --message-format=json | cargo-action-fmt fmt: timeout-minutes: 10 @@ -33,8 +38,8 @@ jobs: container: image: docker://rust:1.56.1-buster steps: - - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 - run: rustup component add rustfmt + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 - run: make check-fmt docs: @@ -43,10 +48,15 @@ jobs: container: image: docker://rust:1.56.1-buster steps: + - run: | + curl --proto =https --tlsv1.3 -vsSfLo /usr/local/bin/cargo-action-fmt "https://github.com/olix0r/cargo-action-fmt/releases/download/release%2F${CARGO_ACTION_FMT_VERSION}/cargo-action-fmt-x86_64-unknown-linux-gnu" + chmod 755 /usr/local/bin/cargo-action-fmt - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + - run: cargo fetch - run: | cargo doc --all --no-deps \ --exclude=linkerd-meshtls \ --exclude=linkerd-meshtls-boring \ - --exclude=linkerd-meshtls-rustls + --exclude=linkerd-meshtls-rustls \ + --message-format=json | cargo-action-fmt diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 7ecce56fb1..034e4a05d9 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -10,6 +10,7 @@ on: - cron: "0 8 * * *" env: + CARGO_ACTION_FMT_VERSION: v0.1.2 CARGO_INCREMENTAL: 0 CARGO_NET_RETRY: 10 RUST_BACKTRACE: short @@ -26,6 +27,10 @@ jobs: timeout-minutes: 20 continue-on-error: true steps: - - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + - run: | + curl --proto =https --tlsv1.3 -vsSfLo /usr/local/bin/cargo-action-fmt "https://github.com/olix0r/cargo-action-fmt/releases/download/release%2F${CARGO_ACTION_FMT_VERSION}/cargo-action-fmt-x86_64-unknown-linux-gnu" + chmod 755 /usr/local/bin/cargo-action-fmt - run: rustup toolchain install --profile=minimal nightly - - run: cargo +nightly build --release -p linkerd2-proxy + - uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 + - run: cargo +nightly fetch + - run: cargo +nightly build --release -p linkerd2-proxy --message-format=json | cargo-action-fmt From 16d9435705e9d3acac4a6f6a9458787ca601d7bc Mon Sep 17 00:00:00 2001 From: Oliver Gould Date: Mon, 14 Feb 2022 15:07:25 +0000 Subject: [PATCH 2/3] touchups --- .github/workflows/check-each.yml | 2 +- .github/workflows/release.yml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-each.yml b/.github/workflows/check-each.yml index 5f62d39f9e..fe3a161e64 100644 --- a/.github/workflows/check-each.yml +++ b/.github/workflows/check-each.yml @@ -39,7 +39,7 @@ jobs: | jq -cr "[.packages[] | select(.manifest_path | startswith(\"$PWD\")) | .name]") echo "::set-output name=crates::$crates" outputs: - crates: ${{ steps.list-crates.outputs.crates }}` + crates: ${{ steps.list-crates.outputs.crates }} check: needs: enumerate diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ec81c356b8..314fe7cb39 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,6 +5,9 @@ on: tags: - "release/*" +permissions: + contents: write + env: CARGO_INCREMENTAL: 0 CARGO_NET_RETRY: 10 From 51c0c6380c97f4a03fd7c20f060326eba5c7e058 Mon Sep 17 00:00:00 2001 From: Oliver Gould Date: Mon, 14 Feb 2022 19:01:42 +0000 Subject: [PATCH 3/3] bump version to v0.1.3 Signed-off-by: Oliver Gould --- .github/workflows/beta.yml | 2 +- .github/workflows/build.yml | 2 +- .github/workflows/check-each.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/nightly.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/beta.yml b/.github/workflows/beta.yml index 124fe1f293..9969c7cdc4 100644 --- a/.github/workflows/beta.yml +++ b/.github/workflows/beta.yml @@ -10,7 +10,7 @@ on: - cron: "30 7 * * 3" env: - CARGO_ACTION_FMT_VERSION: v0.1.2 + CARGO_ACTION_FMT_VERSION: v0.1.3 CARGO_INCREMENTAL: 0 CARGO_NET_RETRY: 10 RUST_BACKTRACE: short diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0417d25741..9c84313023 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,7 +14,7 @@ on: - .github/workflows/build.yml env: - CARGO_ACTION_FMT_VERSION: v0.1.2 + CARGO_ACTION_FMT_VERSION: v0.1.3 CARGO_INCREMENTAL: 0 CARGO_NET_RETRY: 10 RUST_BACKTRACE: short diff --git a/.github/workflows/check-each.yml b/.github/workflows/check-each.yml index fe3a161e64..596bed89ca 100644 --- a/.github/workflows/check-each.yml +++ b/.github/workflows/check-each.yml @@ -15,7 +15,7 @@ on: - .github/workflows/check-each.yml env: - CARGO_ACTION_FMT_VERSION: v0.1.2 + CARGO_ACTION_FMT_VERSION: v0.1.3 CARGO_INCREMENTAL: 0 CARGO_NET_RETRY: 10 DEBIAN_FRONTEND: noninteractive diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 3798bf2caa..d3749ee8da 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,7 +11,7 @@ on: - .github/workflows/lint.yml env: - CARGO_ACTION_FMT_VERSION: v0.1.2 + CARGO_ACTION_FMT_VERSION: v0.1.3 CARGO_INCREMENTAL: 0 CARGO_NET_RETRY: 10 RUST_BACKTRACE: short diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 034e4a05d9..0ad52a786d 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -10,7 +10,7 @@ on: - cron: "0 8 * * *" env: - CARGO_ACTION_FMT_VERSION: v0.1.2 + CARGO_ACTION_FMT_VERSION: v0.1.3 CARGO_INCREMENTAL: 0 CARGO_NET_RETRY: 10 RUST_BACKTRACE: short