Skip to content

Commit

Permalink
Merge branch 'refactor-ci' into trunk-minor
Browse files Browse the repository at this point in the history
  • Loading branch information
joaander committed May 28, 2024
2 parents 9505ed2 + 94c0933 commit 720c813
Show file tree
Hide file tree
Showing 10 changed files with 260 additions and 207 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,71 +5,80 @@ 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-*"
tags:
- "v*"

# Trigger on request.
workflow_dispatch:

env:
UV_VERSION: 0.2.2

jobs:
build_wheels:
name: Build wheels [py${{ matrix.python_version }}, ${{ matrix.os }}]
runs-on: ${{ matrix.os }}-${{ matrix.os_version }}
name: Build wheels [${{ matrix.python.version }}, ${{ matrix.os.base }}-${{ matrix.os.arch }}]
runs-on: ${{ matrix.os.base }}-${{ matrix.os.version }}
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

include:
- os_version: 'latest'

- os: 'macos'
os_version: '14'
os:
- base: ubuntu
version: latest
arch: 'x86_64'
- base: windows
version: latest
arch: 'amd64'
- base: macos
version: 14
arch: 'arm64'
- base: macos
version: 13
arch: 'x86_64'

python:
- version: 'cp39'
oldest_numpy: '1.21.6'
- version: 'cp310'
oldest_numpy: '1.21.6'
- version: 'cp311'
oldest_numpy: '1.23.2'
- version: 'cp312'
oldest_numpy: '1.26.2'

steps:
- uses: actions/[email protected].4
- uses: actions/[email protected].6

- name: Build wheels
uses: pypa/cibuildwheel@v2.17.0
uses: pypa/cibuildwheel@v2.18.1
env:
CIBW_PROJECT_REQUIRES_PYTHON: "==${{ matrix.python_version }}.*"
CIBW_BUILD: "${{ matrix.python.version }}-*"
CIBW_TEST_REQUIRES: pytest==8.2.1 numpy==${{ matrix.python.oldest_numpy }}

- uses: actions/[email protected]
with:
name: dist-python-${{ matrix.python_version }}-${{ matrix.os }}
name: dist-python-${{ matrix.python.version }}-${{ matrix.os.base }}-${{ matrix.os.arch }}
path: ./wheelhouse/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected].4
- uses: actions/[email protected].6

- uses: actions/[email protected]
name: Install Python
with:
python-version: '3.11'
python-version: '3.12'

- uses: actions/[email protected]
with:
path: ~/.cache/pip
key: gsd-build-wheels-pip-${{ hashFiles('.github/requirements-build-sdist.txt') }}
restore-keys: |
gsd-build-wheels-pip-
- 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 build
run: python3 -m pip --disable-pip-version-check install -r .github/requirements-build-sdist.txt --progress-bar=off
run: 'uv pip install -r .github/requirements-build-sdist.txt --only-binary :all: --system --reinstall'

- name: Build sdist
run: python -m build --sdist --outdir dist/ .
Expand Down
23 changes: 10 additions & 13 deletions .github/workflows/release.yml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,14 @@ 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-*"
tags:
- "v*"

# Trigger on request.
workflow_dispatch:

env:
Expand All @@ -32,17 +26,17 @@ jobs:
release:
name: Build release tarball
runs-on: ubuntu-latest
container:
image: glotzerlab/ci:2023.10.09-ubuntu22.04
options: -u 0

steps:
- uses: actions/[email protected].4
- uses: actions/[email protected].6
with:
fetch-depth: 0
submodules: true
path: code

- name: Install tools
run: sudo apt-get install pcregrep pandoc

- name: Determine last tag via git describe
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
run: echo tag="$(git describe --abbrev=0)" >> "$GITHUB_ENV"
Expand All @@ -66,11 +60,14 @@ jobs:
- name: Tar source
run: tar -cvzf "${name}-${tag:1}.tar.gz" "${name}-${tag:1}"

- name: Tar source
run: tar -cvJf "${name}-${tag:1}.tar.xz" "${name}-${tag:1}"

- uses: actions/[email protected]
with:
name: release
path: |
*.tar.gz
*.tar.*
changelog.md
publish:
Expand All @@ -88,7 +85,7 @@ jobs:
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
files: "*.tar.gz"
files: "*.tar.*"
body_path: changelog.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
schedule:
- cron: '0 19 * * *'

# Trigger on request.
workflow_dispatch:

jobs:
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/style_check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Style check

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:

push:
branches:
- "trunk-*"

workflow_dispatch:

env:
UV_VERSION: 0.2.2

jobs:
clang-tidy:
name: Run clang-tidy
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
- name: Set up Python
uses: actions/[email protected]
with:
python-version: 3.12
- 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: 'uv pip install -r .github/requirements-test.txt --only-binary :all: --system --reinstall'
- name: Configure
run: cmake -B build
- name: Execute clang-tidy
run: clang-tidy-14 -p=build gsd/*.c gsd/*.h scripts/*.cc --quiet --warnings-as-errors="*"

# This job is used to provide a single requirement for branch merge conditions.
checks_complete:
name: Style check
if: always()
needs: [clang-tidy]
runs-on: ubuntu-latest

steps:
- run: jq --exit-status 'all(.result == "success")' <<< '${{ toJson(needs) }}'
- name: Done
run: exit 0
42 changes: 0 additions & 42 deletions .github/workflows/style_check.yml

This file was deleted.

Loading

0 comments on commit 720c813

Please sign in to comment.