Skip to content

Build and test

Build and test #668

name: Build and test
on:
pull_request:
branches:
- main
push:
branches:
- main
- 'wheel/**'
- 'runci/**'
release:
types:
- created
- edited
schedule:
# 04:00 every Tuesday morning
- cron: '0 4 * * 2'
jobs:
cutensornet-checks:
name: cuTensorNet - Build and test module
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
submodules: true
- run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* +refs/heads/*:refs/remotes/origin/*
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Build and mypy (3.10)
shell: bash
if: (matrix.os == 'macos-latest') && (github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'release' || github.event_name == 'schedule' )
run: |
chmod +x ./.github/workflows/build-test
./.github/workflows/build-test mypy
- name: Set up Python 3.11
if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'release' || github.event_name == 'schedule'
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build (3.11)
if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'release' || github.event_name == 'schedule'
shell: bash
run: |
chmod +x ./.github/workflows/build-test
./.github/workflows/build-test nomypy
- name: Set up Python 3.12
if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'release' || github.event_name == 'schedule'
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Build (3.12)
if: github.event_name == 'push' || github.event_name == 'pull_request' || github.event_name == 'release' || github.event_name == 'schedule'
shell: bash
run: |
chmod +x ./.github/workflows/build-test
./.github/workflows/build-test nomypy
- uses: actions/upload-artifact@v4
if: github.event_name == 'release' || contains(github.ref, 'refs/heads/wheel')
with:
name: artefact-${{ matrix.os }}
path: wheelhouse/
- name: install poetry
run: pip install poetry
- name: Install docs dependencies
if: (matrix.os == 'ubuntu-latest') && (github.event_name == 'pull_request' || github.event_name == 'schedule' )
run: |
cd docs
bash ./install.sh
for w in `find wheelhouse/ -type f -name "*.whl"` ; do poetry run pip install $w ; done
- name: Build docs
if: (matrix.os == 'ubuntu-latest') && (github.event_name == 'pull_request' || github.event_name == 'schedule' )
timeout-minutes: 20
run: |
cd docs
poetry run bash ./build-docs.sh
publish_to_pypi:
name: Publish to pypi
if: github.event_name == 'release'
needs: cutensornet-checks
runs-on: ubuntu-latest
steps:
- name: Download all wheels
# downloading all three files into the wheelhouse
# all files are identical, so there will only be one file
uses: actions/download-artifact@v4
with:
path: wheelhouse
pattern: artefact-*
merge-multiple: true
- name: Put them all in the dist folder
run: |
mkdir dist
for w in `find wheelhouse/ -type f -name "*.whl"` ; do cp $w dist/ ; done
- name: Publish wheels
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PYTKET_CUTENSORNET_API_TOKEN }}
verbose: true
build_docs:
name: Build docs
if: github.event_name == 'release'
needs: publish_to_pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
submodules: true
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Download all wheels
uses: actions/download-artifact@v4
with:
path: wheelhouse
- name: Install pip, wheel
run: pip install -U pip wheel
- name: Install poetry
run: pip install poetry
- name: Install extension
run: for w in `find wheelhouse/ -type f -name "*.whl"` ; do poetry install $w ; done
- name: Install docs dependencies
run: |
cd docs
bash ./install.sh
- name: Build docs
timeout-minutes: 20
run: |
cd docs
poetry run bash ./build-docs.sh