diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index dd95f34..9e525bc 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -1,5 +1,7 @@ name: Build package and push to PyPi + on: + workflow_dispatch: push: tags: - "v*.*.*" @@ -8,10 +10,58 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Build and publish to pypi - uses: JRubics/poetry-publish@v1.16 + - name: Check out repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Includes getting tags + + - name: Cache $HOME/.local # Significantly speeds up Poetry Install + uses: actions/cache@v4 + with: + path: ~/.local + key: dotlocal-${{ runner.os }}-${{ hashFiles('.github/workflows/deploy.yml') }} + + - name: Set up python 3.12 + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true + + - name: Add Poetry Plugins + run: | + poetry self add poetry-dynamic-versioning[plugin] + + - name: Load cached venv + id: cached-poetry-dependencies + uses: actions/cache@v4 + with: + path: .venv + key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} + + - name: Install dependencies + if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' + run: poetry install --no-interaction --no-root --without=dev + + - name: Install project + run: poetry install --no-interaction --without=dev + + - name: Build package + run: poetry build + + - name: Publish package + if: github.event_name != 'workflow_dispatch' + run: | + poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} + poetry publish + + - uses: actions/upload-artifact@v4 + if: always() with: - pypi_token: ${{ secrets.PYPI_TOKEN }} - ignore_dev_requirements: "yes" - plugins: "poetry-dynamic-versioning[plugin]" + name: dist + path: dist/ diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml index 40365e2..621bfd6 100644 --- a/.github/workflows/pre-commit.yaml +++ b/.github/workflows/pre-commit.yaml @@ -16,15 +16,17 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache $HOME/.local # Significantly speeds up Poetry Install - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.local key: dotlocal-${{ runner.os }}-${{ hashFiles('.github/workflows/tests.yml') }} - - uses: actions/setup-python@v4 + - uses: actions/setup-python@v5 + with: + python-version: "3.12" - name: Install Poetry uses: snok/install-poetry@v1 @@ -34,7 +36,7 @@ jobs: installer-parallel: true - name: Load pip cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }} @@ -42,7 +44,7 @@ jobs: - name: Load cached venv id: cached-poetry-dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: .venv key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} @@ -50,4 +52,4 @@ jobs: - name: Install Belay run: poetry install --no-interaction - - uses: pre-commit/action@v2.0.3 + - uses: pre-commit/action@v3.0.1 diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 52f8212..ac03f73 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -47,22 +47,22 @@ jobs: echo 'ACTIVATE_PYTHON_VENV=.venv/bin/activate' >> $GITHUB_ENV - name: Check out Belay repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Check out RP2040js repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: wokwi/rp2040js path: rp2040js - name: Cache $HOME/.local # Significantly speeds up Poetry Install - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.local key: dotlocal-${{ runner.os }}-${{ hashFiles('.github/workflows/tests.yml') }} - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -75,7 +75,7 @@ jobs: - name: Cache Pi Pico MicroPython 1.17 firmware id: cached-pi-pico-micropython-1-17-firmware - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: rp2040js/micropython-v1.17.uf2 key: pi-pico-rp2040js/micropython-v1.17.uf2 @@ -87,7 +87,7 @@ jobs: - name: Cache Pi Pico CircuitPython 7.3.3 firmware id: cached-pi-pico-circuitpython-7-3-3-firmware - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: rp2040js/circuitpython-v7.3.3.uf2 key: pi-pico-rp2040js/circuitpython-v7.3.3.uf2 @@ -99,7 +99,7 @@ jobs: - name: Cache Pi Pico CircuitPython 8.0.0 firmware id: cached-pi-pico-circuitpython-8-0-0-firmware - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: rp2040js/circuitpython-v8.0.0.uf2 key: pi-pico-rp2040js/circuitpython-v8.0.0.uf2 @@ -111,7 +111,7 @@ jobs: - name: Cache Node Modules id: cached-npm - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: rp2040js/node_modules key: modules-${{ hashFiles('rp2040js/package-lock.json') }} @@ -123,7 +123,7 @@ jobs: npm install - name: Load pip cache - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.cache/pip key: pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }} @@ -131,7 +131,7 @@ jobs: - name: Load cached venv id: cached-poetry-dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: .venv key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} @@ -143,12 +143,6 @@ jobs: - name: Install Belay run: poetry install --no-interaction - - name: Collect Workflow Telemetry - uses: runforesight/workflow-telemetry-action@v1 - with: - theme: light - comment_on_pr: false - - name: Run tests (unit only) if: runner.os == 'Windows' run: | @@ -164,7 +158,7 @@ jobs: coverage report - name: Upload coverage to Codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} flags: unittests