feat: add CI, coverage, python, platform, and license badges #32
Workflow file for this run
This file contains hidden or 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: Template CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| dependency-review: | |
| if: github.event_name == 'pull_request' | |
| permissions: | |
| contents: read | |
| pull-requests: read | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: actions/dependency-review-action@2031cfc080254a8a887f58cffee85186f0e49e48 # v4.9.0 | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: ./.github/actions/setup-python | |
| with: | |
| python-version: "3.11" | |
| - name: Run lint check | |
| run: python .github/scripts/check_lint.py | |
| types: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: ./.github/actions/setup-python | |
| with: | |
| python-version: "3.11" | |
| - name: Run type check | |
| run: python .github/scripts/check_types.py | |
| tests: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: ./.github/actions/setup-python | |
| with: | |
| python-version: "3.11" | |
| - name: Run tests | |
| run: python .github/scripts/check_tests.py | |
| - name: Extract coverage percentage | |
| if: matrix.os == 'ubuntu-latest' | |
| id: coverage | |
| run: | | |
| COVERAGE=$(python -m coverage report --format=total 2>/dev/null || echo "0") | |
| echo "pct=$COVERAGE" >> "$GITHUB_OUTPUT" | |
| - name: Upload coverage badge | |
| if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| continue-on-error: true | |
| uses: schneegans/dynamic-badges-action@e9a478b16159b4d31420099ba146cdc50f134483 # v1.7.0 | |
| with: | |
| auth: ${{ secrets.GIST_SECRET }} | |
| gistID: ${{ vars.COVERAGE_GIST_ID }} | |
| filename: coverage.json | |
| label: coverage | |
| message: ${{ steps.coverage.outputs.pct }}% | |
| valColorRange: ${{ steps.coverage.outputs.pct }} | |
| minColorRange: 50 | |
| maxColorRange: 100 | |
| security: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: ./.github/actions/setup-python | |
| with: | |
| python-version: "3.11" | |
| - name: Run security check | |
| run: python .github/scripts/check_security.py | |
| spelling: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: ./.github/actions/setup-python | |
| with: | |
| python-version: "3.11" | |
| - name: Run spelling check | |
| run: python .github/scripts/check_spelling.py | |
| package: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: ./.github/actions/setup-python | |
| with: | |
| python-version: "3.11" | |
| - name: Run package check | |
| run: python .github/scripts/check_package.py | |
| shellcheck: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - name: Run shellcheck | |
| run: shellcheck .github/scripts/setup.sh | |
| actionlint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: reviewdog/action-actionlint@6fb7acc99f4a1008869fa8a0f09cfca740837d9d # v1.72.0 | |
| with: | |
| reporter: local | |
| filter_mode: nofilter | |
| fail_level: error | |
| markdownlint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| - uses: DavidAnson/markdownlint-cli2-action@ce4853d43830c74c1753b39f3cf40f71c2031eb9 # v23.0.0 | |
| with: | |
| globs: "**/*.md" | |
| ci-passed: | |
| if: always() | |
| needs: [dependency-review, lint, types, tests, security, spelling, package, shellcheck, actionlint, markdownlint] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Verify all checks passed | |
| shell: bash | |
| run: | | |
| echo "Dependency review: ${{ needs.dependency-review.result }}" | |
| echo "Lint: ${{ needs.lint.result }}" | |
| echo "Types: ${{ needs.types.result }}" | |
| echo "Tests: ${{ needs.tests.result }}" | |
| echo "Security: ${{ needs.security.result }}" | |
| echo "Spelling: ${{ needs.spelling.result }}" | |
| echo "Package: ${{ needs.package.result }}" | |
| echo "Shellcheck: ${{ needs.shellcheck.result }}" | |
| echo "Actionlint: ${{ needs.actionlint.result }}" | |
| echo "Markdownlint: ${{ needs.markdownlint.result }}" | |
| if [[ "${{ needs.dependency-review.result }}" != "success" && "${{ needs.dependency-review.result }}" != "skipped" ]] || \ | |
| [[ "${{ needs.lint.result }}" != "success" ]] || \ | |
| [[ "${{ needs.types.result }}" != "success" ]] || \ | |
| [[ "${{ needs.tests.result }}" != "success" ]] || \ | |
| [[ "${{ needs.security.result }}" != "success" ]] || \ | |
| [[ "${{ needs.spelling.result }}" != "success" ]] || \ | |
| [[ "${{ needs.package.result }}" != "success" ]] || \ | |
| [[ "${{ needs.shellcheck.result }}" != "success" ]] || \ | |
| [[ "${{ needs.actionlint.result }}" != "success" ]] || \ | |
| [[ "${{ needs.markdownlint.result }}" != "success" ]]; then | |
| echo "::error::One or more quality checks failed" | |
| exit 1 | |
| fi | |
| echo "All quality checks passed" |