-
Notifications
You must be signed in to change notification settings - Fork 0
94 lines (90 loc) · 3.62 KB
/
pants.yaml
File metadata and controls
94 lines (90 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# Copyright 2020 Pants project contributors.
# Licensed under the Apache License, Version 2.0 (see LICENSE).
# See https://pants.readme.io/docs/using-pants-in-ci for tips on how to set up your CI with Pants.
name: Pants
on: [push, pull_request]
jobs:
org-check:
name: Check GitHub Organization
if: ${{ github.repository_owner == 'pantsbuild' }}
runs-on: ubuntu-20.04
steps:
- name: Noop
run: "true"
build:
name: Perform CI Checks
needs: org-check
env:
PANTS_CONFIG_FILES: pants.ci.toml
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
steps:
- uses: actions/checkout@v2
- name: Get Pants version
id: pants_version
run: |
# Capture the "pants_version = " line from config.
PANTS_VERSION=$(grep -E '^pants_version\s*=' pants.toml)
echo "::set-output name=pants_version::$PANTS_VERSION"
- uses: actions/cache@v2
id: cache_pants_setup
with:
path: |
~/.cache/pants/setup
key: pants-setup-${{ steps.pants_version.outputs.pants_version }}
- uses: actions/cache@v2
id: cached_named_caches
with:
path: |
~/.cache/pants/named_caches
# The Python backend uses named_caches for Pip/PEX state,
# so it is appropriate to invalidate on requirements.txt changes.
key: pants-named-caches-${{ runner.os }}-${{ hashFiles('pants.toml') }}-${{ hashFiles('requirements.txt') }}
# Note that falling back to a restore key may give a useful partial result that will save time
# over completely clean state, but will cause the cache entry to grow without bound over time.
# See https://pants.readme.io/docs/using-pants-in-ci for tips on how to periodically clean it up.
# Alternatively you may want to avoid using restore keys.
restore-keys: |
pants-named-caches-${{ runner.os }}-${{ hashFiles('pants.toml') }}-${{ hashFiles('requirements.txt') }}
pants-named-caches-${{ runner.os }}-${{ hashFiles('pants.toml') }}-
pants-named-caches-${{ runner.os }}-
# If you're not using a fine-grained remote caching service (see https://www.pantsbuild.org/docs/remote-caching),
# then you may also want to preserve the local Pants cache (lmdb_store). However this must invalidate for
# changes to any file that can affect the build, so may not be practical in larger repos.
# A remote cache service integrates with Pants's fine-grained invalidation and avoids these problems.
- uses: actions/cache@v2
id: cache_lmdb_store
with:
path: |
~/.cache/pants/lmdb_store
key: pants-lmdb-store-${{ runner.os }}-${{ hashFiles('**/*') }}
# Same caveat as above regarding the issues with restore keys.
restore-keys: pants-lmdb-store-${{ runner.os }}-
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
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
run: |
./pants lint check ::
- name: Test
run: |
./pants test ::
- name: Package / Run
run: |
# We also smoke test that our release process will work by running `package`.
./pants package ::
./pants run helloworld/main.py
- name: Upload pants log
uses: actions/upload-artifact@v2
with:
name: pants-log
path: .pants.d/pants.log
if: always() # We want the log even on failures.