-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (80 loc) · 2.83 KB
/
pants.yml
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
95
# 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: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
# permissions:
# contents: write
# packages: write
env:
PANTS_CONFIG_FILES: pants.ci.toml
strategy:
matrix:
python-version: [3.9]
steps:
- uses: actions/checkout@v4
# Need to use this action to specify containerd, otherwise it won't cache
- uses: crazy-max/ghaction-setup-docker@v3
with:
daemon-config: |
{
"features": {
"containerd-snapshotter": true
}
}
# This seems to be optional - if you're not doing cross-arch compilation of the container content
# - uses: docker/setup-buildx-action@v3
# with:
# install: true
# driver: docker
- name: Set up environment variables for Pants (Docker) to use GHA Cache
uses: actions/github-script@v7
with:
script: |
core.exportVariable("ACTIONS_CACHE_URL", process.env.ACTIONS_CACHE_URL || "");
core.exportVariable("ACTIONS_RUNTIME_TOKEN", process.env.ACTIONS_RUNTIME_TOKEN || "");
- name: Log in to the Github Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: pantsbuild/actions/init-pants@v9
with:
# cache0 makes it easy to bust the cache if needed
gha-cache-key: cache0-py${{ matrix.python_version }}
named-caches-hash: ${{ hashFiles('build-support/lockfiles/*.lock') }}
- name: Emit GH env vars
run: |
echo "Event name: ${{ github.event_name }}"
echo "Base ref: ${{ github.base_ref }}"
echo "Head ref: ${{ github.head_ref }}"
echo "Ref: ${{ github.ref }}"
echo "Ref name: ${{ github.ref_name }}"
echo "Repo: ${{ github.repository }}"
echo "Owner: ${{ github.repository_owner }}"
echo "Actor: ${{ github.actor }}"
echo "Triggering Actor: ${{ github.triggering_actor }}"
- name: Bootstrap Pants
run: |
pants --version
- name: Lint
run: |
pants update-build-files --check lint ::
- name: Package
run: |
pants --docker-build-verbose package ::
# - 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.