From 31baa5e544cf98968a1b07a8730ec86001aa61d2 Mon Sep 17 00:00:00 2001 From: Bobby Lat Date: Thu, 9 Jan 2025 18:04:22 +0800 Subject: [PATCH] refactor: ensure tests are run against the lastet localnet images --- .github/workflows/cd.yaml | 22 +++++++++++----------- .github/workflows/check-python.yaml | 19 +++++++++---------- pyproject.toml | 2 +- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/.github/workflows/cd.yaml b/.github/workflows/cd.yaml index 7f34660212..d2110abf84 100644 --- a/.github/workflows/cd.yaml +++ b/.github/workflows/cd.yaml @@ -60,7 +60,7 @@ jobs: contents: write packages: read env: - DRY_RUN: ${{ inputs.dry_run && '--noop' || '' }} + DRY_RUN: ${{ inputs.dry_run && '--noop' || '' }} steps: - uses: actions/checkout@v4 with: @@ -83,11 +83,11 @@ jobs: - name: pre-commit and pytest if: inputs.run_checks run: | - set -o pipefail - source $(poetry env info --path)/bin/activate - pre-commit run --all-files && git diff --exit-code - algokit localnet start - pytest + set -o pipefail + source $(poetry env info --path)/bin/activate + pre-commit run --all-files && git diff --exit-code + algokit localnet reset --update + pytest - name: Get branch name shell: bash @@ -101,7 +101,7 @@ jobs: if: inputs.bump_version run: poetry run semantic-release $DRY_RUN --strict version env: - GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} - name: Create Compiler Wheel if: inputs.compiler_wheel @@ -110,9 +110,9 @@ jobs: - name: Create Stubs Wheel if: inputs.stubs_wheel run: | - pushd stubs - poetry build --format wheel - popd + pushd stubs + poetry build --format wheel + popd - uses: actions/upload-artifact@v4 # upload artifacts so they are retained on the job with: @@ -124,7 +124,7 @@ jobs: if: steps.get_branch.outputs.branch == 'main' && !inputs.dry_run && inputs.publish_github run: poetry run semantic-release $DRY_RUN publish env: - GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }} - name: Publish to PyPI - Compiler if: steps.get_branch.outputs.branch == 'main' && !inputs.dry_run && inputs.publish_pypi && inputs.compiler_wheel diff --git a/.github/workflows/check-python.yaml b/.github/workflows/check-python.yaml index bd8ae5ba29..ed56cb3203 100644 --- a/.github/workflows/check-python.yaml +++ b/.github/workflows/check-python.yaml @@ -25,28 +25,28 @@ jobs: - name: Check pre-commits run: | - set -o pipefail - poetry run pre-commit run --all-files && git diff --exit-code + set -o pipefail + poetry run pre-commit run --all-files && git diff --exit-code - name: Check generated code run: | - set -o pipefail - poetry run poe gen && git diff --exit-code + set -o pipefail + poetry run poe gen && git diff --exit-code - name: Check documentation run: | - set -o pipefail - poetry run poe docs + set -o pipefail + poetry run poe docs - name: Check wheels can be built run: | set -o pipefail - + # build stubs pushd stubs poetry build --format wheel popd - + # build compiler poetry build --format wheel @@ -69,7 +69,7 @@ jobs: run: poetry install --no-interaction --with cicd - name: Start LocalNet - run: poetry run algokit localnet start + run: poetry run algokit localnet reset --update - name: pytest + coverage shell: bash @@ -118,7 +118,6 @@ jobs: if: failure() run: git diff examples/ test_cases/ - compile-all-windows: runs-on: "windows-latest" steps: diff --git a/pyproject.toml b/pyproject.toml index 1c3f605031..fb36e9a3cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,7 +77,7 @@ puyapy-clientgen = "puyapy.client_gen:main" [tool.pytest.ini_options] markers = [ - "localnet: test requires `algokit localnet start`", + "localnet: test requires `algokit localnet reset --update`", "slow: marks tests as slow (deselect with '-m \"not slow\"')", ] addopts = "-n auto --cov-config=.coveragerc"