Skip to content

Commit

Permalink
merge: #26/v0.5.0
Browse files Browse the repository at this point in the history
Stage Release v0.5.0
  • Loading branch information
joshua-auchincloss authored Nov 30, 2023
2 parents e30c309 + c6f7793 commit 3f904ec
Show file tree
Hide file tree
Showing 59 changed files with 1,314 additions and 488 deletions.
166 changes: 94 additions & 72 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,90 +1,112 @@
name: build

on:
push:
tags:
- v*
branches:
- master
pull_request:
branches:
- master
push:
tags:
- v*
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

defaults:
run:
shell: bash
run:
shell: bash

jobs:
Validate:
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, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]
Validate:
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, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3
steps:
- uses: actions/checkout@v3

- name: Install
if: startsWith(matrix.os, 'macos-')
run: |
brew install libomp llvm &&
brew link llvm &&
echo $(brew info llvm) &&
echo $(arch)
- name: Install llvm
if: startsWith(matrix.os, 'macos-')
run: |
brew cleanup
brew update -f
rm -rf /usr/local/bin/2to3*
rm -rf /usr/local/bin/idle3*
rm -rf /usr/local/bin/pydoc3*
rm -rf /usr/local/bin/python*
brew install libomp
brew install llvm
echo "
export PATH=\"/usr/local/opt/llvm/bin:\$PATH\"
export LDFLAGS=\"-L/usr/local/opt/llvm/lib\"
export CPPFLAGS=\"-I/usr/local/opt/llvm/include\"
export LD=ld.lld
export AR=llvm-ar
export RANLIB=llvm-ranlib
" >> $HOME/.bash_profile
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
architecture: "x64"
python-version: ${{ matrix.python-version }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
architecture: x64
python-version: ${{ matrix.python-version }}

- name: Install Hatch
run: pip install --upgrade hatch
- name: Install Hatch
run: pip install --upgrade hatch

- name: Run tests
run: hatch run cov
- name: Run tests
run: hatch run cov

- name: Test Compile
shell: bash
run: |
cd example
echo "os: $RUNNER_OS"
hatch build
hatch run test
- name: Test src lib compilation
shell: bash
run: |
cd test_libraries/src_structure
echo "os: $RUNNER_OS"
hatch --verbose build --clean
hatch run test
- name: Test simple lib compilation
shell: bash
run: |
cd test_libraries/simple_structure
echo "os: $RUNNER_OS"
cp -r ../src_structure/src/example_lib/* ./example_lib/
cp -r ../src_structure/tests/* ./tests/
hatch --verbose build --clean
hatch run test
Build:
needs: Validate
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
environment:
name: pypi
url: https://pypi.org/p/hatch-cython
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch
- name: Build package
run: hatch build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
Build:
needs: [Validate]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
environment:
name: pypi
url: https://pypi.org/p/hatch-cython
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch
- name: Build package
run: hatch build
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
30 changes: 15 additions & 15 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: Coverage
on: [push, pull_request]
jobs:
cov:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Install dependencies
run: pip install '.[test]'
- name: Run tests and collect coverage
run: pytest --cov --ignore=example
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
cov:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: pip install '.[test]'
- name: Run tests and collect coverage
run: pytest --cov --ignore=test_libraries
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
14 changes: 7 additions & 7 deletions .github/workflows/ruff.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: Ruff
on: [push, pull_request]
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1
with:
src: "./src"
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1
with:
src: ./src
116 changes: 69 additions & 47 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,56 +1,78 @@
name: test

on:
push:
branches: [main, v*]
pull_request:
branches: [main, v*]
push:
branches: [main, v*]
pull_request:
branches: [main, v*]

concurrency:
group: test-${{ github.head_ref }}
cancel-in-progress: true
group: test-${{ github.head_ref }}
cancel-in-progress: true

env:
PYTHONUNBUFFERED: "1"
FORCE_COLOR: "1"
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, windows-latest, macos-latest]
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v3

- name: Install
if: startsWith(matrix.os, 'macos-')
run: |
brew install libomp llvm &&
brew link llvm &&
echo $(brew info llvm) &&
echo $(arch)
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
architecture: 'x64'
python-version: ${{ matrix.python-version }}

- name: Install Hatch
run: pip install --upgrade hatch

- name: Run tests
run: hatch run cov

- name: Test Compile
shell: bash
run: |
cd example
echo "os: $RUNNER_OS"
hatch build
hatch run test
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, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v3

- name: Install llvm
if: startsWith(matrix.os, 'macos-')
run: |
brew cleanup
brew update -f
rm -rf /usr/local/bin/2to3*
rm -rf /usr/local/bin/idle3*
rm -rf /usr/local/bin/pydoc3*
rm -rf /usr/local/bin/python*
brew install libomp
brew install llvm
echo "
export PATH=\"/usr/local/opt/llvm/bin:\$PATH\"
export LDFLAGS=\"-L/usr/local/opt/llvm/lib\"
export CPPFLAGS=\"-I/usr/local/opt/llvm/include\"
export LD=ld.lld
export AR=llvm-ar
export RANLIB=llvm-ranlib
" >> $HOME/.bash_profile
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
architecture: x64
python-version: ${{ matrix.python-version }}

- name: Install Hatch
run: pip install --upgrade hatch

- name: Run tests
run: hatch run cov

- name: Test src lib compilation
shell: bash
run: |
cd test_libraries/src_structure
echo "os: $RUNNER_OS"
hatch --verbose build --clean
hatch run test
- name: Test simple lib compilation
shell: bash
run: |
cd test_libraries/simple_structure
echo "os: $RUNNER_OS"
cp -r ../src_structure/src/example_lib/* ./example_lib/
cp -r ../src_structure/tests/* ./tests/
hatch --verbose build --clean
hatch run test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ dist/
*.ipynb
.vscode/settings.json
.vscode/
.ruff_cache
.pytest_cache
Loading

0 comments on commit 3f904ec

Please sign in to comment.