From c99b0089278f84c0517e3fb04c6d9f46bf1a5ce0 Mon Sep 17 00:00:00 2001 From: JHu Date: Mon, 29 Jul 2024 15:41:21 +1000 Subject: [PATCH 1/4] add github workflow: run tests when submitting PR --- .github/workflows/basic_tests.yml | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/basic_tests.yml diff --git a/.github/workflows/basic_tests.yml b/.github/workflows/basic_tests.yml new file mode 100644 index 0000000..12064d1 --- /dev/null +++ b/.github/workflows/basic_tests.yml @@ -0,0 +1,46 @@ +name: Basic Tests + +on: + pull_request: + branches: main + push: + branches: main + +jobs: + + run_tests: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: ["ubuntu-latest", "macos-latest"] + python-version: ["3.10"] + + + steps: + + # Set-up dependencies + - name: Check-out repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Needed for tags to be fetched; see https://github.com/actions/checkout/issues/290 + + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install Poetry + shell: bash -l {0} + run: | + python -m pip install poetry==1.6.1 + + + # Install the project (we need some of the tools installed here for liniting etc) + - name: Install the project + shell: bash -l {0} + run: poetry install --no-interaction --all-extras + + - name: Run tests + shell: bash -l {0} + run: pytest From b2561ae6e5e4d26bc7d3b4bddbc318b5a5ed206a Mon Sep 17 00:00:00 2001 From: JHu Date: Mon, 29 Jul 2024 16:01:36 +1000 Subject: [PATCH 2/4] try to fix the error with pytest not found --- .github/workflows/basic_tests.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/basic_tests.yml b/.github/workflows/basic_tests.yml index 12064d1..0d4f43d 100644 --- a/.github/workflows/basic_tests.yml +++ b/.github/workflows/basic_tests.yml @@ -43,4 +43,7 @@ jobs: - name: Run tests shell: bash -l {0} - run: pytest + run: | + python --version + poetry --version + python -m pytest From dc6e162a3e3a46e985b403ee93d04f87d9071c93 Mon Sep 17 00:00:00 2001 From: JHu Date: Mon, 29 Jul 2024 16:07:19 +1000 Subject: [PATCH 3/4] try to use poetry run to fix the error --- .github/workflows/basic_tests.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/basic_tests.yml b/.github/workflows/basic_tests.yml index 0d4f43d..1a48a1a 100644 --- a/.github/workflows/basic_tests.yml +++ b/.github/workflows/basic_tests.yml @@ -44,6 +44,4 @@ jobs: - name: Run tests shell: bash -l {0} run: | - python --version - poetry --version - python -m pytest + poetry run pytest From 188fc78b1715534d84a36032751eaf1ea68cad54 Mon Sep 17 00:00:00 2001 From: JHu Date: Mon, 29 Jul 2024 16:20:13 +1000 Subject: [PATCH 4/4] remove macos from the testing environment --- .github/workflows/basic_tests.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/basic_tests.yml b/.github/workflows/basic_tests.yml index 1a48a1a..052a7a3 100644 --- a/.github/workflows/basic_tests.yml +++ b/.github/workflows/basic_tests.yml @@ -9,12 +9,9 @@ on: jobs: run_tests: - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest strategy: - fail-fast: false - matrix: - os: ["ubuntu-latest", "macos-latest"] - python-version: ["3.10"] + fail-fast: true steps: @@ -28,7 +25,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: ${{ matrix.python-version }} + python-version: 3.10 - name: Install Poetry shell: bash -l {0}