setup Pants to make development easier #11
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test index generator | |
on: | |
pull_request: {} | |
push: | |
branches: | |
- main | |
jobs: | |
test-index-generator: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
# Setup Python 3.9.x because the test scrpt uses Python 3.9 currently since the Python interpreter's version must match | |
# the Python version required by Pants version used for the test (or else Pip will fail to install Pants). | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.9' | |
- name: Initialize Pants launcher | |
uses: pantsbuild/actions/init-pants@56efcdb79721bc7726edf542e324468033e4e21c | |
with: | |
# cache0 makes it easy to bust the cache if needed | |
gha-cache-key: cache0-py3.9 | |
named-caches-hash: ${{ hashFiles('3rdparty/python/default.lock') }} | |
- name: Lint and typechecks | |
run: "pants lint check ::" | |
- name: Run tests | |
run: "pants test ::" | |
env: | |
GH_TOKEN: ${{ github.token }} | |
- name: Generate output | |
run: | | |
mkdir -p dist/output | |
pants run :generate_index -- --url-path-prefix=/simple dist/output/public/simple | |
# Store the generated HTML as an artifact for later inspection. | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: generated-output | |
path: dist/output/public/ | |
if-no-files-found: error |