diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92849d79..20e8b859 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: SHFMT_OPTS: -i 4 -ci with: sh_checker_comment: false - sh_checker_exclude: "src" + sh_checker_exclude: 'src' publish-codecov: name: Check code coverage (branch) @@ -54,7 +54,7 @@ jobs: - name: Code coverage report run: cargo +${{ env.RUST_VERSION_COV }} llvm-cov --all-features --lcov --branch --output-path lcov.info - + - name: Setup LCOV uses: hrishikesh-kadam/setup-lcov@v1 @@ -90,7 +90,7 @@ jobs: - name: Install toolchain uses: dtolnay/rust-toolchain@stable - + - uses: Swatinem/rust-cache@v1 - name: Check Clippy Linter @@ -104,10 +104,10 @@ jobs: - name: Install toolchain uses: dtolnay/rust-toolchain@stable - + - name: Check Formatting run: cargo fmt --all -- --check - + cargo-test-workspace: needs: cancel-previous-runs runs-on: ubuntu-latest @@ -116,10 +116,10 @@ jobs: - name: Install toolchain uses: dtolnay/rust-toolchain@stable - + - name: Run tests run: cargo test --locked --workspace - + lint-toml-files: needs: cancel-previous-runs runs-on: ubuntu-latest @@ -130,12 +130,12 @@ jobs: - name: Install toolchain uses: dtolnay/rust-toolchain@stable - + - name: Install Cargo.toml linter uses: baptiste0928/cargo-install@v1 with: crate: cargo-toml-lint - version: "0.1" + version: '0.1' - name: Run Cargo.toml linter run: git ls-files | grep Cargo.toml$ | xargs --verbose -n 1 cargo-toml-lint @@ -156,17 +156,6 @@ jobs: curl -sSLf "https://github.com/TomWright/dasel/releases/download/v1.24.3/dasel_linux_amd64" -L -o dasel && chmod +x dasel mv ./dasel /usr/local/bin/dasel ./.github/workflows/scripts/verify_tag.sh ${{ github.ref_name }} Cargo.toml - - name: Notify if Job Fails - uses: ravsamhq/notify-slack-action@v1 - with: - status: ${{ job.status }} - token: ${{ secrets.GITHUB_TOKEN }} - notification_title: "{workflow} has {status_message}" - message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>" - footer: "" - notify_when: "failure" - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TOOLING }} build-release: name: build fuelup release binaries @@ -200,13 +189,13 @@ jobs: - uses: Swatinem/rust-cache@v1 with: cache-on-failure: true - key: "${{ matrix.job.target }}" + key: '${{ matrix.job.target }}' - name: Use Cross uses: baptiste0928/cargo-install@v1 with: crate: cross - cache-key: "${{ matrix.job.target }}" + cache-key: '${{ matrix.job.target }}' - name: Build fuelup run: | @@ -259,8 +248,7 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} with: - files: - ${{ env.ZIP_FILE_NAME }} + files: ${{ env.ZIP_FILE_NAME }} post-release-checks: name: Do post-release checks @@ -277,3 +265,29 @@ jobs: uses: actions/checkout@v3 - name: Try fuelup installation with fuelup-init run: ./fuelup-init.sh + + notify-slack-on-failure: + if: failure() + needs: + [ + publish-codecov, + try-run-fuelup-init, + cargo-clippy, + cargo-fmt-check, + cargo-test-workspace, + lint-toml-files, + publish-check, + build-release, + post-release-checks, + ] + runs-on: ubuntu-latest + steps: + - uses: ravsamhq/notify-slack-action@v1 + with: + status: 'failure' + token: ${{ secrets.GITHUB_TOKEN }} + notification_title: '{workflow} has {status_message}' + message_format: '{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>' + footer: '' + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TOOLING }} diff --git a/.github/workflows/nightly-cargo-audit.yml b/.github/workflows/nightly-cargo-audit.yml index 3080cb7b..186fdc48 100644 --- a/.github/workflows/nightly-cargo-audit.yml +++ b/.github/workflows/nightly-cargo-audit.yml @@ -12,15 +12,18 @@ jobs: - uses: actions-rs/audit-check@v1 with: token: ${{ secrets.GITHUB_TOKEN }} - - name: Notify if Job Fails - uses: ravsamhq/notify-slack-action@v1 + + notify-slack-on-failure: + if: failure() + needs: [cargo_audit] + runs-on: ubuntu-latest + steps: + - uses: ravsamhq/notify-slack-action@v1 with: - status: ${{ job.status }} + status: 'failure' token: ${{ secrets.GITHUB_TOKEN }} - notification_title: "{workflow} has {status_message}" - message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>" - footer: "" - notify_when: "failure" + notification_title: '{workflow} has {status_message}' + message_format: '{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>' + footer: '' env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TOOLING }} - diff --git a/.github/workflows/publish-nightly-channel.yml b/.github/workflows/publish-nightly-channel.yml index b828c338..6caccd3c 100644 --- a/.github/workflows/publish-nightly-channel.yml +++ b/.github/workflows/publish-nightly-channel.yml @@ -19,24 +19,24 @@ jobs: - name: Install toolchain uses: dtolnay/rust-toolchain@stable - + - name: Install build-channel script run: cargo install --debug --path ./ci/build-channel - name: Publish nightly channel id: setup run: | - PUBLISHED_DATE=$(date +'%Y-%m-%d') - FORMATTED_PUBLISHED_DATE=$(date +'%Y/%m/%d') - mkdir -p ${{ env.NIGHTLY_CHANNEL_DIR }} + PUBLISHED_DATE=$(date +'%Y-%m-%d') + FORMATTED_PUBLISHED_DATE=$(date +'%Y/%m/%d') + mkdir -p ${{ env.NIGHTLY_CHANNEL_DIR }} - CHANNEL_TOML="channel-fuel-nightly.toml" + CHANNEL_TOML="channel-fuel-nightly.toml" - build-channel --nightly $CHANNEL_TOML $PUBLISHED_DATE --github-run-id $GITHUB_RUN_ID + build-channel --nightly $CHANNEL_TOML $PUBLISHED_DATE --github-run-id $GITHUB_RUN_ID - cp $CHANNEL_TOML ${{ env.NIGHTLY_CHANNEL_DIR }} + cp $CHANNEL_TOML ${{ env.NIGHTLY_CHANNEL_DIR }} - echo "::set-output name=archive_dir::channels/nightly/${FORMATTED_PUBLISHED_DATE}" + echo "::set-output name=archive_dir::channels/nightly/${FORMATTED_PUBLISHED_DATE}" - name: Deploy nightly channel (latest version) uses: peaceiris/actions-gh-pages@v3 @@ -58,14 +58,17 @@ jobs: user_name: 'fuel-service-user' user_email: 'fuel-service-user@users.noreply.github.com' - - name: Notify if Job Fails - uses: ravsamhq/notify-slack-action@v1 + notify-slack-on-failure: + if: failure() + needs: [publish-channel] + runs-on: ubuntu-latest + steps: + - uses: ravsamhq/notify-slack-action@v1 with: - status: ${{ job.status }} + status: 'failure' token: ${{ secrets.GITHUB_TOKEN }} - notification_title: "{workflow} has {status_message}" - message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>" - footer: "" - notify_when: "failure" + notification_title: '{workflow} has {status_message}' + message_format: '{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}> : <{run_url}|View Run Results>' + footer: '' env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_TOOLING }}