actually include coverage in the run #388
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- "**" | |
paths-ignore: | |
- 'crates/bevy_api_gen/**' | |
- 'crates/macro_tests/**' | |
- '.github/workflows/release-plz.yml' | |
- '.github/workflows/bevy_api_gen.yml' | |
- '.github/workflows/macro_tests.yml' | |
- 'docs/**' | |
name: Check and Lint - bevy_mod_scripting | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: bevy-mod-scripting | |
concurrency: | |
# Use github.run_id on main branch | |
# Use github.event.pull_request.number on pull requests, so it's unique per pull request | |
# Use github.ref on other branches, so it's unique per branch | |
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
generate-job-matrix: | |
runs-on: ubuntu-latest | |
# container: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
outputs: | |
matrix: ${{ steps.generate-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Generate matrix | |
id: generate-matrix | |
run: | | |
cargo xtask ci-matrix > matrix.json | |
cat matrix.json | |
echo "Convert to single line JSON" | |
jq -c . matrix.json > matrix-one-line.json | |
echo "matrix=$(cat matrix-one-line.json)" >> $GITHUB_OUTPUT | |
check: | |
permissions: | |
pull-requests: write | |
name: Check - ${{ matrix.run_args.name }} | |
runs-on: ${{ matrix.run_args.os }} | |
# container: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest | |
needs: | |
- generate-job-matrix | |
strategy: | |
matrix: | |
run_args: ${{fromJson(needs.generate-job-matrix.outputs.matrix)}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install alsa and udev | |
if: runner.os == 'linux' | |
run: | | |
sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev | |
sudo rm -rf /usr/share/dotnet; sudo rm -rf /opt/ghc; sudo rm -rf "/usr/local/share/boost"; sudo rm -rf "$AGENT_TOOLSDIRECTORY" | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Rust Cache | |
uses: Swatinem/[email protected] | |
- name: Setup | |
run: | | |
cargo xtask init | |
- name: Check | |
run: | | |
${{ matrix.run_args.command }} | |
- name: Upload lcov files if any exist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lcov-${{ matrix.run_args.os }}-${{ matrix.run_args.name }} | |
path: | | |
**/lcov.* | |
if-no-files-found: ignore | |
report-coverage: | |
needs: check | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Download all lcov files | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
pattern: lcov-* | |
download-path: coverage | |
- name: Report code coverage | |
uses: dethereum/[email protected] | |
with: | |
coverage-files: coverage/lcov.* | |
minimum-coverage: 50 | |
artifact-name: code-coverage-report | |
github-token: ${{ secrets.GITHUB_TOKEN }} |