Redo numpy 1.x fix #184
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
branches-ignore: | |
- wheels | |
tags: | |
- v* | |
pull_request: | |
env: | |
HTML_DIR: "${{ github.workspace }}/../html" | |
DOC_TOOLS_DIR: "${{ github.workspace }}/../doc_tools" | |
DOC_BRANCH: "gh-pages" | |
jobs: | |
# Unittests | |
unittests: | |
runs-on: ubuntu-latest | |
# We want to run on external PRs, but not on our own internal PRs as they'll be run | |
# by the push to the branch. | |
if: | | |
((github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) | |
&& ! contains(github.event.head_commit.message, '[skip ci]')) | |
strategy: | |
matrix: | |
python-version: ["3.10", 3.11, 3.12] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Deepen Repository | |
run: | | |
python .github/utils/deepen-shallow-repo.py | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Ubuntu dependencies | |
shell: bash | |
run: | | |
sudo apt-get update | |
sudo apt-get install libopenblas-dev liblapack-dev gfortran ccache | |
- name: Install Python Packages | |
shell: bash | |
run: | | |
pip install uv | |
uv pip install --system ".[build,test]" | |
- name: Environment Information | |
shell: bash | |
run: | | |
git describe --tags | |
ls -la | |
uv pip list | |
- name: Build Package | |
shell: bash | |
run: | | |
make build | |
- name: Upload meson log file | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: meson-logs | |
path: build/meson-logs/meson-log.txt | |
if-no-files-found: ignore | |
- name: Run Tests | |
shell: bash | |
run: | | |
coverage erase | |
make test | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
fail_ci_if_error: true | |
name: "py${{ matrix.python-version }}" | |
token: ${{ secrets.CODECOV_TOKEN }} | |
# Linting | |
lint: | |
runs-on: ubuntu-latest | |
# We want to run on external PRs, but not on our own internal PRs as they'll be run | |
# by the push to the branch. | |
if: | | |
((github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) | |
&& ! contains(github.event.head_commit.message, '[skip ci]')) | |
strategy: | |
matrix: | |
python-version: [3.11] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install Packages | |
shell: bash | |
run: | | |
pip install uv | |
uv pip install --system ruff | |
- name: Environment Information | |
shell: bash | |
run: uv pip list | |
- name: Run Tests | |
shell: bash | |
run: make lint | |
# Documentation | |
documentation: | |
runs-on: ubuntu-latest | |
# We want to run on external PRs, but not on our own internal PRs as they'll be run | |
# by the push to the branch. | |
if: | | |
((github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository) | |
&& ! contains(github.event.head_commit.message, '[skip ci]')) | |
strategy: | |
matrix: | |
python-version: [3.11] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Deepen Repository | |
run: | | |
python .github/utils/deepen-shallow-repo.py | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Ref: https://docs.github.com/en/free-pro-team@latest/actions/guides/building-and-testing-python#caching-dependencies | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
# This path is specific to Ubuntu | |
path: ~/.cache/pip | |
# Look to see if there is a cache hit for the corresponding requirements file | |
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
${{ runner.os }}- | |
- name: Install Ubuntu dependencies | |
shell: bash | |
run: | | |
sudo apt-get update | |
sudo apt-get install libopenblas-dev liblapack-dev gfortran ccache | |
- name: Install Python Packages | |
shell: bash | |
run: | | |
pip install uv | |
uv pip install --system ".[build, doc]" | |
- name: Environment Information | |
shell: bash | |
run: uv pip list | |
- name: Build Documentation | |
shell: bash | |
run: | | |
pushd doc | |
SPHINXOPTS=-W | |
make html && popd | |
- name: Upload HTML | |
uses: actions/upload-artifact@v4 | |
with: | |
name: html | |
path: "doc/_build/html/" | |
# Documentation | |
deploy_documentation: | |
name: Deploy Documentation | |
needs: [unittests, documentation] | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev' || startswith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Download HTML | |
uses: actions/download-artifact@v4 | |
with: | |
name: html | |
path: "${{ env.HTML_DIR }}" | |
- name: Get branch information | |
id: branch_info | |
run: | | |
echo "{SOURCE_BRANCH}={${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
echo "{SOURCE_TAG}={${GITHUB_REF#refs/tags/}}" >> $GITHUB_OUTPUT | |
ls -la "$HTML_DIR" | |
- name: Check main repository | |
uses: actions/checkout@v4 | |
- name: Copy commit tools from main repository | |
run: | | |
mkdir -p "$DOC_TOOLS_DIR" | |
cp tools/deploy_documentation.sh "$DOC_TOOLS_DIR" | |
- name: Checkout Documentation branch | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.DOC_BRANCH }} | |
- name: Commit Documentation | |
shell: bash | |
env: | |
SOURCE_BRANCH: ${{ steps.branch_info.outputs.SOURCE_BRANCH }} | |
SOURCE_TAG: ${{ steps.branch_info.outputs.SOURCE_TAG }} | |
run : source "$DOC_TOOLS_DIR/deploy_documentation.sh" |