Skip to content

Commit

Permalink
infrastructure refresh (#214)
Browse files Browse the repository at this point in the history
* add dependabot and update infrastructure

* add ci-locks and remove requirements duplication

* updated conda lock files

* turn-off cirrus-ci turn-on gha testing

* schedule ci-locks with cron

* update readthedocs

* pin mambaforge version

* mv doc to docs

* turn-on osx tests for latest python version

* use cibuildwheel

* use oldest-supported-numpy meta-package

* configure cibuildwheel

* skip musllinux builds

* add linux aarch64 support

* update job name

* yum update for aarch64

* drop linux aarch64

* add wheels build tests

* add wheel pytest

* don't ignore pytest failures in tox

* quote ci-locks cron

* update unit tests for py310

* purge old wheel building infrastructure

* publish ci-wheels to pypi

* add setuptools-scm-git-archive support

* update requirements

* ci-wheels get tags

* before build deps

* revoke before build deps

* test pypi publish

* pypi publish test

* final fix for ci-wheels pypi publish

* update pre-commit hooks

* drop black py310 (for now)

* swap-out pypi upload test api token

* rename in pre-commit

* drop unnecessary conda deps

* use miniforge

* Update .github/workflows/ci-locks.yml

Co-authored-by: Martin Yeo <[email protected]>

* Update .github/workflows/ci-tests.yml

Co-authored-by: Martin Yeo <[email protected]>

* Update .github/workflows/ci-wheels.yml

Co-authored-by: Martin Yeo <[email protected]>

* Update pyproject.toml

Co-authored-by: Martin Yeo <[email protected]>

* remove pytest min pin

* review actions

* tidy pre-commit and add sort-all

* black reformat

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: bjlittle <[email protected]>
Co-authored-by: Martin Yeo <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
4 people authored Mar 31, 2022
1 parent f6ee3e3 commit a88fbc1
Show file tree
Hide file tree
Showing 36 changed files with 1,367 additions and 385 deletions.
90 changes: 0 additions & 90 deletions .cirrus.yml

This file was deleted.

1 change: 1 addition & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref-names: $Format:%D$
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git_archival.txt export-subst
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Reference:
# - https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every weekday
interval: "daily"
labels:
- "New: Pull Request"
- "Bot"
37 changes: 0 additions & 37 deletions .github/workflows/actions/entrypoint.sh

This file was deleted.

7 changes: 0 additions & 7 deletions .github/workflows/actions/manylinux2014_x86_64/action.yml

This file was deleted.

136 changes: 136 additions & 0 deletions .github/workflows/ci-locks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Reference:
# - https://github.com/actions/cache
# - https://github.com/actions/checkout
# - https://github.com/actions/download-artifact
# - https://github.com/actions/upload-artifact
# - https://github.com/conda-incubator/setup-miniconda

name: ci-locks

on:
workflow_dispatch:
schedule:
- cron: "3 0 * * 1"


jobs:
build-locks:
name: "Build ${{ matrix.lock }}"
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
env:
ENV_NAME: "ci-locks"
strategy:
matrix:
lock: [py38-lock, py39-lock, py310-lock]
steps:
- name: "Checkout"
uses: actions/checkout@v2

- name: "Environment configure"
env:
# Maximum cache period (in weeks) before forcing a cache refresh.
CACHE_WEEKS: 2
run: |
echo "CACHE_PERIOD=$(date +%Y).$(expr $(date +%U) / ${CACHE_WEEKS})" >> ${GITHUB_ENV}
- name: "Conda package cache"
uses: actions/cache@v2
env:
# Increment the build number to force a cache refresh.
CACHE_BUILD: 1
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }}

- name: "Conda install"
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
channels: conda-forge,defaults
activate-environment: ${{ env.ENV_NAME }}
auto-update-conda: true
use-only-tar-bz2: true

- name: "Conda environment cache"
id: conda-env-cache
uses: actions/cache@v2
env:
# Increment the build number to force a cache refresh.
CACHE_BUILD: 1
with:
path: ${{ env.CONDA }}/envs/${{ env.ENV_NAME }}
key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }}

- name: "Conda environment update"
if: steps.conda-env-cache.outputs.cache-hit != 'true'
run: |
conda install --name ${{ env.ENV_NAME }} tox
- name: "Conda info"
run: |
conda info
conda list
- name: "Tox cache"
uses: actions/cache@v2
env:
# Increment the build number to forece a cache refresh.
CACHE_BUILD: 1
TOX_INI: ${{ github.workspace }}/tox.ini
with:
path: ${{ github.workspace }}/.tox
key: ${{ runner.os }}-tox-${{ env.ENV_NAME }}-${{ matrix.lock }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.TOX_INI) }}

