0.2.1 changelog (#138) #299
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 and test | |
on: | |
push: | |
paths-ignore: | |
- "README.md" | |
- "LICENSE" | |
- "MANIFEST" | |
- "docs/**" | |
- ".github/workflows/docs.yml" | |
branches: | |
- main | |
pull_request: | |
paths-ignore: | |
- "README.md" | |
- "LICENSE" | |
- "MANIFEST" | |
- "docs/**" | |
- ".github/workflows/docs.yml" | |
branches: | |
- main | |
jobs: | |
package: | |
name: Build package | |
runs-on: "ubuntu-latest" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniconda-version: "latest" | |
activate-environment: build-conda-token | |
environment-file: etc/build-environment.yml | |
python-version: 3.8 | |
auto-activate-base: false | |
- name: conda Build | |
shell: bash -l {0} | |
run: | | |
VERSION=`python -m setuptools_scm` conda build conda.recipe | |
mv $CONDA_PREFIX/conda-bld . | |
- name: Upload the build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: package-${{ github.sha }} | |
path: conda-bld | |
test: | |
name: Test (conda ${{ matrix.conda-version }}, Python ${{ matrix.python-version }}, ${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
python-version: [3.8, 3.9, "3.10"] | |
conda-version: ["4.11", "4.12", "4.13", "4.14", "22.9", "22.11", "23.1", "23.3", "23.5"] | |
exclude: | |
# Python 3.10 | |
- conda-version: "4.11" | |
python-version: "3.10" | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download conda standalone | |
shell: bash | |
run: | | |
if [ $RUNNER_OS == 'Linux' ]; then | |
curl https://repo.anaconda.com/pkgs/misc/conda-execs/conda-latest-linux-64.exe -o conda.exe | |
elif [ $RUNNER_OS == 'Windows' ]; then | |
curl https://repo.anaconda.com/pkgs/misc/conda-execs/conda-4.10.3-win-64.exe -o conda.exe | |
elif [ $RUNNER_OS == 'macOS' ]; then | |
curl https://repo.anaconda.com/pkgs/misc/conda-execs/conda-latest-osx-64.exe -o conda.exe | |
fi | |
chmod +x conda.exe | |
./conda.exe config --set auto_update_conda false | |
./conda.exe clean -ay | |
./conda.exe info | |
- name: Setup miniconda | |
shell: bash | |
run: | | |
./conda.exe create -p $HOME/miniconda conda=${{ matrix.conda-version }} python=${{ matrix.python-version }} | |
- name: Update with test dependencies | |
shell: bash | |
run: | | |
if [ $RUNNER_OS == 'Windows' ]; then | |
source $HOME/miniconda/Scripts/activate root && conda env update -f etc/test-environment.yml -p $HOME/miniconda && $HOME/miniconda/Scripts/pip install --no-deps . | |
else | |
source $HOME/miniconda/bin/activate root && conda env update -f etc/test-environment.yml -p $HOME/miniconda && $HOME/miniconda/bin/pip install --no-deps . | |
fi | |
- name: Install Libmamba | |
shell: bash | |
run: | | |
if [[ ! "${{ matrix.conda-version }}" =~ ^("4.9"|"4.10"|"4.11")$ ]]; then | |
if [ $RUNNER_OS == 'Windows' ]; then | |
source $HOME/miniconda/Scripts/activate root && \ | |
conda install conda-libmamba-solver -p $HOME/miniconda | |
else | |
source $HOME/miniconda/bin/activate root && \ | |
conda install conda-libmamba-solver -p $HOME/miniconda | |
fi | |
fi | |
- name: py.test | |
shell: bash | |
env: | |
CONDA_DEFAULT_CHANNELS: conda-forge | |
run: | | |
if [ $RUNNER_OS == 'Windows' ]; then | |
source $HOME/miniconda/Scripts/activate root && \ | |
conda --version && \ | |
py.test \ | |
-xv \ | |
--cov-report xml:./coverage.xml \ | |
--cov conda_project \ | |
tests | |
else | |
source $HOME/miniconda/bin/activate root && \ | |
conda --version && \ | |
py.test \ | |
-xv \ | |
--cov-report xml:./coverage.xml \ | |
--cov conda_project \ | |
tests | |
fi | |
- uses: codecov/codecov-action@v2 | |
with: | |
files: ./coverage.xml | |
env_vars: OS,PYTHON | |
upload: | |
needs: test | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- name: Retrieve the source code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Download the build artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: package-${{ github.sha }} | |
path: conda-bld | |
- name: Upload to anaconda.org | |
env: | |
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
GITHUB_REF: ${{ github.ref }} | |
run: | | |
source $CONDA/bin/activate | |
conda install -y anaconda-client | |
[[ "$GITHUB_REF" =~ ^refs/tags/ ]] || export LABEL="--label dev" | |
anaconda --verbose --token $ANACONDA_TOKEN upload --user defusco $LABEL conda-bld/noarch/conda-project*.tar.bz2 --force | |
- name: Clean up older artifacts | |
uses: glassechidna/artifact-cleaner@master | |
with: | |
minimumAge: 86400 | |
# This check job runs to ensure all tests have passed, such that we can use it as a "wildcard" for branch | |
# protection to ensure all tests pass before a PR can be merged. | |
check: | |
if: always() | |
needs: [test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether all required jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} |