I can't figure out why the github action is contin...
# general
h
I can't figure out why the github action is continuously failing. • Pant v2.12 • This action is run by a colleague in the team. • the workflow file:
Copy code
name: ci

on:
  pull_request:
    branches:
    - develop

concurrency:
  group: ci-${{ github.head_ref }}
  cancel-in-progress: true

jobs:
  build:
    name: Perform CI Checks
    env:
      PANTS_CONFIG_FILES: pants.ci.toml
    runs-on: ubuntu-latest
    strategy:
      matrix:
        python-version: [3.9]
    steps:
    - name: Get the latest code 
      uses: actions/checkout@v3 # checkout latest commit 
    - name: Cache the artefacts
      uses: actions/cache@v3 # cache the pants, test results, pex binaries
      id: cache
      with:
        path: |
          ~/.cache/pants/setup
          ~/.cache/pants/lmdb_store
          ~/.cache/pants/named_caches
        key: ${{ runner.os }}-
    - name: Setup Python ${{ matrix.python-version }}
      uses: actions/setup-python@v4
      with:
        python-version: ${{ matrix.python-version }}
    - name: Bootstrap Pants
      run: |
        ./pants --version
    
    - name: Check BUILD files
      run: ./pants tailor --check update-build-files --check
    - name: Lint and typecheck all targets
      run: |
        ./pants fmt lint ::
    - name: Test all targets
      run: |
        ./pants test ::
    - name: Upload pants log
      uses: actions/upload-artifact@v3
      with:
        name: pants-log
        path: .pants.d/pants.log
      if: always()  # We want the log even on failures.
p
A couple of things you can try: Make sure you have the latest pants bootstrap script checked in your repo: https://github.com/pantsbuild/setup/blob/gh-pages/pants Enable debug mode for that script by changing this line https://github.com/pantsbuild/setup/blob/gh-pages/pants#L13 to be
set -eoxu pipefail
also as a side note, it is recommended to use the pants version is a cache key so
~/.cache/pants/setup
will get wiped when you upgrade pants. see: https://github.com/toolchainlabs/remote-api-tools/blob/main/.github/workflows/build.yaml#L24 as an example.
h
Thanks, it worked after upgrading the script and the pants version as well. And point taken for updating the cache key as well. šŸ™‚
šŸ‘ 1
b
I think this will be the same problem as https://github.com/pantsbuild/actions/issues/5, where the setup cache contains an invalid symlink due to the Python minor version being changed behind the scenes.