Skip to content

ci(BA-573): Set the gh token in the build-scies job #3

ci(BA-573): Set the gh token in the build-scies job

ci(BA-573): Set the gh token in the build-scies job #3

Workflow file for this run

name: build-test
on:
pull_request:
types: [opened, synchronize, reopened]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build-scies:
strategy:
fail-fast: false
matrix:
# ubuntu-22.04: x86-64
# ubuntu-22.04-arm64: aarch64
# macos-14-large: intel
# macos-14-xlarge: apple silicon
os: [ubuntu-22.04, ubuntu-22.04-arm64, macos-14-xlarge, macos-14-large]
runs-on: ${{ matrix.os }}
steps:
- name: Check out the revision
uses: actions/checkout@v4
- name: Fetch remote tags
run: git fetch origin 'refs/tags/*:refs/tags/*' -f
- name: Git LFS Pull
run: git lfs pull
- name: Extract Python version from pants.toml
run: |
PYTHON_VERSION=$(awk -F'["]' '/CPython==/ {print $2; exit}' pants.toml | sed 's/CPython==//')
echo "PANTS_CONFIG_FILES=pants.ci.toml" >> $GITHUB_ENV
echo "PROJECT_PYTHON_VERSION=$PYTHON_VERSION" >> $GITHUB_ENV
- name: Install coreutils for macOS
if: ${{ startsWith(matrix.os, 'macos') }}
run: brew install coreutils
- name: Set up Python as Runtime
uses: actions/setup-python@v5
with:
python-version: ${{ env.PROJECT_PYTHON_VERSION }}
cache: "pip"
- name: Bootstrap Pants
uses: pantsbuild/actions/init-pants@v8
with:
gha-cache-key: pants-cache-main-1-deploy-py${{ env.PROJECT_PYTHON_VERSION }}-${{ runner.os }}-${{ runner.arch }}
named-caches-hash: ${{ hashFiles('python*.lock', 'tools/*.lock') }}
cache-lmdb-store: 'false'
- name: Build both lazy and fat packages
run: |
pants --tag="scie" package '::'
# Rename artifacts to have the platform suffix
platform_suffix="$(python scripts/get-platform-suffix.py)"
for artifact in dist/backendai-*; do
mv "${artifact}" "${artifact}-${platform_suffix}"
done
# Generate checksums. NOTE: 'pants run' does not support parallelization
pants list --filter-tag-regex='checksum' '::' | xargs -n 1 pants run
# Merge checksums into a single file
cat dist/*.sha256 > dist/checksum.txt
sort -u dist/checksum.txt -o dist/checksum.txt
rm dist/*.sha256
- name: Upload scies
uses: actions/upload-artifact@v4
with:
name: scies-${{ matrix.os }}
path: dist/*
- name: Upload pants log
uses: actions/upload-artifact@v4
with:
name: pants-${{ matrix.os }}.build-scies.log
path: .pants.d/workdir/pants.log
if: always() # We want the log even on failures.