Skip to content

Commit

Permalink
Major CI cleanup (#674)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw committed Aug 15, 2023
1 parent 5903a00 commit ffc289a
Show file tree
Hide file tree
Showing 21 changed files with 165 additions and 534 deletions.
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.

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

This file was deleted.

9 changes: 0 additions & 9 deletions .github/workflows/base.sh

This file was deleted.

9 changes: 1 addition & 8 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Build wheels
uses: pypa/cibuildwheel@v2.14.1
env:
CIBW_ARCHS_MACOS: x86_64 arm64

- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
Expand All @@ -31,17 +29,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.8'

- name: Install build dependencies
run: python -m pip install setuptools setuptools-scm wheel Cython numpy scikit-learn
- name: Build sdist
run: python setup.py sdist

- uses: actions/upload-artifact@v3
with:
path: dist/*.tar.gz
Expand All @@ -55,12 +50,11 @@ jobs:
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@v1.8.10
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 All @@ -71,7 +65,6 @@ jobs:
with:
name: artifact
path: dist

- uses: pypa/gh-action-pypi-publish@v1.8.10
with:
user: __token__
Expand Down
108 changes: 61 additions & 47 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,76 @@ 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
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 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.8', '3.9', '3.10']
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_numpy1.20python3.8.____cpython
include:
- { 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
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
with:
conda_build_yml: ${{ matrix.CONDA_BUILD_YML }}
environment-file: environment.yml
init-shell: ${{ matrix.os == 'windows-latest' && 'powershell' || 'bash' }}
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/glm --doctest-modules src/glum
- name: Run pytest (windows)
if: matrix.os == 'windows-latest'
shell: powershell
run: pytest -nauto .\tests\glm --doctest-modules .\src\glum
- 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
31 changes: 0 additions & 31 deletions .github/workflows/conda-build-linux-main.yml

This file was deleted.

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

This file was deleted.

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

This file was deleted.

11 changes: 0 additions & 11 deletions .github/workflows/conda-build.sh

This file was deleted.

0 comments on commit ffc289a

Please sign in to comment.