From 70114b36cfcf1b17be12bc52780b885d74fd9afc Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Fri, 1 Dec 2023 11:21:11 +0100 Subject: [PATCH 1/6] GHA: Fix actions for PRs from forks * run codecov only on pull requests * trigger relevant actions on `pull_request` instead of only on `push` Closes #2218 --- .github/workflows/test_install.yml | 2 +- .github/workflows/test_petab_test_suite.yml | 1 + .github/workflows/test_python_cplusplus.yml | 5 +++++ .github/workflows/test_sbml_semantic_test_suite.yml | 1 + .github/workflows/test_windows.yml | 1 + 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_install.yml b/.github/workflows/test_install.yml index be74cfa4c6..166616b434 100644 --- a/.github/workflows/test_install.yml +++ b/.github/workflows/test_install.yml @@ -1,5 +1,5 @@ name: Installation -on: [push, merge_group, workflow_dispatch] +on: [push, pull_request, merge_group, workflow_dispatch] jobs: archive: diff --git a/.github/workflows/test_petab_test_suite.yml b/.github/workflows/test_petab_test_suite.yml index d5c4dc4fe8..9d0a0713f7 100644 --- a/.github/workflows/test_petab_test_suite.yml +++ b/.github/workflows/test_petab_test_suite.yml @@ -85,6 +85,7 @@ jobs: tests/petab_test_suite/ - name: Codecov + if: github.event_name == 'pull_request' uses: codecov/codecov-action@v3.1.0 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/test_python_cplusplus.yml b/.github/workflows/test_python_cplusplus.yml index a531d2db2c..13f2388db8 100644 --- a/.github/workflows/test_python_cplusplus.yml +++ b/.github/workflows/test_python_cplusplus.yml @@ -6,6 +6,7 @@ on: pull_request: branches: - master + - develop jobs: ubuntu-cpp-python-tests: @@ -65,6 +66,7 @@ jobs: ${AMICI_DIR}/python/tests/test_splines.py - name: Codecov Python + if: github.event_name == 'pull_request' uses: codecov/codecov-action@v3.1.0 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -84,6 +86,7 @@ jobs: && lcov -a coverage_cpp.info -a coverage_py.info -o coverage.info - name: Codecov CPP + if: github.event_name == 'pull_request' uses: codecov/codecov-action@v3.1.0 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -137,6 +140,7 @@ jobs: ${AMICI_DIR}/python/tests/test_splines_short.py - name: Codecov Python + if: github.event_name == 'pull_request' uses: codecov/codecov-action@v3.1.0 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -156,6 +160,7 @@ jobs: && lcov -a coverage_cpp.info -a coverage_py.info -o coverage.info - name: Codecov CPP + if: github.event_name == 'pull_request' uses: codecov/codecov-action@v3.1.0 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/test_sbml_semantic_test_suite.yml b/.github/workflows/test_sbml_semantic_test_suite.yml index 0fde56b8f9..304e862d5c 100644 --- a/.github/workflows/test_sbml_semantic_test_suite.yml +++ b/.github/workflows/test_sbml_semantic_test_suite.yml @@ -54,6 +54,7 @@ jobs: path: tests/amici-semantic-results - name: Codecov SBMLSuite + if: github.event_name == 'pull_request' uses: codecov/codecov-action@v3.1.0 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml index 53834c3000..9dc13efbea 100644 --- a/.github/workflows/test_windows.yml +++ b/.github/workflows/test_windows.yml @@ -7,6 +7,7 @@ on: - cron: '48 4 * * *' pull_request: branches: + - develop - master jobs: From ee33ac208a9cbe6bae441af60e3bd0975a1dbc04 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Fri, 1 Dec 2023 11:54:07 +0100 Subject: [PATCH 2/6] deploy_branch.yml --- .github/workflows/deploy_branch.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy_branch.yml b/.github/workflows/deploy_branch.yml index 73294286a1..82d1452d37 100644 --- a/.github/workflows/deploy_branch.yml +++ b/.github/workflows/deploy_branch.yml @@ -1,5 +1,5 @@ name: Deploy Branch -on: [push, merge_group, workflow_dispatch] +on: [push, pull_request, merge_group, workflow_dispatch] jobs: sdist: From 40deca65ad1beddab37bc15747cebf66ceca9da6 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Fri, 1 Dec 2023 12:03:46 +0100 Subject: [PATCH 3/6] .. --- .github/workflows/test_petab_test_suite.yml | 2 +- .github/workflows/test_python_cplusplus.yml | 8 ++++---- .github/workflows/test_sbml_semantic_test_suite.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_petab_test_suite.yml b/.github/workflows/test_petab_test_suite.yml index 9d0a0713f7..df188e7abe 100644 --- a/.github/workflows/test_petab_test_suite.yml +++ b/.github/workflows/test_petab_test_suite.yml @@ -85,7 +85,7 @@ jobs: tests/petab_test_suite/ - name: Codecov - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request' || github.repository_owner == 'AMICI-dev' uses: codecov/codecov-action@v3.1.0 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/test_python_cplusplus.yml b/.github/workflows/test_python_cplusplus.yml index 13f2388db8..e4edff66ef 100644 --- a/.github/workflows/test_python_cplusplus.yml +++ b/.github/workflows/test_python_cplusplus.yml @@ -66,7 +66,7 @@ jobs: ${AMICI_DIR}/python/tests/test_splines.py - name: Codecov Python - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request' || github.repository_owner == 'AMICI-dev' uses: codecov/codecov-action@v3.1.0 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -86,7 +86,7 @@ jobs: && lcov -a coverage_cpp.info -a coverage_py.info -o coverage.info - name: Codecov CPP - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request' || github.repository_owner == 'AMICI-dev' uses: codecov/codecov-action@v3.1.0 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -140,7 +140,7 @@ jobs: ${AMICI_DIR}/python/tests/test_splines_short.py - name: Codecov Python - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request' || github.repository_owner == 'AMICI-dev' uses: codecov/codecov-action@v3.1.0 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -160,7 +160,7 @@ jobs: && lcov -a coverage_cpp.info -a coverage_py.info -o coverage.info - name: Codecov CPP - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request' || github.repository_owner == 'AMICI-dev' uses: codecov/codecov-action@v3.1.0 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/test_sbml_semantic_test_suite.yml b/.github/workflows/test_sbml_semantic_test_suite.yml index 304e862d5c..2af34d3762 100644 --- a/.github/workflows/test_sbml_semantic_test_suite.yml +++ b/.github/workflows/test_sbml_semantic_test_suite.yml @@ -54,7 +54,7 @@ jobs: path: tests/amici-semantic-results - name: Codecov SBMLSuite - if: github.event_name == 'pull_request' + if: github.event_name == 'pull_request' || github.repository_owner == 'AMICI-dev' uses: codecov/codecov-action@v3.1.0 with: token: ${{ secrets.CODECOV_TOKEN }} From e94b147d7e06b391d78b5b827df137a87f214a9c Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Fri, 1 Dec 2023 12:56:09 +0100 Subject: [PATCH 4/6] sonar --- .github/workflows/test_python_cplusplus.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_python_cplusplus.yml b/.github/workflows/test_python_cplusplus.yml index e4edff66ef..3d0708aea4 100644 --- a/.github/workflows/test_python_cplusplus.yml +++ b/.github/workflows/test_python_cplusplus.yml @@ -95,6 +95,7 @@ jobs: fail_ci_if_error: true - name: Run sonar-scanner + if: github.repository_owner == 'AMICI-dev' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From d1251ebcacf0ed23e4c4e6e0e1f10a4199aed347 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Fri, 1 Dec 2023 13:05:11 +0100 Subject: [PATCH 5/6] .. --- .github/workflows/test_python_cplusplus.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_python_cplusplus.yml b/.github/workflows/test_python_cplusplus.yml index 3d0708aea4..7876f8bf33 100644 --- a/.github/workflows/test_python_cplusplus.yml +++ b/.github/workflows/test_python_cplusplus.yml @@ -170,6 +170,7 @@ jobs: fail_ci_if_error: true - name: Run sonar-scanner + if: github.repository_owner == 'AMICI-dev' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From fcc4c971f461765eebf343e52a22dd3f02fdeffc Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Fri, 1 Dec 2023 14:25:54 +0100 Subject: [PATCH 6/6] sonar --- .github/workflows/test_python_cplusplus.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_python_cplusplus.yml b/.github/workflows/test_python_cplusplus.yml index 7876f8bf33..496779c6ec 100644 --- a/.github/workflows/test_python_cplusplus.yml +++ b/.github/workflows/test_python_cplusplus.yml @@ -95,7 +95,7 @@ jobs: fail_ci_if_error: true - name: Run sonar-scanner - if: github.repository_owner == 'AMICI-dev' + if: ${{ env.SONAR_TOKEN != '' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} @@ -170,7 +170,7 @@ jobs: fail_ci_if_error: true - name: Run sonar-scanner - if: github.repository_owner == 'AMICI-dev' + if: ${{ env.SONAR_TOKEN != '' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}