Skip to content

CI/CD update

CI/CD update #101

Workflow file for this run

name: libcosimpy CI
# This workflow is triggered on pushes to the repository.
on: [push, workflow_dispatch]
jobs:
test:
name: Tests
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ 'windows-latest', 'ubuntu-latest' ]
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
timeout-minutes: 35
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: 'Run test'
run: |
pip install .
pip install pytest==7.2.2
pytest .
build_wheels:
name: Build wheels
needs:
- test
runs-on: ${{ matrix.platform }}
strategy:
fail-fast: false
matrix:
platform: [ 'windows-latest', 'ubuntu-latest' ]
python-version: [ 'cp38', 'cp39', 'cp310', 'cp311', 'cp312' ]
timeout-minutes: 35
env:
CONAN_REVISIONS_ENABLED: 1
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: "${{ matrix.python-version }}-win_amd64 ${{ matrix.python-version }}-manylinux_x86_64"
- uses: actions/upload-artifact@v4
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
name: Upload artifact (wheels)
with:
name: libcosimpy-${{ github.ref_name }}-${{ runner.os }}-${{ matrix.python-version }}-wheel
path: ./wheelhouse/*.whl
build_source:
name: Build source
needs:
- test
runs-on: 'ubuntu-latest'
steps:
- uses: actions/checkout@v3
- name: Install build
run: pip install build
- name: Build source
run: python -m build --sdist
- uses: actions/upload-artifact@v4
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
name: Upload artifact (source)
with:
name: libcosimpy-${{ github.ref_name }}-source
path: ./dist/*.tar.gz
publish:
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
needs:
- build_wheels
- build_source
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
pattern: "*-wheel"
merge-multiple: true
path: ./dist/
- name: Twine check
run: |
pip install twine
twine check --strict ./dist/*
- uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}