From e61cf5b5ba2287df55141a28c5c3cf60da7a3554 Mon Sep 17 00:00:00 2001 From: Daniel Stoops Date: Tue, 17 Dec 2024 11:33:27 +0200 Subject: [PATCH 1/6] Run codecov before every PR --- .github/workflows/workflow.yml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 84312db..6831f5f 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -3,6 +3,31 @@ name: Run checks on: [pull_request] jobs: + codecov-of-main: + name: codecov_of_main + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + path: main + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[dev] + - name: Generate coverage report + run: python -m pytest --cov --cov-report=xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + fail_ci_if_error: false + token: ${{ secrets.CODECOV_TOKEN }} + slug: Stoops-ML/czml3 + verbose: true + tox-checks: runs-on: ubuntu-latest strategy: @@ -21,8 +46,8 @@ jobs: - name: Test with tox run: tox - codecov: - name: codecov + codecov-of-PR: + name: codecov_of_PR runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From c864f7429894ab1ad109faa4a4a4d50e1c6af882 Mon Sep 17 00:00:00 2001 From: Daniel Stoops Date: Tue, 17 Dec 2024 11:37:17 +0200 Subject: [PATCH 2/6] codecov-of-PR needs codecov-of-main --- .github/workflows/workflow.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 6831f5f..42d3e0b 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -4,7 +4,7 @@ on: [pull_request] jobs: codecov-of-main: - name: codecov_of_main + name: codecov of main runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -47,7 +47,9 @@ jobs: run: tox codecov-of-PR: - name: codecov_of_PR + name: codecov of PR + needs: + - codecov-of-main runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From a7272e3551f2e786f24004babbb288135ef1f40e Mon Sep 17 00:00:00 2001 From: Daniel Stoops Date: Tue, 17 Dec 2024 11:42:55 +0200 Subject: [PATCH 3/6] codecov-of-main checks out main --- .github/workflows/workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 42d3e0b..855d45d 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -9,7 +9,7 @@ jobs: steps: - uses: actions/checkout@v4 with: - path: main + ref: main - name: Setup Python uses: actions/setup-python@v4 with: From 5dae884f836f5e665eb91f66434b64ca0a5f688c Mon Sep 17 00:00:00 2001 From: Daniel Stoops Date: Tue, 17 Dec 2024 11:50:03 +0200 Subject: [PATCH 4/6] Upload codecov on merge --- .github/workflows/codecov-from-main.yml | 33 +++++++++++++++++++++++++ .github/workflows/workflow.yml | 27 -------------------- 2 files changed, 33 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/codecov-from-main.yml diff --git a/.github/workflows/codecov-from-main.yml b/.github/workflows/codecov-from-main.yml new file mode 100644 index 0000000..61f5cbd --- /dev/null +++ b/.github/workflows/codecov-from-main.yml @@ -0,0 +1,33 @@ +name: Upload codecov from main + +on: + pull_request: + types: + - closed + +jobs: + codecov-of-main: + name: codecov of main + if: github.event.pull_request.merged == true + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + ref: main + - name: Setup Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install .[dev] + - name: Generate coverage report + run: python -m pytest --cov --cov-report=xml + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v5 + with: + fail_ci_if_error: false + token: ${{ secrets.CODECOV_TOKEN }} + slug: Stoops-ML/czml3 + verbose: true diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 855d45d..6bbbde4 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -3,31 +3,6 @@ name: Run checks on: [pull_request] jobs: - codecov-of-main: - name: codecov of main - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - ref: main - - name: Setup Python - uses: actions/setup-python@v4 - with: - python-version: "3.11" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - python -m pip install .[dev] - - name: Generate coverage report - run: python -m pytest --cov --cov-report=xml - - name: Upload coverage to Codecov - uses: codecov/codecov-action@v5 - with: - fail_ci_if_error: false - token: ${{ secrets.CODECOV_TOKEN }} - slug: Stoops-ML/czml3 - verbose: true - tox-checks: runs-on: ubuntu-latest strategy: @@ -48,8 +23,6 @@ jobs: codecov-of-PR: name: codecov of PR - needs: - - codecov-of-main runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 From 7f06a63ed122741860b7f211fb36137bf83ec5d4 Mon Sep 17 00:00:00 2001 From: Daniel Stoops Date: Tue, 17 Dec 2024 12:01:03 +0200 Subject: [PATCH 5/6] Remove ref form codecov-from-main --- .github/workflows/codecov-from-main.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/codecov-from-main.yml b/.github/workflows/codecov-from-main.yml index 61f5cbd..d95899f 100644 --- a/.github/workflows/codecov-from-main.yml +++ b/.github/workflows/codecov-from-main.yml @@ -12,8 +12,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - ref: main - name: Setup Python uses: actions/setup-python@v4 with: From a87157af0f5afad25644c5904ca33e85477e67be Mon Sep 17 00:00:00 2001 From: Daniel Stoops Date: Tue, 17 Dec 2024 12:09:48 +0200 Subject: [PATCH 6/6] codecov-from-main runs from main branch --- .github/workflows/codecov-from-main.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/codecov-from-main.yml b/.github/workflows/codecov-from-main.yml index d95899f..81ab8f3 100644 --- a/.github/workflows/codecov-from-main.yml +++ b/.github/workflows/codecov-from-main.yml @@ -2,13 +2,14 @@ name: Upload codecov from main on: pull_request: - types: - - closed + branches: + - main + types: [closed] jobs: codecov-of-main: name: codecov of main - if: github.event.pull_request.merged == true + if: ${{ github.event.pull_request.merged }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v4