Skip to content

Commit

Permalink
Merge pull request #52 from qognitive/feature/release-workflow
Browse files Browse the repository at this point in the history
refactor workflow to enable releases
  • Loading branch information
sebastroy authored Oct 3, 2024
2 parents bb9629e + a81a0d3 commit 6dd6586
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 33 deletions.
31 changes: 31 additions & 0 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build/Test
runs:
using: "composite"
steps:
- name: Setup compiler
shell: bash
run: python3 ./.github/compiler_setup.py ${CXX} ${BUILD_OS}
- name: Install Python dependencies
shell: bash
run: python -m pip install cmake scikit-build-core
- name: Configure CMake
shell: bash
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_COMPILER=${CXX}
- name: Build
shell: bash
run: |
cmake --build ${{github.workspace}}/build --verbose --parallel
- name: Install
shell: bash
run: |
cmake --install ${{github.workspace}}/build
python -m pip install ".[dev]" --no-build-isolation
- name: Test C++
shell: bash
env:
OMP_NUM_THREADS: 2
CPP_TEST_DIR: build/fast_pauli/cpp/tests
run: make test-cpp
- name: Test Python
shell: bash
run: make test-py
45 changes: 12 additions & 33 deletions .github/workflows/all_push.yml
Original file line number Diff line number Diff line change
@@ -1,48 +1,27 @@
name: Build/Test
on: [push]
name: "Push Build/Test"
on:
push:
branches-ignore:
- main
jobs:
build:
push-build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
compiler: [g++-12, clang++-17]
python-version: ["3.10", "3.11", "3.12"]
include:
- os: macos-13
compiler: g++-12
python-version: 3.12
- os: macos-14
compiler: g++-12
python-version: 3.12
compiler: [clang++-17]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup compiler
run: python3 ./.github/compiler_setup.py ${{ matrix.compiler }} ${{ matrix.os }}
- name: Setup Python
- name: Push Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: python -m pip install cmake scikit-build-core
- name: Configure CMake
- name: Push Build
uses: ./.github/actions/build
env:
BUILD_OS: ${{ matrix.os }}
CXX: ${{ matrix.compiler }}
run: cmake -B ${{github.workspace}}/build -DCMAKE_CXX_COMPILER=${CXX}
- name: Build
run: |
cmake --build ${{github.workspace}}/build --verbose --parallel
- name: Install
run: |
cmake --install ${{github.workspace}}/build
python -m pip install ".[dev]" --no-build-isolation
- name: Test C++
env:
OMP_NUM_THREADS: 2
CPP_TEST_DIR: build/fast_pauli/cpp/tests
run: make test-cpp
- name: Test Python
run: make test-py
44 changes: 44 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# the name of this file must match the one in pypi.org config
name: Build/Test/Release
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- published
jobs:
main-build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
compiler: [g++-12, clang++-17]
python-version: ["3.10", "3.11", "3.12"]
include:
- os: macos-13
compiler: g++-12
python-version: 3.12
- os: macos-14
compiler: g++-12
python-version: 3.12
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Main Setup Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Main Build
uses: ./.github/actions/build
env:
BUILD_OS: ${{ matrix.os }}
CXX: ${{ matrix.compiler }}
- name: Publish release distributions to PyPI
if: github.event.release
uses: pypa/gh-action-pypi-publish@release/v1

0 comments on commit 6dd6586

Please sign in to comment.