Skip to content

Commit 03c99e2

Browse files
Merge pull request #1 from pantsbuild/AlexTereshenkov-add-GH-actions
Adding GitHub Actions
2 parents cba6723 + 0f2b943 commit 03c99e2

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/pants.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright 2023 Pants project contributors.
2+
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3+
4+
# See https://pants.readme.io/docs/using-pants-in-ci for tips on how to set up your CI with Pants.
5+
6+
name: Pants
7+
8+
on: [push, pull_request]
9+
10+
jobs:
11+
org-check:
12+
name: Check GitHub Organization
13+
if: ${{ github.repository_owner == 'pantsbuild' }}
14+
runs-on: ubuntu-20.04
15+
steps:
16+
- name: Noop
17+
run: "true"
18+
build:
19+
name: Perform CI Checks
20+
needs: org-check
21+
runs-on: ubuntu-20.04
22+
strategy:
23+
matrix:
24+
python-version: [3.9]
25+
steps:
26+
- uses: actions/checkout@v3
27+
- uses: actions/setup-python@v4
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
- uses: pantsbuild/actions/init-pants@v5-scie-pants
31+
# This action bootstraps pants and manages 2-3 GHA caches.
32+
# See: github.com/pantsbuild/actions/tree/main/init-pants/
33+
with:
34+
# v0 makes it easy to bust the cache if needed
35+
# just increase the integer to start with a fresh cache
36+
gha-cache-key: v0
37+
# The Python backend uses named_caches for Pip/PEX state,
38+
# so it is appropriate to invalidate on lockfile changes.
39+
named-caches-hash: ${{ hashFiles('python-default.lock') }}
40+
# If you're not using a fine-grained remote caching service (see https://www.pantsbuild.org/docs/remote-caching),
41+
# then you may also want to preserve the local Pants cache (lmdb_store). However this must invalidate for
42+
# changes to any file that can affect the build, so may not be practical in larger repos.
43+
# A remote cache service integrates with Pants's fine-grained invalidation and avoids these problems.
44+
cache-lmdb-store: 'true' # defaults to 'false'
45+
# Note that named_caches and lmdb_store falls back to partial restore keys which
46+
# may give a useful partial result that will save time over completely clean state,
47+
# but will cause the cache entry to grow without bound over time.
48+
# See https://pants.readme.io/docs/using-pants-in-ci for tips on how to periodically clean it up.
49+
# Alternatively you change gha-cache-key to ignore old caches.
50+
- name: List all build targets
51+
run: |
52+
pants list ::
53+
- name: Upload pants log
54+
uses: actions/upload-artifact@v3
55+
with:
56+
name: pants-log
57+
path: .pants.d/pants.log
58+
if: always() # We want the log even on failures.

0 commit comments

Comments
 (0)