Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major CI refactor #291

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .github/actions/conda-build/action.yml

This file was deleted.

10 changes: 0 additions & 10 deletions .github/actions/linter/action.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .github/actions/unittests/action.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/build_wheels_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
with:
user: __token__
password: ${{ secrets.GH_TESTPYPI_UPLOAD }}
repository_url: https://test.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/

upload_pypi:
needs: [build_wheels, build_sdist, upload_testpypi]
Expand Down
119 changes: 71 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,64 +2,87 @@ name: CI
on: [push]

jobs:
linter:
name: "Linter (pre-commit)"
pre-commit-checks:
name: Linux - pre-commit checks - Python 3.10
timeout-minutes: 30
runs-on: ubuntu-latest
env:
CI: True
strategy:
fail-fast: true
steps:
- name: Pull image
run: docker pull condaforge/mambaforge:latest
- name: Checkout branch
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Run linter inside of container
uses: ./.github/actions/linter
linux:
name: "Linux - tests - Py${{ matrix.PYTHON_VERSION }}"
runs-on: ubuntu-latest
env:
CI: True
strategy:
fail-fast: true
matrix:
PYTHON_VERSION: ['3.7', '3.8', '3.9', '3.10']
PRE_COMMIT_USE_MICROMAMBA: 1
steps:
- name: Pull image
run: docker pull condaforge/mambaforge:latest
- name: Checkout branch
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Run CI inside of container
uses: ./.github/actions/unittests
with:
python_version: ${{ matrix.PYTHON_VERSION }}
linux-conda-build:
name: "Linux - conda-build - Python ${{ matrix.CONDA_BUILD_YML }}"
runs-on: ubuntu-latest
- name: Checkout branch
uses: actions/checkout@v3.5.2
- name: Set up micromamba
uses: mamba-org/setup-micromamba@d05808540d968a55ca33c798e0661fb98f533c73
- name: Add micromamba to GITHUB_PATH
run: echo "${HOME}/micromamba-bin" >> "$GITHUB_PATH"
- name: Install Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Run pre-commit checks
uses: pre-commit/action@v3.0.0

