refactor: code cleanup and improvements (#63) #204
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: Lint&Test | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - release/* | |
| pull_request: | |
| branches: | |
| - "*" | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup-nix | |
| - name: Cache pre-commit hooks | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.cache/prek | |
| key: prek-v1|${{ runner.os }}|${{ runner.arch }}|${{ hashFiles('**/.pre-commit-config.yaml') }} | |
| - name: Run pre commit hooks on all files | |
| run: prek run --all-files | |
| nix-build-check: | |
| needs: | |
| - lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup-nix | |
| - name: Build nix package | |
| run: nix build --profile default | |
| # use --profile default to avoid dependencies being gc | |
| - name: Run nix flake check | |
| run: nix flake check --all-systems | |
| test: | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: ./.github/actions/setup-nix | |
| - name: Cache Nox Virtualenvs | |
| uses: actions/cache@v4 | |
| with: | |
| path: .nox | |
| key: ${{ runner.os }}-${{ matrix.python-version }}-nox-${{ hashFiles('**/pdm.lock') }} | |
| restore-keys: ${{ runner.os }}-${{ matrix.python-version }}-nox | |
| - name: Install nox | |
| run: | | |
| pip install nox | |
| pdm config python.use_venv true | |
| - name: Test with coverage | |
| run: | | |
| make PYTHON=${{ matrix.python-version }} init | |
| make PYTHON=${{ matrix.python-version }} cov | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| flags: main,unittest,${{ matrix.python-version }} | |
| fail_ci_if_error: false |