Skip to content

Commit

Permalink
Use GitHub provided runners without images.
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed May 23, 2024
1 parent 9505ed2 commit 32740f1
Showing 1 changed file with 101 additions and 58 deletions.
159 changes: 101 additions & 58 deletions .github/workflows/unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,88 +5,128 @@ concurrency:
cancel-in-progress: true

on:
# Trigger on pull requests.
pull_request:

# Trigger on pushes to the mainline branches and version tags. This prevents building commits
# twice when the pull request source branch is in the same repository.
push:
branches:
- "trunk-patch"
- "trunk-minor"
- "trunk-major"
- "trunk-*"

# Trigger on request.
workflow_dispatch:

defaults:
run:
shell: bash

jobs:
unit_test_linux:
name: Unit test on Linux [${{ matrix.image }}]
runs-on: ubuntu-latest
container:
image: glotzerlab/ci:2023.10.09-${{ matrix.image }}
options: -u 0
strategy:
matrix:
image: [gcc13_py312,
clang14_py311,
clang13_py310,
clang12_py310,
gcc12_py311,
gcc11_py310,
clang11_py310,
gcc10_py310,
gcc9_py39,
clang10_py38]
env:
UV_VERSION: 0.2.2
CLICOLOR: 1

steps:
- uses: actions/[email protected]
with:
path: code
- name: Configure
run: mkdir -p build && cd build && cmake ../code -GNinja
- name: Build
run: ninja
working-directory: build
- name: Run tests
run: python3 -m pytest --pyargs gsd -p gsd.pytest_plugin_validate --validate -v --log-level=DEBUG
env:
PYTHONPATH: ${{ github.workspace }}/build

unit_test_other:
name: Unit test on ${{ matrix.os }}
jobs:
unit_test:
name: Unit test [py${{ matrix.python }} ${{ matrix.c_compiler }} ${{ matrix.os }}]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-12, macos-14, windows-2019, windows-2022]
include:
##############
# Windows
- os: windows-2019
python: '3.12'
- os: windows-2022
python: '3.12'
##############
# Mac
# macos-x86_64
- os: macos-12
python: '3.12'
# macos-arm64
- os: macos-14
python: '3.12'
##############
# Ubuntu 24.04
- os: ubuntu-24.04
python: '3.9'
c_compiler: gcc-13
cxx_compiler: g++-14
- os: ubuntu-22.04
python: '3.10'
c_compiler: gcc-14
cxx_compiler: g++-14
- os: ubuntu-22.04
python: '3.11'
c_compiler: clang-16
cxx_compiler: clang++-16
- os: ubuntu-22.04
python: '3.12'
c_compiler: clang-17
cxx_compiler: clang++-17
- os: ubuntu-22.04
python: '3.12'
c_compiler: clang-18
cxx_compiler: clang++-18
##############
# Ubuntu 22.04
- os: ubuntu-22.04
python: '3.9'
c_compiler: gcc-11
cxx_compiler: g++-11
- os: ubuntu-22.04
python: '3.10'
c_compiler: gcc-12
cxx_compiler: g++-12
- os: ubuntu-22.04
python: '3.11'
c_compiler: clang-13
cxx_compiler: clang++-13
- os: ubuntu-22.04
python: '3.12'
c_compiler: clang-14
cxx_compiler: clang++-14
- os: ubuntu-22.04
python: '3.12'
c_compiler: clang-15
cxx_compiler: clang++-15
##############
# Ubuntu 20.04
- os: ubuntu-20.04
python: '3.9'
c_compiler: gcc-10
cxx_compiler: g++-10
- os: ubuntu-20.04
python: '3.10'
c_compiler: clang-10
cxx_compiler: clang++-10
- os: ubuntu-20.04
python: '3.11'
c_compiler: clang-11
cxx_compiler: clang++-11
- os: ubuntu-20.04
python: '3.12'
c_compiler: clang-12
cxx_compiler: clang++-12

steps:
- uses: actions/[email protected].4
- uses: actions/[email protected].6
with:
path: code
- name: Set up Python
uses: actions/[email protected]
with:
python-version: '3.11'
- name: Get pip cache dir
id: pip-cache
run: echo dir="$(pip cache dir)" >> "$GITHUB_OUTPUT"
- uses: actions/[email protected]
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: gsd-unit-test-${{ matrix.os }}-pip-${{ hashFiles('code/.github/requirements-test.txt') }}
restore-keys: |
gsd-unit-test-${{ matrix.os }}-pip-
python-version: ${{ matrix.python }}
- name: Install uv
run: curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/${{ env.UV_VERSION }}/uv-installer.sh | bash
- name: Install prereqs
run: python3 -m pip install -r code/.github/requirements-test.txt
run: 'uv pip install -r code/.github/requirements-test.txt --only-binary :all: --system --reinstall'
- name: Set Linux compiler
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
echo "CC=${{ matrix.c_compiler }}" >> "$GITHUB_ENV"
echo "CXX=${{ matrix.cxx_compiler }}" >> "$GITHUB_ENV"
- name: Configure
run: cmake -S code -B build
- name: Build
run: cmake --build build -j 4 --config Release
run: cmake --build build -j 6 --config Release
- if: runner.os == 'Windows'
name: Copy pyd files
run: cp ./gsd/Release/*.pyd gsd/
Expand All @@ -99,8 +139,11 @@ jobs:
# This job is used to provide a single requirement for branch merge conditions.
tests_complete:
name: Unit test
needs: [unit_test_linux, unit_test_other]
if: always()
needs: [unit_test]
runs-on: ubuntu-latest

steps:
- run: echo "Done!"
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
- name: Done
run: exit 0

0 comments on commit 32740f1

Please sign in to comment.