unit-tests:
name: Tests - ${{ matrix.os }} - Py${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
env:
CI: True
strategy:
fail-fast: true
matrix:
CONDA_BUILD_YML:
- linux_64_python3.7_default.____cpython
- linux_aarch64_python3.10_default.____cpython
- linux_ppc64le_python3.10_default.____cpython
include:
- { os: ubuntu-latest, python-version: '3.7' }
- { os: ubuntu-latest, python-version: '3.8' }
- { os: ubuntu-latest, python-version: '3.9' }
- { os: ubuntu-latest, python-version: '3.10' }
- { os: ubuntu-latest, python-version: '3.11' }
- { os: macos-latest, python-version: '3.10' }
- { os: windows-latest, python-version: '3.10' }
steps:
- name: Pull image
run: docker pull condaforge/mambaforge:latest
- name: Checkout branch
uses: actions/checkout@v3
- name: Set up conda env
if: matrix.os != 'windows-latest'
uses: mamba-org/setup-micromamba@875557da4ee020f18df03b8910a42203fbf02da1
with:
ref: ${{ github.head_ref }}
- name: Fetch full git history
run: git fetch --prune --unshallow
- name: Run CI inside of container
uses: ./.github/actions/conda-build
environment-file: environment.yml
init-shell: 'bash'
cache-environment: true
create-args: >-
python=${{ matrix.python-version }}
- name: Set up conda env (windows)
if: matrix.os == 'windows-latest'
uses: mamba-org/setup-micromamba@875557da4ee020f18df03b8910a42203fbf02da1
with:
conda_build_yml: ${{ matrix.CONDA_BUILD_YML }}
environment-file: environment-win.yml
init-shell: 'powershell'
cache-environment: true
create-args: >-
python=${{ matrix.python-version }}
- name: Install repository (unix)
if: matrix.os != 'windows-latest'
shell: bash -el {0}
run: pip install --no-use-pep517 --no-deps --disable-pip-version-check -e .
- name: Install repository (windows)
if: matrix.os == 'windows-latest'
shell: powershell
run: pip install --no-use-pep517 --no-deps --disable-pip-version-check -e .
- name: Run pytest (unix)
if: matrix.os != 'windows-latest'
shell: bash -el {0}
run: pytest -nauto tests --doctest-modules src/tabmat
- name: Run pytest (windows)
if: matrix.os == 'windows-latest'
shell: powershell
run: pytest -nauto .\tests --doctest-modules .\src\tabmat
- name: Run doctest
if: matrix.os != 'windows-latest'
shell: bash -el {0}
# Check that the readme example will work by running via doctest.
# We run outside the repo to make the test a bit more similar to
# a user running after installing with conda.
run: |
mkdir ../temp
cp README.md ../temp
cd ../temp
python -m doctest -v README.md
32 changes: 0 additions & 32 deletions .github/workflows/conda-build-linux-main.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/conda-build-macos.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/conda-build-win.yml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/conda-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: conda-build
on:
pull_request:
branches:
- main
push:
branches:
- main
paths:
- '.github/**'
- 'conda.recipe/**'

jobs:
conda-build:
name: ${{ matrix.conda_build_yml }}
runs-on: ${{ matrix.os }}
env:
CI: True
strategy:
fail-fast: false
matrix:
include:
- { conda_build_yml: linux_64_python3.7_default.____cpython, os: ubuntu-latest, conda-build-args: '' }
- { conda_build_yml: linux_64_python3.8_default.____cpython, os: ubuntu-latest, conda-build-args: '' }
- { conda_build_yml: linux_64_python3.9_default.____cpython, os: ubuntu-latest, conda-build-args: '' }
- { conda_build_yml: linux_64_python3.10_default.____cpythonn, os: ubuntu-latest, conda-build-args: '' }
- { conda_build_yml: osx_64_python3.7_default.____cpython, os: macos-latest, conda-build-args: '' }
- { conda_build_yml: osx_64_python3.8_default.____cpython, os: macos-latest, conda-build-args: '' }
- { conda_build_yml: osx_arm64_python3.9.____cpython, os: macos-latest, conda-build-args: ' --no-test' }
- { conda_build_yml: osx_arm64_python3.10.____cpython, os: macos-latest, conda-build-args: ' --no-test' }
- { conda_build_yml: win_64_python3.9.____cpython, os: windows-latest, conda-build-args: '' }
- { conda_build_yml: win_64_python3.10.____cpython, os: windows-latest, conda-build-args: '' }
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Fetch full git history
run: git fetch --prune --unshallow
- uses: mamba-org/setup-micromamba@875557da4ee020f18df03b8910a42203fbf02da1
with:
init-shell: ${{ matrix.os == 'windows-latest' && 'cmd.exe' || 'bash' }}
environment-name: build
create-args: boa
- name: Patch conda build configuration
# use the latest macOS SDK when cross-compiling for arm64
if: startsWith(matrix.conda_build_yml, 'osx_arm64')
run: |
CONDA_BUILD_SYSROOT="$(xcrun --sdk macosx --show-sdk-path)"
cat <<EOF >> ".ci_support/${{ matrix.CONDA_BUILD_YML }}.yaml"
CONDA_BUILD_SYSROOT:
- "${CONDA_BUILD_SYSROOT}"
EOF
- name: Build conda package (unix)
if: matrix.os != 'windows-latest'
shell: bash -el {0}
run: >-
conda-mambabuild
-m ".ci_support/${{ matrix.CONDA_BUILD_YML }}.yaml"${{ matrix.conda-build-args }}
conda.recipe
- name: Build conda package (windows)
if: matrix.os == 'windows-latest'
shell: cmd /C CALL {0}
run: >-
conda-mambabuild
-m ".ci_support/${{ matrix.conda_build_yml }}.yaml"${{ matrix.conda-build-args }}
conda.recipe
Loading
Loading