Fix workflow syntax #6
Workflow file for this run
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
name: CI checks | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
checks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.12 | |
- name: Upgrade PIP and install Invoke and UV | |
run: | | |
python -m pip install --upgrade pip | |
pip install 'invoke' 'uv' | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/uv | |
key: uv-${{ runner.os }}-uv-${{ hashFiles('uv.lock') }} | |
restore-keys: | | |
uv-${{ runner.os }}-uv- | |
- name: Install dependencies | |
run: inv sync-deps | |
# Run tests | |
- name: Run tests | |
id: test | |
run: inv test | |
continue-on-error: true | |
# Run format check | |
- name: Run format check | |
id: format_check | |
run: inv format-check | |
continue-on-error: true | |
# Run linting | |
- name: Run linting | |
id: lint | |
run: inv lint | |
continue-on-error: true | |
# Run type-checking | |
- name: Run type-checking | |
id: type_check | |
run: inv type-check | |
continue-on-error: true | |
# Final summary step | |
- name: Check results and fail if any check failed | |
if: always() | |
run: | | |
# Create an array of step IDs | |
STEPS=("test" "format_check" "lint" "type_check") | |
# Initialize counters | |
succeeded=0 | |
failed=0 | |
# Process each step | |
for step_id in "${STEPS[@]}"; do | |
# Use GitHub's environment file to store the current step ID | |
echo "CURRENT_STEP=$step_id" >> $GITHUB_ENV | |
# Evaluate the outcome in a way that works with dynamic step IDs | |
if [[ "${{ steps[env.CURRENT_STEP].outcome }}" == 'success' ]]; then | |
echo "✅ $step_id succeeded" | |
((succeeded++)) | |
else | |
echo "❌ $step_id failed" | |
((failed++)) | |
fi | |
done | |
# Report summary | |
echo "Summary: $succeeded succeeded, $failed failed" | |
# Set final exit code based on results | |
if [ $failed -gt 0 ]; then | |
echo "Some steps failed!" | |
exit 1 | |
fi |