Re the above, please try `v4-scie-pants` (or whate...
# general
h
Re the above, please try
v4-scie-pants
(or whatever the latest tag is there...)
m
@happy-kitchen-89482 I'm not entirely sure this tag is working. The
pantsbuild/actions/init-pants@v4-scie-pants
action sometimes gets stuck when setting up pants (I think when reading back the cache) and then the CI pipeline doesn't terminate. I'm not entirely sure where this issue could be coming from or if it's something related to our
pants.toml
, but I have been trying to get this to work for a couple hours now and I'm not getting anywhere. Here's what I have:
pants.toml
Copy code
[GLOBAL]
pants_version = "2.15.0rc4"

backend_packages = [
  "pants.backend.python",
  "pants.backend.python.lint.autoflake",
  "pants.backend.python.lint.black",
  "pants.backend.python.lint.flake8",
  "pants.backend.python.lint.isort",
  "pants.backend.python.typecheck.mypy",
  "pants.backend.docker",
  "pants.backend.docker.lint.hadolint",
]

[source]
root_patterns = [
  "/python/packages/*/src",
  "/python/packages/*/tests",
  "/python/services/*/src",
  "/python/services/*/tests",
]

[docker]
build_args = [
  "PYTHON_VERSION=3.10-slim-bullseye",
  "GIT_COMMIT",
]

[python]
interpreter_constraints = ["CPython==3.10.*"]
tailor_pex_binary_targets = false

[subprocess-environment]
env_vars = [
  "DATABASE_URL=<postgresql://bla>",
  "DJANGO_SECRET_KEY=abc",
]

[flake8]
args = [
  "--ignore E501,W503",
]

[mypy]
version = "mypy==0.991"
config = "python/mypy.ini"
args = [
  "--show-error-codes",
  "--explicit-package-bases",
]
lockfile = "python/lockfiles/mypy.lock"
extra_requirements.add = [
  # "mypy-extensions==0.4.3",
  "django-stubs==1.14.0",
  "django-environ",
  "pydantic",
  "psycopg2-binary",
  "tenacity==8.0.1",
  "requests",
  "types-requests==2.28.11.5",
]
extra_type_stubs = ["django-stubs==1.14.0"]
extra_type_stubs_lockfile = "python/lockfiles/mypy_extra_type_stubs.lock"

[pytest]
version = "pytest==7.2.1"
lockfile = "python/lockfiles/pytest.lock"
extra_requirements.add = [
  # "pytest-cov==4.0.0",
  "pytest-django==4.5.2",
  "pytest-env==0.8.1",
  "six",
]

[anonymous-telemetry]
enabled = false
pants.ci.toml
Copy code
[GLOBAL]
dynamic_ui = false
colors = true

# Set to `true` if you have a Pants remote cache provider available for CI builds
remote_cache_read = false
remote_cache_write = false

[pytest]
args = ["-vv", "--no-header"]
.github/workflows/ci.yml
Copy code
name: Validate

on:
  push:
  workflow_dispatch:

jobs:
  validate:
    name: Validate
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout repository
        uses: actions/checkout@v3.2.0
      -
        name: Setup Pants
        uses: pantsbuild/actions/init-pants@v4-scie-pants
        with:
          base-branch: 'develop'
          gha-cache-key: cache4-py3.10
          #named-caches-hash: ${{ hashFiles('python-default.lock') }}
          cache-lmdb-store: 'true'  # defaults to 'false'
      -
        name: Check BUILD files
        run: |
          export PATH="/home/runner/bin:$PATH"
          pants tailor --check update-build-files --check ::
      -
        name: Lint and typecheck
        run: | 
          export PATH="/home/runner/bin:$PATH"
          pants lint check ::
      -
        name: Test
        run: |
          export PATH="/home/runner/bin:$PATH"
          pants test ::
      -
        name: Login to Docker Hub
        uses: docker/login-action@v2
        with:
          registry: <http://riskquest.azurecr.io|riskquest.azurecr.io>
          username: ${{ secrets.AZURE_CLIENT_ID }}
          password: ${{ secrets.AZURE_CLIENT_SECRET }}
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
        with:
          driver: "docker"
          install: true
      -
        name: Setup Pants
        uses: pantsbuild/actions/init-pants@v4-scie-pants
        with:
          base-branch: 'develop'
          gha-cache-key: cache4-py3.10
          named-caches-hash: ${{ hashFiles('python-default.lock') }}
          cache-lmdb-store: 'true'
      -
        name: Build
        run: |
          export PATH="/home/runner/bin:$PATH"
          export TAG=$(git rev-parse --short HEAD)
          GIT_COMMIT=$TAG pants package ::
      -
        name: Upload to Azure Container Registry
        run: |
          export TAG=$(git rev-parse --short HEAD)
          docker push <REDACTED>
h
Yep, sorry about that, known bug in 2.15.0rc4 that is fixed in https://github.com/pantsbuild/pants/pull/18216, and we'll cut a new rc today!
Well, known bug as of yesterday
m
Perfect, thanks for your quick reply! Iā€™m looking forward to the new rc!
Thanks for all your work!
šŸ™ 1