From c0a175e21d33c2e14a2987b5f8d775d9714e7f71 Mon Sep 17 00:00:00 2001 From: Taiki Endo Date: Sat, 13 Aug 2022 20:46:50 +0900 Subject: [PATCH] Update CI config --- .github/workflows/ci.yml | 42 ++++++++++++++++------------------------ tools/check-workflow.sh | 41 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+), 25 deletions(-) create mode 100755 tools/check-workflow.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb26984e..ee0673f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,11 +105,9 @@ jobs: with: target: ${{ matrix.target }} if: matrix.target != '' - - run: | - echo "RUSTFLAGS=${RUSTFLAGS} --cfg qemu" >>"${GITHUB_ENV}" + - run: echo "RUSTFLAGS=${RUSTFLAGS} --cfg qemu" >>"${GITHUB_ENV}" if: matrix.target != '' && !startsWith(matrix.target, 'i686') && !startsWith(matrix.target, 'x86_64') - - run: | - echo "TARGET=--target=${{ matrix.target }}" >>"${GITHUB_ENV}" + - run: echo "TARGET=--target=${{ matrix.target }}" >>"${GITHUB_ENV}" if: matrix.target != '' - run: cargo test -vv --workspace --exclude bench --all-features $TARGET $BUILD_STD $DOCTEST_XCOMPILE @@ -387,6 +385,17 @@ jobs: branch: update-no-atomic-rs if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' + docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + persist-credentials: false + - uses: dtolnay/rust-toolchain@nightly + - run: cargo doc --workspace --all-features --document-private-items + env: + RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} --cfg docsrs + tidy: runs-on: ubuntu-latest steps: @@ -397,39 +406,22 @@ jobs: with: components: clippy,rustfmt - uses: taiki-e/install-action@shellcheck + - run: pip3 install yq - run: cargo fmt --all --check if: always() - run: cargo clippy --workspace --all-features --all-targets if: always() - run: shellcheck $(git ls-files '*.sh') if: always() - - docs: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - persist-credentials: false - - uses: dtolnay/rust-toolchain@nightly - - run: cargo doc --workspace --all-features - env: - RUSTDOCFLAGS: ${{ env.RUSTDOCFLAGS }} --cfg docsrs + - run: tools/check-workflow.sh + if: always() # ALL THE PREVIOUS JOBS NEEDS TO BE ADDED TO THE `needs` SECTION OF THIS JOB! ci-success: name: ci if: github.event_name == 'push' && success() - needs: - - test - - build - - msrv - - miri - - san - - valgrind - - codegen - - tidy - - docs + needs: [test, build, no-std, msrv, miri, san, valgrind, codegen, docs, tidy] # tidy:needs runs-on: ubuntu-latest steps: - name: Mark the job as a success diff --git a/tools/check-workflow.sh b/tools/check-workflow.sh new file mode 100755 index 00000000..7bedbfbf --- /dev/null +++ b/tools/check-workflow.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# shellcheck disable=SC2046 +set -euo pipefail +IFS=$'\n\t' +cd "$(dirname "$0")"/.. + +# USAGE: +# ./tools/check-workflow.sh +# +# Note: This script requires the following tools: +# - jq +# - yq + +bail() { + if [[ -n "${GITHUB_ACTIONS:-}" ]]; then + echo "::error::$*" + else + echo "error: $*" >&2 + fi + exit 1 +} + +if [[ $# -gt 0 ]]; then + cat <