From 7f837b540b45636b10f38ce0295e3bafecfd6664 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klemen=20Tu=C5=A1ar?= Date: Sun, 28 Apr 2024 12:54:31 +0100 Subject: [PATCH] :construction_worker: update CI --- .github/workflows/publish.yml | 16 ++++++++-------- .github/workflows/test.yml | 11 ++++++----- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 8fe6997..b2f2c45 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,7 +10,12 @@ defaults: permissions: read-all jobs: + test: + uses: ./.github/workflows/test.yml + secrets: inherit build-and-publish: + needs: test + name: "Build & Publish" runs-on: ubuntu-latest environment: name: pypi @@ -44,17 +49,13 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.x" + cache: "pip" - name: Install build dependencies id: install_build_dependencies - run: | - set -e - python3 -m pip install --upgrade pip - pip install build setuptools wheel + run: pip install build setuptools wheel - name: Build a binary wheel and a source tarball id: build - run: | - set -e - python3 -m build --sdist --wheel --outdir dist/ . + run: python -m build --sdist --wheel --outdir dist/ . - name: Publish distribution package to PyPI id: publish if: startsWith(github.ref, 'refs/tags') @@ -62,7 +63,6 @@ jobs: - name: Install pyproject-parser id: install_pyproject_parser run: | - set -e pip install pyproject-parser[cli] - name: Read project name from pyproject.toml id: read_project_name diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d23c57e..355c476 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,6 +7,7 @@ on: pull_request: branches: - main + workflow_call: defaults: run: shell: bash @@ -14,6 +15,7 @@ permissions: read-all jobs: analyze: + name: "Test" runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -21,10 +23,9 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.x" + cache: "pip" - name: Install dependencies - run: | - python3 -m pip install --upgrade pip - pip install -r requirements_dev.txt + run: pip install -r requirements_dev.txt - name: Run static analysis run: tox -e linters test: @@ -53,6 +54,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.py }} + cache: "pip" - uses: actions/cache@v4 with: path: ~/.cache/pip @@ -61,8 +63,7 @@ jobs: ${{ runner.os }}-pip- - name: Install dependencies run: | - python -m pip install --upgrade pip - python -m pip install -U codecov tox-gh-actions + pip install -U codecov tox-gh-actions pip install -r requirements_dev.txt - name: Test with tox run: tox