From 2566656cd58d80ebc521fb7c20c1bb026d53f589 Mon Sep 17 00:00:00 2001 From: Ryan Lopopolo Date: Wed, 21 Dec 2022 11:00:55 -0800 Subject: [PATCH] Add action to setup code coverage with nightly rust and llvm tools --- .github/labels.yaml | 3 +++ .github/workflows/ci.yaml | 16 ++++++++++++++++ code-coverage/action.yaml | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 code-coverage/action.yaml diff --git a/.github/labels.yaml b/.github/labels.yaml index e2a06a1..b33197d 100644 --- a/.github/labels.yaml +++ b/.github/labels.yaml @@ -8,6 +8,9 @@ - name: "A-build-and-test" color: "f7e101" description: "Area: Build and test configurable toolchain." +- name: "A-code-coverage" + color: "f7e101" + description: "Area: Code coverage configurable toolchain." - name: "A-deps" color: "f7e101" description: "Area: Source and library dependencies." diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c89c9ef..f684e33 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -126,6 +126,22 @@ jobs: - name: Check that nightly toolchain is installed run: rustc +nightly -Vv + test-setup-code-coverage-toolchain: + name: Test setup code coverage toolchain action + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + path: setup-rust-action + + - name: Setup stable audit toolchain + uses: ./setup-rust-action/code-coverage + + - name: Check that active toolchain is stable + run: | + [[ "$(rustup show active-toolchain)" == nightly-* ]] + test-setup-lint-and-format-toolchain: name: Test setup lint and format toolchain action runs-on: ubuntu-latest diff --git a/code-coverage/action.yaml b/code-coverage/action.yaml new file mode 100644 index 0000000..1b2f92f --- /dev/null +++ b/code-coverage/action.yaml @@ -0,0 +1,37 @@ +--- +name: "Audit Toolchain" +description: "Setup a nightly Rust toolchain with llvm-tools so code coverage works" + +inputs: + toolchain: + description: "Rustup toolchain" + required: true + default: "nightly" + +runs: + using: "composite" + steps: + - name: Install ${{ inputs.toolchain }} toolchain + shell: bash + run: rustup toolchain install "${{ inputs.toolchain }}" --profile minimal --component llvm-tools-preview + + - name: Update ${{ inputs.toolchain }} toolchain + shell: bash + run: rustup update "${{ inputs.toolchain }}" + + - name: Set default toolchain to ${{ inputs.toolchain }} + shell: bash + # https://rust-lang.github.io/rustup/overrides.html + run: echo 'RUSTUP_TOOLCHAIN=${{ inputs.toolchain }}' >> "$GITHUB_ENV" + + - name: Show rustup version + shell: bash + run: rustup -Vv + + - name: Show ${{ inputs.toolchain }} rustc version + shell: bash + run: rustc +${{ inputs.toolchain }} -Vv + + - name: Show ${{ inputs.toolchain }} cargo version + shell: bash + run: cargo +${{ inputs.toolchain }} version --verbose