Skip to content

Commit

Permalink
minor fixes to caching
Browse files Browse the repository at this point in the history
  • Loading branch information
cpelley committed Jul 2, 2024
1 parent 3548ed5 commit 16001a6
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: Pull Request Tests

on: [pull_request]

env:
# ${{ github.base_ref }}: base branch of the pull request (e.g. master/main).
# ${{ github.head_ref }}: branch the pull request targets (e.g. feature branch).
TARGET_REF: ${{ github.base_ref }}

jobs:
test:
if: "!contains(github.event.head_commit.message, '[skip ci]')"
env:
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || '' }}
HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -55,18 +55,20 @@ jobs:
uses: actions/cache@v4
with:
path: ref/coverage_output.txt
key: ref-${{ env.TARGET_REF }}
key: ref-${{ env.BASE_SHA }}

- name: Checkout ref branch
if: steps.cache-ref-coverage.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
path: ref
ref: ${{ env.TARGET_REF }}
ref: ${{ github.base_ref }}

- name: Run tests with coverage for ref branch
if: steps.cache-ref-coverage.outputs.cache-hit != 'true'
run: cd ref; pytest --cov=dagrunner --cov-report=term | tee coverage_output.txt
run: |
cd ref
pytest --cov=dagrunner --cov-report=term | tee coverage_output.txt
# TESTS (compare coverage)
- name: Compare coverage
Expand Down

0 comments on commit 16001a6

Please sign in to comment.