chore: streamline CI workflow for Poetry installation and path manage… #101
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: | |
| lint: | |
| name: Lint and Format Check | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | |
| - name: Install Poetry | |
| uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1 | |
| with: | |
| version: latest | |
| virtualenvs-create: true | |
| installer-parallel: true | |
| - name: Add Poetry to PATH | |
| run: | | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| echo "$HOME/.poetry/bin" >> $GITHUB_PATH | |
| - name: Load cached Poetry dependencies | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | |
| id: cache | |
| with: | |
| path: ~/.cache/pypoetry | |
| key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-poetry- | |
| - name: Install dependencies | |
| run: | | |
| poetry install --with lint --no-root --no-interaction | |
| - name: Run Ruff check | |
| run: | | |
| poetry run ruff check temporal_boost/ --output-format=github | |
| - name: Run Ruff format check | |
| run: | | |
| poetry run ruff format --check temporal_boost/ | |
| - name: Run MyPy type checking | |
| run: | | |
| poetry run mypy temporal_boost/ || true | |
| lint-examples: | |
| name: Lint Examples | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | |
| - name: Install Poetry | |
| uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1 | |
| with: | |
| version: latest | |
| virtualenvs-create: true | |
| installer-parallel: true | |
| - name: Add Poetry to PATH | |
| run: | | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| echo "$HOME/.poetry/bin" >> $GITHUB_PATH | |
| - name: Load cached Poetry dependencies | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | |
| with: | |
| path: ~/.cache/pypoetry | |
| key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-poetry- | |
| - name: Install dependencies | |
| run: | | |
| poetry install --with lint --no-root --no-interaction | |
| - name: Run Ruff check on examples | |
| run: | | |
| poetry run ruff check examples/ --output-format=github || true | |
| - name: Run Ruff format check on examples | |
| run: | | |
| poetry run ruff format --check examples/ || true | |
| test: | |
| name: Unit Tests (Python ${{ matrix.python-version }}) | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12", "3.13"] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install Poetry | |
| uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1 | |
| with: | |
| version: latest | |
| virtualenvs-create: true | |
| installer-parallel: true | |
| - name: Add Poetry to PATH | |
| run: | | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| echo "$HOME/.poetry/bin" >> $GITHUB_PATH | |
| - name: Load cached Poetry dependencies | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | |
| with: | |
| path: ~/.cache/pypoetry | |
| key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-poetry- | |
| - name: Install dependencies | |
| run: | | |
| poetry install --with test --no-root --no-interaction | |
| env: | |
| PATH: /usr/local/bin:/usr/bin:/bin:$HOME/.local/bin:$HOME/.poetry/bin:${{ github.workspace }}:$PATH | |
| - name: Run tests with coverage | |
| run: | | |
| poetry run pytest tests/ --cov=temporal_boost --cov-report=xml --cov-report=term --cov-report=html -v | |
| env: | |
| PATH: /usr/local/bin:/usr/bin:/bin:$HOME/.local/bin:$HOME/.poetry/bin:${{ github.workspace }}:$PATH | |
| - name: Upload coverage to Codecov | |
| if: matrix.python-version == '3.11' | |
| uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4 | |
| with: | |
| files: ./coverage.xml | |
| flags: unittests | |
| name: codecov-umbrella | |
| fail_ci_if_error: false | |
| - name: Upload coverage reports | |
| if: matrix.python-version == '3.11' | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: coverage-report-${{ matrix.python-version }} | |
| path: htmlcov/ | |
| retention-days: 30 | |
| test-examples: | |
| name: Test Examples | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 | |
| - name: Install Poetry | |
| uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1 | |
| with: | |
| version: latest | |
| virtualenvs-create: true | |
| installer-parallel: true | |
| - name: Add Poetry to PATH | |
| run: | | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| echo "$HOME/.poetry/bin" >> $GITHUB_PATH | |
| - name: Load cached Poetry dependencies | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | |
| with: | |
| path: ~/.cache/pypoetry | |
| key: ${{ runner.os }}-poetry-${{ hashFiles('**/poetry.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-poetry- | |
| - name: Install dependencies | |
| run: | | |
| POETRY_BIN="$HOME/.local/bin/poetry" | |
| if [ ! -f "$POETRY_BIN" ]; then | |
| POETRY_BIN="poetry" | |
| fi | |
| "$POETRY_BIN" install --no-root --no-interaction --all-extras | |
| shell: bash | |
| env: | |
| PATH: /usr/local/bin:/usr/bin:/bin:$HOME/.local/bin:$HOME/.poetry/bin | |
| - name: Check example imports | |
| run: | | |
| POETRY_BIN="$HOME/.local/bin/poetry" | |
| if [ ! -f "$POETRY_BIN" ]; then | |
| POETRY_BIN="poetry" | |
| fi | |
| "$POETRY_BIN" run python -c "import examples.example_starter; import examples.example_app" || true | |
| shell: bash | |
| env: | |
| PATH: /usr/local/bin:/usr/bin:/bin:$HOME/.local/bin:$HOME/.poetry/bin | |
| - name: Verify example syntax | |
| run: | | |
| POETRY_BIN="$HOME/.local/bin/poetry" | |
| if [ ! -f "$POETRY_BIN" ]; then | |
| POETRY_BIN="poetry" | |
| fi | |
| "$POETRY_BIN" run python -m py_compile examples/*.py || true | |
| shell: bash | |
| env: | |
| PATH: /usr/local/bin:/usr/bin:/bin:$HOME/.local/bin:$HOME/.poetry/bin |