pants ci: add integration tests jobs #1707
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
--- | |
# This Lint workflow uses pants | |
name: Lint | |
on: | |
push: | |
branches: | |
# only on merges to master branch | |
- master | |
# and version branches, which only include minor versions (eg: v3.4) | |
- v[0-9]+.[0-9]+ | |
tags: | |
# also version tags, which include bugfix releases (eg: v3.4.0) | |
- v[0-9]+.[0-9]+.[0-9]+ | |
pull_request: | |
type: [opened, reopened, edited] | |
branches: | |
# Only for PRs targeting those branches | |
- master | |
- v[0-9]+.[0-9]+ | |
#schedule: | |
# # run every night at midnight | |
# - cron: '0 0 * * *' | |
jobs: | |
# Lint checks which don't depend on any service containes, etc. to be running. | |
lint-checks: | |
name: 'Lint Checks (pants runs: shellcheck, bandit, black, flake8, pylint)' | |
runs-on: ubuntu-20.04 | |
env: | |
COLUMNS: '120' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
# a test uses a submodule, and pants needs access to it to calculate deps. | |
submodules: 'true' | |
- name: Cache and Install APT Dependencies | |
uses: ./.github/actions/apt-packages | |
- name: Initialize Pants and its GHA caches | |
uses: ./.github/actions/init-pants | |
with: | |
# To ignore a bad cache, bump the cache* integer. | |
gha-cache-key: cache0 | |
- name: Lint | |
run: | | |
pants lint :: | |
- name: Upload pants log | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pants-log-py${{ matrix.python-version }} | |
path: .pants.d/pants.log | |
if: always() # We want the log even on failures. | |
set_merge_ok: | |
name: Set Merge OK (Lint) | |
if: always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') | |
needs: | |
- lint-checks | |
outputs: | |
merge_ok: ${{ steps.set_merge_ok.outputs.merge_ok }} | |
runs-on: ubuntu-latest | |
steps: | |
- id: set_merge_ok | |
run: echo 'merge_ok=true' >> ${GITHUB_OUTPUT} | |
merge_ok: | |
name: Merge OK (Lint) | |
if: always() | |
needs: | |
- set_merge_ok | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
merge_ok="${{ needs.set_merge_ok.outputs.merge_ok }}" | |
if [[ "${merge_ok}" == "true" ]]; then | |
echo "Merge OK" | |
exit 0 | |
else | |
echo "Merge NOT OK" | |
exit 1 | |
fi |