From 5327891c4707748ce33ba9d8a3766857a7a5c5b4 Mon Sep 17 00:00:00 2001 From: Dr Griffith Rees Date: Wed, 12 Jun 2024 11:56:45 +0100 Subject: [PATCH 1/5] feat(ci): add rough config for `ci` testing --- .github/workflows/ci.yaml | 86 ++++++++++++++++++++++++++++++++ .github/workflows/lint_code.yaml | 20 -------- 2 files changed, 86 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/lint_code.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..e5410ef8 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,86 @@ +name: Continuous Integration + +# Run workflow on pushes to matching branches +on: + push: + branches: [main, ci-test-config] + pull_request: + branches: [main] + +concurrency: + group: ${{ github.head_ref || github.run_id }} + # cancel-in-progress: true + +jobs: + pre-commit: + name: Lint with pre-commit + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.11 + - uses: pre-commit/action@v3.0.1 + + pytest: + strategy: + fail-fast: true + matrix: + python-version: ["3.11", "3.12"] + # os: [ubuntu-latest, windows-latest, macos-latest] + os: [ubuntu-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - name: Run pre-commit tests + uses: pre-commit/action@main + + - name: Install with all components for testing + run: | + pip install poetry + poetry install --all-extras + + - name: Run pytest + run: poetry run pytest + + - name: Python Coverage Comment + uses: py-cov-action/python-coverage-comment-action@v2.2.0 + + - name: Store Pull Request comment to be posted + uses: actions/upload-artifact@v3 + if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' + with: + # If you use a different name, update COMMENT_ARTIFACT_NAME accordingly + name: python-coverage-comment-action + + coverage: + name: Coverage + runs-on: ubuntu-latest + needs: [test] + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + with: + python-version: 3.x + + - uses: actions/download-artifact@v3 + id: download + with: + name: "coverage" + + - name: Coverage comment + id: coverage_comment + uses: py-cov-action/python-coverage-comment-action@v3 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MERGE_COVERAGE_FILES: true + + - name: Store Pull Request comment to be posted + uses: actions/upload-artifact@v3 + if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' + with: + name: python-coverage-comment-action + path: python-coverage-comment-action.txt diff --git a/.github/workflows/lint_code.yaml b/.github/workflows/lint_code.yaml deleted file mode 100644 index bf783801..00000000 --- a/.github/workflows/lint_code.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -name: Lint code - -# Run workflow on pushes to matching branches -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - pre-commit: - name: Lint with pre-commit - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: 3.11 - - uses: pre-commit/action@v3.0.1 From 2ffdaa4f448a73a67efd5364d6b7270b0376f30d Mon Sep 17 00:00:00 2001 From: Dr Griffith Rees Date: Thu, 13 Jun 2024 15:46:00 +0100 Subject: [PATCH 2/5] fix(ci): fix `test` -> `pytest` ci config --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e5410ef8..43949299 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -59,7 +59,7 @@ jobs: coverage: name: Coverage runs-on: ubuntu-latest - needs: [test] + needs: [pytest] steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 From 626af4ac312d040d4d29a0e2152f40e7d937c9fc Mon Sep 17 00:00:00 2001 From: Dr Griffith Rees Date: Thu, 13 Jun 2024 15:48:45 +0100 Subject: [PATCH 3/5] feat(ci): remove unsupported `python` `3.12` --- .github/workflows/ci.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 43949299..ce33596d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,7 +26,8 @@ jobs: strategy: fail-fast: true matrix: - python-version: ["3.11", "3.12"] + # python-version: ["3.11", "3.12"] + python-version: ["3.11"] # os: [ubuntu-latest, windows-latest, macos-latest] os: [ubuntu-latest] runs-on: ${{ matrix.os }} @@ -35,8 +36,6 @@ jobs: - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - - name: Run pre-commit tests - uses: pre-commit/action@main - name: Install with all components for testing run: | From d53fbd8d4c734ff3a2d1ff66b13dff7c4f533a87 Mon Sep 17 00:00:00 2001 From: Dr Griffith Rees Date: Thu, 13 Jun 2024 16:39:35 +0100 Subject: [PATCH 4/5] fix(ci): fix and remve `coverage` steps in `ci` --- .github/workflows/ci.yaml | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ce33596d..0573752d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -46,40 +46,14 @@ jobs: run: poetry run pytest - name: Python Coverage Comment - uses: py-cov-action/python-coverage-comment-action@v2.2.0 - - - name: Store Pull Request comment to be posted - uses: actions/upload-artifact@v3 - if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' - with: - # If you use a different name, update COMMENT_ARTIFACT_NAME accordingly - name: python-coverage-comment-action - - coverage: - name: Coverage - runs-on: ubuntu-latest - needs: [pytest] - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v4 - with: - python-version: 3.x - - - uses: actions/download-artifact@v3 - id: download - with: - name: "coverage" - - - name: Coverage comment - id: coverage_comment uses: py-cov-action/python-coverage-comment-action@v3 with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MERGE_COVERAGE_FILES: true + GITHUB_TOKEN: ${{ github.token }} + - name: Store Pull Request comment to be posted - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' with: + # If you use a different name, update COMMENT_ARTIFACT_NAME accordingly name: python-coverage-comment-action - path: python-coverage-comment-action.txt From fe83cd3555d44461705227aeb1b6b607cbad411e Mon Sep 17 00:00:00 2001 From: Dr Griffith Rees Date: Thu, 13 Jun 2024 16:49:05 +0100 Subject: [PATCH 5/5] fix(ci): remove `coverage` steps of `test` `ci` --- .github/workflows/ci.yaml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0573752d..e21a1257 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,15 +45,15 @@ jobs: - name: Run pytest run: poetry run pytest - - name: Python Coverage Comment - uses: py-cov-action/python-coverage-comment-action@v3 - with: - GITHUB_TOKEN: ${{ github.token }} - - - - name: Store Pull Request comment to be posted - uses: actions/upload-artifact@v4 - if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' - with: - # If you use a different name, update COMMENT_ARTIFACT_NAME accordingly - name: python-coverage-comment-action + # - name: Python Coverage Comment + # uses: py-cov-action/python-coverage-comment-action@v3 + # with: + # GITHUB_TOKEN: ${{ github.token }} + # + # + # - name: Store Pull Request comment to be posted + # uses: actions/upload-artifact@v4 + # if: steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true' + # with: + # # If you use a different name, update COMMENT_ARTIFACT_NAME accordingly + # name: python-coverage-comment-action