Skip to content

Build a draft release and then publish once complete #853

Build a draft release and then publish once complete

Build a draft release and then publish once complete #853

Workflow file for this run

name: CI
on:
push:
# Ignore non top-level branches.
branches-ignore:
- '*/**'
pull_request:
defaults:
run:
shell: bash
concurrency:
group: CI-${{ github.ref }}
# Queue on all branches and tags, but only cancel overlapping PR burns.
cancel-in-progress: ${{ github.ref != 'refs/heads/main' || !startsWith(github.ref, 'refs/tags/') }}
env:
CARGO_TERM_COLOR: always
jobs:
org-check:
name: Check GitHub Organization
if: github.repository_owner == 'pantsbuild'
runs-on: ubuntu-22.04
steps:
- name: Noop
run: "true"
ci:
name: (${{ matrix.name }}) CI
needs: org-check
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-22.04
name: ubuntu-22.04
- os: [runs-on, runner=4cpu-linux-arm64, image=ubuntu22-full-arm64-python3.7-3.13, "run-id=${{ github.run_id }}"]
name: linux-arm64
- os: macOS-10.15-X64
name: macOS-10.15-X64
- os: macOS-11-ARM64
name: macOS-11-ARM64
- os: windows-2022
name: windows-2022
env:
PY: python3.9
SCIE_PANTS_DEV_CACHE: .scie_pants_dev_cache
steps:
- uses: actions/checkout@v3
- name: Check Formatting
run: |
rustup toolchain add nightly -c rustfmt
cargo +nightly fmt --check --all
- name: Lint
run: cargo clippy --locked --all
- name: Unit Tests
run: cargo test --all
- name: Setup Python 3.9 (Ubuntu only)
if: ${{ matrix.os == 'ubuntu-22.04' }}
uses: actions/setup-python@v4
with:
# N.B.: We need Python 3.9 for running Pants goals against our tools.pex Python tools
# codebase as well as running Pants from sources in ITs.
python-version: "3.9"
- name: Compute cache key
id: build_it_cache_key
run: |
# The caches include venvs which have absolute links to Python binaries, so our system
# should be resilient to this (see `test_pants_source_mode` in `test.rs`).
echo "cache_key=${{ matrix.os }}-scie-pants-v7-$(which python)" | tee -a "$GITHUB_OUTPUT"
- name: Cache Build and IT Artifacts
uses: actions/cache@v3
with:
path: ${{ env.SCIE_PANTS_DEV_CACHE }}
key: ${{ steps.build_it_cache_key.outputs.cache_key }}
# required for the PANTS_SOURCE tests, which build a version of Pants that requires an external protoc
- name: Install Protoc
uses: arduino/setup-protoc@9b1ee5b22b0a3f1feb8c2ff99b32c89b3c3191e9
if: ${{ matrix.os == 'macOS-10.15-X64' || matrix.os == 'macOS-11-ARM64' || matrix.os == 'ubuntu-22.04' || matrix.name == 'linux-arm64' }}
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 23.x
- name: Build, Package & Integration Tests (MacOS)
if: ${{ matrix.os == 'macOS-10.15-X64' || matrix.os == 'macOS-11-ARM64'}}
run: |
# TODO(John Sirois): Kill --tools-pex-mismatch-warn:
# https://github.com/pantsbuild/scie-pants/issues/2
#
# N.B.: Our self-hosted runners do not clean the work directory between runs like the
# GitHub hosted runners do; as such, the ~/.cache/pants, etc sticks around. This exposes
# a bug in Pants / Pex reproducibility when building PEXes where the
# PEX_ROOT/installed_wheels that get packaged up into a PEX may (or may not) contain
# bytecode if the particular wheel was ever run against in the past. This leads to varying
# final PEX content.
#
PANTS_BOOTSTRAP_GITHUB_API_BEARER_TOKEN=${{ secrets.GITHUB_TOKEN }} \
cargo run -p package -- test --check --tools-pex-mismatch-warn
- name: Build, Package & Integration Tests (Ubuntu)
if: ${{ matrix.os == 'ubuntu-22.04' || matrix.name == 'linux-arm64' }}
run: |
cargo run -p package -- --dest-dir dist/ tools
docker run --rm \
-v $PWD:/code \
-w /code \
rust:1.76.0-alpine3.19 \
sh -c '
apk add cmake make musl-dev perl && \
cargo run -p package -- --dest-dir dist/ scie-pants
'
echo
echo "Running under: $(uname -a)"
echo
PANTS_BOOTSTRAP_GITHUB_API_BEARER_TOKEN=${{ secrets.GITHUB_TOKEN }} \
cargo run -p package -- test \
--tools-pex dist/tools.pex --scie-pants dist/scie-pants \
--check \
--tools-pex-mismatch-warn