important-insurance-68329
09/10/2024, 2:30 PMinit-pants
action for github, but for some reason I cannot identify it is not running tests as I intend it to.
I have two branches branch-a
and branch-b
so when I run locally from branch-b
the command pants --changed-since=origin/branch-a --changed-dependents=transitive test
it only runs tests that are dependent om my changes, this is awesome.
But when I try the same using the github action, it just run the tests but it seems it is just picking all from cache, for instance, tests should fail, but they don't.
Here is what my github workflow looks like:
jobs:
build:
name: Perform CI Checks
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.12]
steps:
- uses: actions/checkout@v4
with:
ref: branch-a
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: pantsbuild/actions/init-pants@v8
with:
base-branch: branch-a
gha-cache-key: v0
named-caches-hash: ${{ hashFiles('project_1.lock', 'project_2.lock') }}
cache-lmdb-store: 'true'
- name: Test
run: |
pants --changed-since=origin/branch-a --changed-dependents=transitive test
Any ideas on what am I doing wrong?important-insurance-68329
09/10/2024, 3:51 PM- uses: actions/checkout@v4
with:
ref: branch-a
I checked out branch-a
and pants was now comparing branch-a
to branch-a
🤦
Changed it to the regular checkout for branch-b
and added an additional step to fetch branch-a
- name: Fetch base branch
run: git fetch origin using-pants --unshallow
This fixed it for me and looks less expensive than using a checkout with fetch-depth of zero.broad-processor-92400
09/11/2024, 3:14 AM