Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up Github Actions to run PR checks (linters, tests) #35

Closed
nifadyev opened this issue May 17, 2024 · 0 comments · Fixed by #51
Closed

Set up Github Actions to run PR checks (linters, tests) #35

nifadyev opened this issue May 17, 2024 · 0 comments · Fixed by #51
Assignees
Labels

Comments

@nifadyev
Copy link
Collaborator

nifadyev commented May 17, 2024

Use this fragment as an example

name: pr

on:
  - pull_request

permissions:
  contents: read
  pull-requests: read
  checks: write

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  PYTHON_VERSION: "3.12"
  POETRY_VERSION: "1.8.3"

jobs:
  lint:
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@v4

      - name: Install python
        uses: actions/setup-python@v5
        with:
          python-version: ${{ env.PYTHON_VERSION }}

      - name: Install Poetry
        run: pipx install poetry==${{ env.POETRY_VERSION }} --python python${{ env.PYTHON_VERSION }}

      - name: Restore dependencies from cache
        uses: actions/cache@v4
        with:
          path: ~/.cache/pypoetry
          key: dependencies-cache-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ env.POETRY_VERSION }}
          restore-keys: |
            dependencies-cache-${{ runner.os }}-

      - name: Install dependencies
        if: steps.setup-python.outputs.cache-hit != 'true'
        run: |
          poetry config virtualenvs.create false
          poetry install --no-root --no-interaction

      - name: Run linters & friends
        run: make lint
@nifadyev nifadyev added the infra label May 17, 2024
@nifadyev nifadyev moved this to To do in toggl-python tasks Jul 23, 2024
@nifadyev nifadyev changed the title Set up Github Actions to run linters, formatters, and tests Set up Github Actions to run PR checks (linters, tests) Aug 22, 2024
@nifadyev nifadyev self-assigned this Aug 22, 2024
nifadyev added a commit that referenced this issue Aug 22, 2024
* Use matrix to run tests on supported Python versions
* Cache Poetry and project dependencies
@nifadyev nifadyev linked a pull request Aug 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Development

Successfully merging a pull request may close this issue.

1 participant