updated github workflows #5
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.12", "3.13"] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v4 | |
| with: | |
| version: "0.5.6" | |
| enable-cache: true | |
| - name: Set up Python ${{ matrix.python-version }} | |
| run: uv python install ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: uv sync --group dev | |
| - name: Check formatting with black | |
| run: uv run black . --check | |
| - name: Lint with flake8 | |
| run: uv run flake8 fastworker tests --max-line-length=120 | |
| - name: Run tests | |
| run: uv run pytest -v | |
| lint-frontend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: fastworker/gui/frontend/package-lock.json | |
| - name: Install frontend dependencies | |
| run: cd fastworker/gui/frontend && npm install | |
| - name: Run ESLint | |
| run: cd fastworker/gui/frontend && npx eslint . | |
| check-version: | |
| needs: [test, lint-frontend] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check version and create tag | |
| run: | | |
| CURRENT_VERSION=$(grep -oP 'version = "\K[^"]+' pyproject.toml) | |
| PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "none") | |
| if [ "$PREV_TAG" != "v$CURRENT_VERSION" ]; then | |
| git tag "v$CURRENT_VERSION" | |
| git push origin "v$CURRENT_VERSION" | |
| fi |