Skip to content

Commit

Permalink
chore(ci): split off coverage workflow (#1944)
Browse files Browse the repository at this point in the history
In #1936 we observed that
because we are using `pull_request_target` without a specific reference,
we are not in fact checking out the PR branch. This PR splits the
workflow into two, one only to run badger CI tests, and the other to run
tests & report coverage results (using pr_target with the appropriate
commit). This has the benefit that any issues with coverage are isolated
to one workflow, which we could disable later if problems arise. This
does create duplication of compute (all tests run x2) but we are using
github hosted runners so we do not pay for this cost. This also aligns
with our dgraph repo workflow setup.
  • Loading branch information
joshua-goldstein authored May 8, 2023
1 parent 9afd0a0 commit 2c431a9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/ci-badger-tests-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: ci-badger-tests-coverage
on:
pull_request_target:
branches:
- main
- 'release/v*'
jobs:
badger-tests-coverage:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3 # checkout merge commit
with:
ref: "refs/pull/${{ github.event.number }}/merge"
- name: Get Go Version
run: |
#!/bin/bash
GOVERSION=$({ [ -f .go-version ] && cat .go-version; })
echo "GOVERSION=$GOVERSION" >> $GITHUB_ENV
- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ env.GOVERSION }}
- name: Install Dependencies
run: make dependency
- name: Run Badger Tests
run: make test
- name: Install Goveralls
run: go install github.com/mattn/goveralls@latest
- name: Send Coverage Results
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLSIO_TOKEN }}
run: goveralls -coverprofile=cover.out
8 changes: 1 addition & 7 deletions .github/workflows/ci-badger-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
branches:
- main
- 'release/v*'
pull_request_target:
pull_request:
branches:
- main
- 'release/v*'
Expand All @@ -28,9 +28,3 @@ jobs:
run: make dependency
- name: Run Badger Tests
run: make test
- name: Install Goveralls
run: go install github.com/mattn/goveralls@latest
- name: Send Coverage Results
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLSIO_TOKEN }}
run: goveralls -coverprofile=cover.out

0 comments on commit 2c431a9

Please sign in to comment.