Skip to content

Commit 678b0c4

Browse files
author
Tom Dyas
authored
add CI workflow for GitHub Actions (#2)
Add a CI workflow to test the code in this repository using GitHub Actions.
1 parent 41f9282 commit 678b0c4

2 files changed

Lines changed: 69 additions & 0 deletions

File tree

.github/workflows/pants.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Copyright 2022 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:
9+
push:
10+
branches: [ main ]
11+
pull_request:
12+
branches: [ main ]
13+
14+
jobs:
15+
org-check:
16+
name: Check GitHub Organization
17+
if: ${{ github.repository_owner == 'pantsbuild' }}
18+
runs-on: ubuntu-20.04
19+
steps:
20+
- name: Noop
21+
run: "true"
22+
build:
23+
name: Perform CI Checks
24+
needs: org-check
25+
env:
26+
PANTS_CONFIG_FILES: pants.ci.toml
27+
runs-on: ubuntu-latest
28+
strategy:
29+
matrix:
30+
python-version: [3.7]
31+
steps:
32+
- uses: actions/checkout@v2
33+
- uses: actions/cache@v2
34+
id: cache
35+
with:
36+
path: |
37+
~/.cache/pants/setup
38+
~/.cache/pants/lmdb_store
39+
~/.cache/pants/named_caches
40+
key: ${{ runner.os }}-
41+
- name: Setup Python ${{ matrix.python-version }}
42+
uses: actions/setup-python@v1
43+
with:
44+
python-version: ${{ matrix.python-version }}
45+
- name: Bootstrap Pants
46+
run: |
47+
./pants --version
48+
- name: Check BUILD files
49+
run: ./pants tailor --check update-build-files --check
50+
- name: Test
51+
run: |
52+
./pants test ::
53+
- name: Upload pants log
54+
uses: actions/upload-artifact@v2
55+
with:
56+
name: pants-log
57+
path: .pants.d/pants.log
58+
if: always() # We want the log even on failures.

pants.ci.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright 2022 Pants project contributors.
2+
# Licensed under the Apache License, Version 2.0 (see LICENSE).
3+
4+
# See https://www.pantsbuild.org/docs/using-pants-in-ci.
5+
6+
[GLOBAL]
7+
dynamic_ui = false
8+
colors = true
9+
10+
[pytest]
11+
args = ["-vv", "--no-header"]

0 commit comments

Comments
 (0)