Skip to content
Merged
139 changes: 115 additions & 24 deletions .github/workflows/run_code_checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,58 @@ on:
push:
branches:
- master
permissions:
contents: read
pull-requests: read
statuses: write
jobs:
detect_changes:
name: Detect file changes
runs-on: ubuntu-latest
outputs:
rust: ${{ steps.filter.outputs.rust }}
python: ${{ steps.filter.outputs.python }}
markdown: ${{ steps.filter.outputs.markdown }}
yaml: ${{ steps.filter.outputs.yaml }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Detect changed files
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
rust:
- '**/*.rs'
- '**/Cargo.toml'
- 'Cargo.lock'
- 'maskfile.md'
- '.flox/**'
- 'devenv.*'
- '.github/**'
python:
- '**/*.py'
- '**/pyproject.toml'
- 'uv.lock'
Comment thread
forstmeier marked this conversation as resolved.
- 'maskfile.md'
- '.flox/**'
- 'devenv.*'
- '.github/**'
markdown:
- '**/*.md'
- '.flox/**'
- 'devenv.*'
- '.github/**'
yaml:
- '**/*.yaml'
- '**/*.yml'
Comment thread
forstmeier marked this conversation as resolved.
Comment thread
forstmeier marked this conversation as resolved.
- '.flox/**'
- 'devenv.*'
- '.github/**'
run_rust_code_checks:
name: Run Rust code checks
needs: detect_changes
if: needs.detect_changes.outputs.rust == 'true' || github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
Expand Down Expand Up @@ -46,15 +95,23 @@ jobs:
uses: flox/activate-action@v1
with:
command: mask development rust all
- name: Upload test coverage results
uses: actions/upload-artifact@v4
- name: Check Rust coverage file exists
run: |
if [ ! -f .coverage_output/rust.xml ]; then
echo "Rust coverage file not found: .coverage_output/rust.xml"
exit 1
fi
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
name: ${{ github.job }}_test_coverage
path: .coverage_output/rust.xml
if-no-files-found: error
overwrite: true
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: rust
file: .coverage_output/rust.xml
parallel: true
Comment thread
forstmeier marked this conversation as resolved.
Comment thread
forstmeier marked this conversation as resolved.
run_python_code_checks:
name: Run Python code checks
needs: detect_changes
if: needs.detect_changes.outputs.python == 'true'
runs-on: ubuntu-latest
Comment thread
forstmeier marked this conversation as resolved.
steps:
- name: Checkout code
Expand All @@ -65,15 +122,23 @@ jobs:
uses: flox/activate-action@v1
with:
command: mask development python all
- name: Upload test coverage results
uses: actions/upload-artifact@v4
- name: Check Python coverage file exists
run: |
if [ ! -f .coverage_output/python.xml ]; then
echo "Python coverage file not found: .coverage_output/python.xml"
exit 1
fi
- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
name: ${{ github.job }}_test_coverage
path: .coverage_output/python.xml
if-no-files-found: error
overwrite: true
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: python
file: .coverage_output/python.xml
parallel: true
Comment thread
forstmeier marked this conversation as resolved.
run_markdown_code_checks:
name: Run Markdown code checks
needs: detect_changes
if: needs.detect_changes.outputs.markdown == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -86,6 +151,8 @@ jobs:
command: mask development markdown all
run_yaml_code_checks:
name: Run YAML code checks
needs: detect_changes
if: needs.detect_changes.outputs.yaml == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand All @@ -96,28 +163,52 @@ jobs:
uses: flox/activate-action@v1
with:
command: mask development yaml all
upload_test_coverage:
finish_coverage_upload:
name: Finish Coveralls coverage upload
needs:
- run_rust_code_checks
- run_python_code_checks
if: |
always() &&
(
needs.run_rust_code_checks.result == 'success' &&
needs.run_rust_code_checks.result == 'success' ||
needs.run_python_code_checks.result == 'success'
)
name: Upload coverage to Coveralls
runs-on: ubuntu-latest
steps:
- name: Download test coverage results
uses: actions/download-artifact@v4
with:
pattern: '*_test_coverage'
path: .coverage_output/
merge-multiple: true
run-id: ${{ github.run_id }}
- name: Upload coverage to Coveralls
- name: Finalize coverage upload
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
files: .coverage_output/python.xml .coverage_output/rust.xml
parallel-finished: true
carryforward: rust,python
Comment thread
coderabbitai[bot] marked this conversation as resolved.
verify_code_checks_passed:
name: Verify code checks passed
needs:
- detect_changes
- run_rust_code_checks
- run_python_code_checks
- run_markdown_code_checks
- run_yaml_code_checks
- finish_coverage_upload
if: always()
runs-on: ubuntu-latest
steps:
- name: Check all jobs passed
run: |
declare -A job_results=(
[detect_changes]="${{ needs.detect_changes.result }}"
[run_rust_code_checks]="${{ needs.run_rust_code_checks.result }}"
[run_python_code_checks]="${{ needs.run_python_code_checks.result }}"
[run_markdown_code_checks]="${{ needs.run_markdown_code_checks.result }}"
[run_yaml_code_checks]="${{ needs.run_yaml_code_checks.result }}"
[finish_coverage_upload]="${{ needs.finish_coverage_upload.result }}"
)
for job_name in "${!job_results[@]}"; do
result="${job_results[$job_name]}"
if [[ "$result" != "success" && "$result" != "skipped" ]]; then
echo "Job '$job_name' failed or was cancelled: $result"
exit 1
fi
done
echo "All checks passed or were skipped"
Loading