- name: "Create ${{ matrix.lock }} conda locks"
run: |
tox -e ${{ matrix.lock }} -- --platform osx-64 --platform win-64
- name: "Upload lock artifacts"
uses: actions/upload-artifact@v2
with:
name: lock-artifacts
path: ${{ github.workspace }}/requirements/locks/${{ matrix.lock }}*.txt


create-pr:
needs: build-locks
name: "Create pull-request"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v2

- name: "Download lock artifacts"
uses: actions/download-artifact@v2
with:
name: lock-artifacts
path: ${{ github.workspace }}/requirements/locks

- name: "Push pull-request"
id: cpr
# v3.12.1 (release date 31 Jan 2022)
uses: peter-evans/create-pull-request@f22a7da129c901513876a2380e2dae9f8e145330
with:
add-paths: ${{ github.workspace }}/requirements/locks/*.txt
commit-message: "updated conda lock files"
branch: conda-lock-auto-update
delete-branch: true
title: "[cf-units.ci] conda lock auto-update"
body: |
Conda lock files auto-updated to latest resolved environment for `cf-units` dependencies.
### If the full suite of PR checks have not run, please close and re-open this pull request to trigger them.
labels: |
New: Pull Request
Bot
- name: "Show pull-request"
if: steps.cpr.outputs.pull-request-number != ''
run: |
echo "pull-request #${{ steps.cpr.outputs.pull-request-number }}"
echo "pull-request URL ${{ steps.cpr.outputs.pull-request-url }}"
echo "pull-request operation [${{ steps.cpr.outputs.pull-request-operation }}]"
echo "pull-request SHA ${{ steps.cpr.outputs.pull-request-head-sha }}"
106 changes: 106 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Reference:
# - https://github.com/actions/cache
# - https://github.com/actions/checkout
# - https://github.com/conda-incubator/setup-miniconda

name: ci-tests

on:
pull_request:

push:
branches-ignore:
- "conda-lock-auto-update"
- "pre-commit-ci-update-config"
- "dependabot/*"


jobs:
run-tests:
name: "Test ${{ matrix.version }} on ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
CYTHON_COVERAGE: 1
ENV_NAME: "ci-tests"
strategy:
matrix:
os: [ubuntu-latest]
version: [py38, py39, py310]
include:
- os: ubuntu-latest
platform: linux
- os: ubuntu-latest
version: py310
posargs: "--cov-report=xml --cov"
post-command: codecov
- version: py310
os: macos-latest
platform: osx
steps:
- name: "Checkout"
uses: actions/checkout@v2

- name: "Environment configure"
env:
# Maximum cache period (in weeks) before forcing a cache refresh.
CACHE_WEEKS: 2
run: |
echo "CACHE_PERIOD=$(date +%Y).$(expr $(date +%U) / ${CACHE_WEEKS})" >> ${GITHUB_ENV}
- name: "Conda package cache"
uses: actions/cache@v2
env:
# Increment the build number to force a cache refresh.
CACHE_BUILD: 1
with:
path: ~/conda_pkgs_dir
key: ${{ runner.os }}-conda-pkgs-${{ env.ENV_NAME }}-${{ matrix.version }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }}

- name: "Conda install"
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
channels: conda-forge,defaults
activate-environment: ${{ env.ENV_NAME }}
auto-update-conda: false
use-only-tar-bz2: true

- name: "Conda environment cache"
id: conda-env-cache
uses: actions/cache@v2
env:
# Increment the build number to force a cache refresh.
CACHE_BUILD: 1
with:
path: ${{ env.CONDA }}/envs/${{ env.ENV_NAME }}
key: ${{ runner.os }}-conda-env-${{ env.ENV_NAME }}-${{ matrix.version }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }}

- name: "Conda environment update"
if: steps.conda-env-cache.outputs.cache-hit != 'true'
run: |
conda install --name ${{ env.ENV_NAME }} tox
- name: "Conda info"
run: |
conda info
conda list
- name: "Tox cache"
uses: actions/cache@v2
env:
# Increment the build number to forece a cache refresh.
CACHE_BUILD: 1
TOX_INI: ${{ github.workspace }}/tox.ini
with:
path: ${{ github.workspace }}/.tox
key: ${{ runner.os }}-tox-${{ env.ENV_NAME }}-${{ matrix.version }}-p${{ env.CACHE_PERIOD }}-b${{ env.CACHE_BUILD }}-${{ hashFiles(env.TOX_INI) }}

- name: "Run ${{ matrix.os }} on ${{ matrix.version}} tests"
env:
POST_COMMAND: ${{ matrix.post-command }}
run: |
tox -e ${{ matrix.version }}-${{ matrix.platform }}-test -- ${{ matrix.posargs }}
Loading

0 comments on commit a88fbc1

Please sign in to comment.