Skip to content

Commit

Permalink
ci: try to re-use pants_init and split out typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
EspenAlbert committed Aug 22, 2023
1 parent c095b65 commit 5f1ce0e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 31 deletions.
16 changes: 16 additions & 0 deletions .github/templates/pants_init/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: pants_init

runs:
using: composite
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_PAT }}
- name: Initialize Pants
uses: pantsbuild/actions/init-pants@main
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
# cache0 makes it easy to bust the cache if needed
gha-cache-key: cache0-py-3-10
named-caches-hash: ${{ hashFiles('3rdparty/*.txt') }}
22 changes: 2 additions & 20 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,14 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_PAT }}
- name: pants_init
uses: "../templates/pants_init"
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Initialize Pants
uses: pantsbuild/actions/init-pants@main
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
# cache0 makes it easy to bust the cache if needed
gha-cache-key: cache0-py-3-10
named-caches-hash: ${{ hashFiles('3rdparty/*.txt') }}
- name: Check BUILD files
run: "pants tailor --check update-build-files --check ::"
- name: Lint
Expand All @@ -39,17 +30,8 @@ jobs:
- name: Package
if: success() || failure()
run: "pants --tag='-arm' package ::"
- name: mypy
if: success() || failure()
run: "pants --tag='-arm' check ::"
- name: Upload coverage
uses: codecov/codecov-action@v3
if: success() || failure()
with:
files: ./dist/coverage/python/coverage.xml
- name: Upload pants log
uses: actions/upload-artifact@v3
with:
name: pants-log
path: .pants.d/pants.log
if: always() # We want the log even on failures & cancelling
13 changes: 2 additions & 11 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,8 @@ jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.GH_PAT }}
- name: Initialize Pants
uses: pantsbuild/actions/init-pants@main
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
with:
# cache0 makes it easy to bust the cache if needed
gha-cache-key: cache0-py-3-10
named-caches-hash: ${{ hashFiles('3rdparty/*.txt') }}
- name: pants_init
uses: "../templates/pants_init"
- name: publish_to_pypi
env:
PANTS_TWINE_ARGS: "['-p ${{ secrets.TWINE_PASSWORD }}', '-u __token__']"
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/typecheck.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: CI - Typecheck

on:
push:
branches:
- "**"
jobs:
typecheck:
runs-on: ubuntu-latest
steps:
- name: pants_init
uses: "../templates/pants_init"
- name: mypy
run: "pants --tag='-arm' check ::"

0 comments on commit 5f1ce0e

Please sign in to comment.