diff --git a/.github/actions/install-env/action.yml b/.github/actions/install-env/action.yml new file mode 100644 index 0000000000..0b93e039ef --- /dev/null +++ b/.github/actions/install-env/action.yml @@ -0,0 +1,42 @@ +name: Install env +runs: + using: "composite" + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Set up python + id: set-up-python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Load cached Poetry installation + uses: actions/cache@v3 + with: + path: ~/.local + key: poetry-0 + + - name: Install poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + + - name: Load cached virtual env + uses: actions/cache@v3 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.set-up-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + + - name: Install dependencies + shell: bash + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: make install-dependencies + + - name: Activate environment + shell: bash + run: source $VENV diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 2983c890af..a596d0817a 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -24,6 +24,8 @@ on: branches: - 'main' pull_request: + branches: + - "*" concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -34,20 +36,13 @@ jobs: runs-on: ubuntu-22.04 strategy: matrix: - python: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.8', '3.9', '3.10', '3.11'] steps: - uses: actions/checkout@v4 - - name: Install poetry - run: make install-poetry - - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - cache: poetry - cache-dependency-path: ./poetry.lock - - name: Install - run: make install-dependencies + - uses: ./.github/actions/install-env - name: Linters run: make lint + - name: Tests run: make test-coverage