feat(arcor2_build): cross imports #1040
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
# inspired by https://github.com/pantsbuild/example-python/blob/main/.github/workflows/pants.yaml | |
# also see https://stackoverflow.com/a/66632107/3142796 | |
name: Pants | |
on: | |
pull_request: | |
branches: | |
- master | |
jobs: | |
org-check: | |
name: Check GitHub Organization | |
if: ${{ github.repository_owner == 'robofit' }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Noop | |
run: "true" | |
build: | |
env: | |
PANTS_CONFIG_FILES: pants.ci.toml | |
runs-on: ubuntu-20.04 | |
needs: org-check | |
strategy: | |
matrix: | |
python-version: ['3.10'] | |
steps: | |
- name: Maximize build space | |
uses: easimon/maximize-build-space@v10 | |
with: | |
root-reserve-mb: 35000 | |
swap-size-mb: 1024 | |
remove-dotnet: 'true' | |
remove-android: 'true' | |
remove-haskell: 'true' | |
remove-docker-images: 'true' | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
lfs: true | |
- name: Checkout LFS objects | |
run: git lfs checkout | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: pantsbuild/actions/init-pants@v2 | |
with: | |
pants-python-version: ${{ matrix.python-version }} | |
gha-cache-key: cache0-py${{ matrix.python-version }} | |
named-caches-hash: ${{ hashFiles('/3rdparty/constraints.txt') }} | |
cache-lmdb-store: 'true' # defaults to 'false' | |
base-branch: master | |
- name: Check BUILD files | |
run: | | |
./pants --changed-since=HEAD update-build-files --check | |
- name: install system dependencies | |
run: | | |
sudo ./build-support/install_kinect_prerequisites.sh | |
sudo apt install jq | |
- name: Lint | |
run: | | |
./pants --changed-since=origin/master lint | |
- name: Typecheck | |
run: | | |
./pants check --changed-since=origin/master --changed-dependees=transitive | |
- name: Test | |
run: | | |
./pants --changed-since=origin/master --changed-dependees=transitive test | |
- name: Build Docker images | |
run: | # filter out non-essential docker images (there was a problem with full storage on github) | |
./pants filter --target-type=docker_image --changed-since=origin/master --changed-dependees=transitive | grep -v arcor2_3d_mouse | grep -v arcor2_kinect_azure | grep -v arcor2_fanuc arcor2_fanuc_upload_object_types | xargs ./pants package | |
- name: Build Python packages | |
run: | | |
./pants filter --target-type=python_distribution :: | xargs ./pants package | |
# check for cyclic dependencies or other problems | |
python -m venv ./tstvenv | |
source ./tstvenv/bin/activate | |
pip install dist/*.tar.gz | |
pip install pipdeptree | |
pipdeptree -w fail | |
- name: Upload pants log | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pants-log | |
path: .pants.d/pants.log | |
if: always() # We want the log even on failures. | |
- name: Prune pants cache | |
run: | | |
./build-support/nuke-cache.sh | |
if: always() |