Skip to content

Commit 1c4bca8

Browse files
authored
- Replaced crazy-max with basic first-party script to expose the two variables we require (#16)
- Updated actions to v9 - Formatted with Prettier
1 parent 26a59dd commit 1c4bca8

File tree

1 file changed

+73
-58
lines changed

1 file changed

+73
-58
lines changed

.github/workflows/pants.yaml

Lines changed: 73 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ jobs:
1515
steps:
1616
- name: Noop
1717
run: "true"
18+
1819
build:
1920
name: Perform CI Checks
2021
needs: org-check
@@ -23,65 +24,79 @@ jobs:
2324
matrix:
2425
python-version: [3.8]
2526
steps:
26-
- uses: actions/checkout@v4
27-
- uses: actions/setup-python@v5
28-
with:
29-
python-version: ${{ matrix.python-version }}
30-
- uses: crazy-max/ghaction-setup-docker@v3
31-
with:
32-
daemon-config: |
27+
- uses: actions/checkout@v4
28+
29+
- uses: actions/setup-python@v5
30+
with:
31+
python-version: ${{ matrix.python-version }}
32+
33+
- uses: crazy-max/ghaction-setup-docker@v3
34+
with:
35+
daemon-config: |
3336
{
3437
"features": {
3538
"containerd-snapshotter": true
3639
}
37-
}
38-
- uses: docker/setup-buildx-action@v3
39-
with:
40-
install: true
41-
driver: docker
42-
# Required for multi-platform builds
43-
- name: Setup QEMU
44-
uses: docker/setup-qemu-action@v3
45-
with:
46-
platforms: linux/amd64,linux/arm64
47-
# Exposes Github env vars needed for docker caching - see https://github.com/orgs/community/discussions/42856
48-
- name: Expose GitHub Runtime
49-
uses: crazy-max/ghaction-github-runtime@v3
50-
- uses: pantsbuild/actions/init-pants@v5-scie-pants
51-
# This action bootstraps pants and manages 2-3 GHA caches.
52-
# See: github.com/pantsbuild/actions/tree/main/init-pants/
53-
with:
54-
# v0 makes it easy to bust the cache if needed
55-
# just increase the integer to start with a fresh cache
56-
gha-cache-key: v0
57-
# This repo has no 3rd-party requirements and no lockfiles, so we don't invalidate
58-
# the named caches on anything extra. See other example repos for better examples of
59-
# how to set up this cache.
60-
named-caches-hash: ""
61-
# If you're not using a fine-grained remote caching service (see https://www.pantsbuild.org/docs/remote-caching),
62-
# then you may also want to preserve the local Pants cache (lmdb_store). However this must invalidate for
63-
# changes to any file that can affect the build, so may not be practical in larger repos.
64-
# A remote cache service integrates with Pants's fine-grained invalidation and avoids these problems.
65-
cache-lmdb-store: 'true' # defaults to 'false'
66-
# Note that named_caches and lmdb_store falls back to partial restore keys which
67-
# may give a useful partial result that will save time over completely clean state,
68-
# but will cause the cache entry to grow without bound over time.
69-
# See https://www.pantsbuild.org/2.21/docs/using-pants/using-pants-in-ci for tips on how to periodically clean it up.
70-
# Alternatively you change gha-cache-key to ignore old caches.
71-
- name: Bootstrap Pants
72-
run: pants --version
73-
- name: Check Pants config files
74-
run: pants tailor --check update-build-files --check '::'
75-
- name: Lint, compile, and test
76-
run: pants lint check test '::'
77-
- name: Package / Run
78-
env:
79-
DYNAMIC_TAG: workflow
80-
run: |
81-
pants --docker-build-verbose package ::
82-
- name: Upload Pants log
83-
uses: actions/upload-artifact@v4
84-
with:
85-
name: pants-log
86-
path: .pants.d/pants.log
87-
if: always() # We want the log even on failures.
40+
}
41+
42+
- uses: docker/setup-buildx-action@v3
43+
with:
44+
install: true
45+
driver: docker
46+
47+
# Required for multi-platform builds
48+
- name: Setup QEMU
49+
uses: docker/setup-qemu-action@v3
50+
with:
51+
platforms: linux/amd64,linux/arm64
52+
53+
- name: Set up environment variables for Pants (Docker) to use GHA Cache
54+
uses: actions/github-script@v7
55+
with:
56+
script: |
57+
core.exportVariable("ACTIONS_CACHE_URL", process.env.ACTIONS_CACHE_URL || "");
58+
core.exportVariable("ACTIONS_RUNTIME_TOKEN", process.env.ACTIONS_RUNTIME_TOKEN || "");
59+
60+
- uses: pantsbuild/actions/init-pants@v9
61+
# This action bootstraps pants and manages 2-3 GHA caches.
62+
# See: github.com/pantsbuild/actions/tree/main/init-pants/
63+
with:
64+
# v0 makes it easy to bust the cache if needed
65+
# just increase the integer to start with a fresh cache
66+
gha-cache-key: v0
67+
# This repo has no 3rd-party requirements and no lockfiles, so we don't invalidate
68+
# the named caches on anything extra. See other example repos for better examples of
69+
# how to set up this cache.
70+
named-caches-hash: ""
71+
# If you're not using a fine-grained remote caching service (see https://www.pantsbuild.org/docs/remote-caching),
72+
# then you may also want to preserve the local Pants cache (lmdb_store). However this must invalidate for
73+
# changes to any file that can affect the build, so may not be practical in larger repos.
74+
# A remote cache service integrates with Pants's fine-grained invalidation and avoids these problems.
75+
cache-lmdb-store: "true" # defaults to 'false'
76+
# Note that named_caches and lmdb_store falls back to partial restore keys which
77+
# may give a useful partial result that will save time over completely clean state,
78+
# but will cause the cache entry to grow without bound over time.
79+
# See https://www.pantsbuild.org/2.21/docs/using-pants/using-pants-in-ci for tips on how to periodically clean it up.
80+
# Alternatively you change gha-cache-key to ignore old caches.
81+
82+
- name: Bootstrap Pants
83+
run: pants --version
84+
85+
- name: Check Pants config files
86+
run: pants tailor --check update-build-files --check '::'
87+
88+
- name: Lint, compile, and test
89+
run: pants lint check test '::'
90+
91+
- name: Package / Run
92+
env:
93+
DYNAMIC_TAG: workflow
94+
run: |
95+
pants --docker-build-verbose package ::
96+
97+
- name: Upload Pants log
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: pants-log
101+
path: .pants.d/pants.log
102+
if: always() # We want the log even on failures.

0 commit comments

Comments
 (0)