From 23cd0a0d7e4bd57c8b67916ce0b97c9c5b73bdb8 Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Tue, 3 Sep 2024 14:20:05 +0200 Subject: [PATCH 1/6] Update GHA to fix coverage and update upload/download GHAs --- .github/workflows/ci_poetry.yml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci_poetry.yml b/.github/workflows/ci_poetry.yml index 9836cfc8d..20830c604 100644 --- a/.github/workflows/ci_poetry.yml +++ b/.github/workflows/ci_poetry.yml @@ -43,13 +43,15 @@ jobs: run: poetry install --with dev --without docs --no-interaction - name: Test core library with pytest + env: + COVERAGE_FILE: "coverage-data-${{ runner.os }}-${{ matrix.python_version }}-core" run: poetry run coverage run -m pytest tests --ignore tests/tasks --ignore tests/dev - name: Upload coverage data - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: coverage-data - path: ".coverage*" + name: "coverage-data-${{ runner.os }}-${{ matrix.python_version }}-core" + path: "coverage-data-*" tests_tasks: name: "Tasks, Python ${{ matrix.python-version }}" @@ -96,13 +98,16 @@ jobs: key: pooch-cache - name: Test tasks with pytest + env: + COVERAGE_FILE: "coverage-data-${{ runner.os }}-${{ matrix.python_version }}-tasks" + run: poetry run coverage run -m pytest tests/dev tests/tasks -s --log-cli-level info - name: Upload coverage data - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: coverage-data - path: ".coverage*" + name: "coverage-data-${{ runner.os }}-${{ matrix.python_version }}-tasks" + path: "coverage-data-*" coverage: name: Coverage @@ -119,13 +124,18 @@ jobs: run: python -m pip install --upgrade coverage[toml] - name: Download data - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: coverage-data + pattern: coverage-data-* + merge-multiple: true - name: Add coverage comment to Pull Requests id: coverage_comment - uses: py-cov-action/python-coverage-comment-action@v3 + env: + # Base name of the data files to operate on. Defaults to `.coverage'. + # [env: COVERAGE_FILE]. + # (https://coverage.readthedocs.io/en/latest/cmd.html#cmd-combine) + COVERAGE_FILE: "coverage-data-" with: GITHUB_TOKEN: ${{ github.token }} MERGE_COVERAGE_FILES: true From a25aafdcff04f2231a553dbd1a60b37732009092 Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Tue, 3 Sep 2024 14:21:48 +0200 Subject: [PATCH 2/6] Restore missing `uses` in GHA --- .github/workflows/ci_poetry.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci_poetry.yml b/.github/workflows/ci_poetry.yml index 20830c604..61932178c 100644 --- a/.github/workflows/ci_poetry.yml +++ b/.github/workflows/ci_poetry.yml @@ -131,6 +131,7 @@ jobs: - name: Add coverage comment to Pull Requests id: coverage_comment + uses: py-cov-action/python-coverage-comment-action@v3 env: # Base name of the data files to operate on. Defaults to `.coverage'. # [env: COVERAGE_FILE]. From b163cb4c2508a16f4fe1ccd5fdf2dd88ebecb0ba Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Tue, 3 Sep 2024 14:22:59 +0200 Subject: [PATCH 3/6] Update CHANGELOG [skip ci] --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b54d90267..64e54c680 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Use latest version of Zenodo tiny-ome-zarr dataset (\#817). * Relax pip-version constraint in external-packages-manifest tests (\#825). * Run pip-based CI also regularly and on-demand (\#829). + * Update GitHub actionss for upload/download/coverage (\#832). * Dependencies: * Require `stackview<=0.9.0` (\#829). * Documentation: From c4853e1e8d199761a229e93f00477d42fb2ce1bc Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Tue, 3 Sep 2024 14:32:09 +0200 Subject: [PATCH 4/6] Update ci_poetry.yml --- .github/workflows/ci_poetry.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci_poetry.yml b/.github/workflows/ci_poetry.yml index 61932178c..bd8fd9237 100644 --- a/.github/workflows/ci_poetry.yml +++ b/.github/workflows/ci_poetry.yml @@ -44,13 +44,13 @@ jobs: - name: Test core library with pytest env: - COVERAGE_FILE: "coverage-data-${{ runner.os }}-${{ matrix.python_version }}-core" + COVERAGE_FILE: "coverage-data-${{ matrix.python-version }}-core" run: poetry run coverage run -m pytest tests --ignore tests/tasks --ignore tests/dev - name: Upload coverage data uses: actions/upload-artifact@v4 with: - name: "coverage-data-${{ runner.os }}-${{ matrix.python_version }}-core" + name: "coverage-data-${{ matrix.python-version }}-core" path: "coverage-data-*" tests_tasks: @@ -99,14 +99,14 @@ jobs: - name: Test tasks with pytest env: - COVERAGE_FILE: "coverage-data-${{ runner.os }}-${{ matrix.python_version }}-tasks" + COVERAGE_FILE: "coverage-data-${{ matrix.python-version }}-tasks" run: poetry run coverage run -m pytest tests/dev tests/tasks -s --log-cli-level info - name: Upload coverage data uses: actions/upload-artifact@v4 with: - name: "coverage-data-${{ runner.os }}-${{ matrix.python_version }}-tasks" + name: "coverage-data-${{ matrix.python-version }}-tasks" path: "coverage-data-*" coverage: From 8301acbf1fb8b8945d4e1a76b11e7b28ee11a9c6 Mon Sep 17 00:00:00 2001 From: Tommaso Comparin <3862206+tcompa@users.noreply.github.com> Date: Tue, 3 Sep 2024 14:50:15 +0200 Subject: [PATCH 5/6] Update CHANGELOG.md [skip ci] --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64e54c680..d645da4c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ * Use latest version of Zenodo tiny-ome-zarr dataset (\#817). * Relax pip-version constraint in external-packages-manifest tests (\#825). * Run pip-based CI also regularly and on-demand (\#829). - * Update GitHub actionss for upload/download/coverage (\#832). + * Update GitHub actions for upload/download/coverage (\#832). * Dependencies: * Require `stackview<=0.9.0` (\#829). * Documentation: From a3a05d5e7e8f631b10ab418ae41a90dee6fd2a98 Mon Sep 17 00:00:00 2001 From: Yuri Chiucconi Date: Tue, 3 Sep 2024 16:55:50 +0200 Subject: [PATCH 6/6] fix gha --- .github/workflows/ci_poetry.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci_poetry.yml b/.github/workflows/ci_poetry.yml index bd8fd9237..92330f27d 100644 --- a/.github/workflows/ci_poetry.yml +++ b/.github/workflows/ci_poetry.yml @@ -44,14 +44,14 @@ jobs: - name: Test core library with pytest env: - COVERAGE_FILE: "coverage-data-${{ matrix.python-version }}-core" + COVERAGE_FILE: coverage-data-core-${{ matrix.python-version }} run: poetry run coverage run -m pytest tests --ignore tests/tasks --ignore tests/dev - name: Upload coverage data uses: actions/upload-artifact@v4 with: - name: "coverage-data-${{ matrix.python-version }}-core" - path: "coverage-data-*" + name: coverage-data-core-${{ matrix.python-version }} + path: coverage-data-core-${{ matrix.python-version }}* tests_tasks: name: "Tasks, Python ${{ matrix.python-version }}" @@ -99,15 +99,14 @@ jobs: - name: Test tasks with pytest env: - COVERAGE_FILE: "coverage-data-${{ matrix.python-version }}-tasks" - + COVERAGE_FILE: coverage-data-tasks-${{ matrix.python-version }} run: poetry run coverage run -m pytest tests/dev tests/tasks -s --log-cli-level info - name: Upload coverage data uses: actions/upload-artifact@v4 with: - name: "coverage-data-${{ matrix.python-version }}-tasks" - path: "coverage-data-*" + name: coverage-data-tasks-${{ matrix.python-version }} + path: coverage-data-tasks-${{ matrix.python-version }}* coverage: name: Coverage @@ -129,17 +128,19 @@ jobs: pattern: coverage-data-* merge-multiple: true + - name: Combine coverage + # Combines all the downloaded coverage artifacts in a single `.coverage` file, + # which will then be used by `py-cov-action/python-coverage-comment-action`. + # We added this step to replace the variable `MERGE_COVERAGE_FILES: true` + # in the next step, which had started to raise errors + # (https://github.com/fractal-analytics-platform/fractal-server/pull/1725). + run: coverage combine coverage-data-* + - name: Add coverage comment to Pull Requests id: coverage_comment uses: py-cov-action/python-coverage-comment-action@v3 - env: - # Base name of the data files to operate on. Defaults to `.coverage'. - # [env: COVERAGE_FILE]. - # (https://coverage.readthedocs.io/en/latest/cmd.html#cmd-combine) - COVERAGE_FILE: "coverage-data-" with: GITHUB_TOKEN: ${{ github.token }} - MERGE_COVERAGE_FILES: true MINIMUM_GREEN: 90 MINIMUM_ORANGE: 60 ANNOTATE_MISSING_LINES: true