update ubuntu installation script 2 #151
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 | |
on: | |
push: | |
branches: [ main, master ] | |
pull_request: | |
branches: [ main, master ] | |
concurrency: | |
group: test-${{ github.head_ref }} | |
cancel-in-progress: true | |
env: | |
STABLE_PYTHON_VERSION: '3.13' | |
PYTHONUNBUFFERED: "1" | |
FORCE_COLOR: "1" | |
jobs: | |
run: | |
name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest, macos-latest ] | |
python-version: [ '3.13' ] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Ensure latest pip | |
run: python -m pip install --upgrade pip | |
- name: Install system dependencies (macOS) | |
if: runner.os == 'macOS' | |
run: brew install apache-arrow | |
shell: bash | |
- name: Install system dependencies (Ubuntu) | |
if: runner.os == 'Linux' | |
run: ./.github/scripts/setup_ubuntu.sh | |
shell: bash | |
- name: Install Hatch | |
run: | | |
pip install --upgrade hatch | |
hatch config set dirs.env.virtual ".hatch" | |
- name: Cache Hatch environments | |
uses: actions/cache@v3 | |
with: | |
path: .hatch | |
key: hatch-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('pyproject.toml') }} | |
- name: Create Hatch environments | |
run: hatch env create | |
- if: runner.os == 'macOS' | |
run: echo "MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion)" >> $GITHUB_ENV | |
- name: Run static analysis | |
run: hatch fmt --preview --check | |
- name: Run type checking | |
run: hatch run types:check | |
- name: Run tests | |
run: hatch test --python ${{ matrix.python-version }} --cover --randomize --parallel --retries 2 --retry-delay 1 | |
- name: Disambiguate coverage filename | |
run: mv .coverage ".coverage.${{ matrix.os }}.${{ matrix.python-version }}" | |
- name: Upload coverage data | |
uses: actions/upload-artifact@v3 | |
with: | |
name: coverage-data | |
path: .coverage.* | |
coverage: | |
name: Report coverage | |
runs-on: ubuntu-latest | |
needs: | |
- run | |
if: github.event_name == 'pull_request' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ env.STABLE_PYTHON_VERSION }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ env.STABLE_PYTHON_VERSION }} | |
- name: Ensure latest pip | |
run: python -m pip install --upgrade pip | |
- name: Install Hatch | |
run: pip install --upgrade hatch | |
- name: Install Coverage | |
run: pip install --upgrade coverage | |
- name: Download coverage data | |
uses: actions/download-artifact@v3 | |
with: | |
name: coverage-data | |
- name: Combine coverage data | |
run: coverage combine | |
- name: Generate XML coverage report | |
run: coverage xml coverage.xml | |
- name: Report coverage | |
uses: orgoro/[email protected] | |
with: | |
coverageFile: coverage.xml | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# https://github.com/marketplace/actions/alls-green#why | |
check: # This job does nothing and is only used for the branch protection | |
name: "Check all green" | |
if: always() | |
needs: | |
- run | |
- coverage | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} | |
allowed-skips: coverage |