Add GitHub Action for automated Netlify deployments from align-data u… #154
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 and Tests | |
| on: | |
| push: | |
| pull_request: | |
| branches: [main, develop] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: | | |
| uv sync --all-extras --dev | |
| - name: Lint with ruff | |
| run: | | |
| uv run ruff check . | |
| uv run ruff format --check . | |
| - name: Install Playwright browsers | |
| run: | | |
| uv run playwright install chromium --with-deps | |
| - name: Run tests | |
| run: | | |
| uv run pytest --tb=short | |
| - name: Upload screenshots on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: playwright-screenshots-${{ matrix.python-version }} | |
| path: /tmp/*.png | |
| retention-days: 7 | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| enable-cache: true | |
| - name: Install dependencies | |
| run: | | |
| uv sync --all-extras --dev | |
| - name: Test build script | |
| run: | | |
| # Test the build script works | |
| uv run pytest align_browser/test_build.py -v | |
| - name: Build package | |
| run: | | |
| uv build | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: python-package | |
| path: dist/ | |
| retention-days: 7 |