chore(deps): pin actions/upload-artifact action to a8a3f3a #185
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 and test the package | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- master | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
testbed: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest,macos-latest,windows-latest] | |
steps: | |
- name: Retrieve the source code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- id: conda-root | |
name: Set CONDA_ROOT | |
run: | | |
CONDA_ROOT=$(dirname $GITHUB_WORKSPACE)/conda | |
echo "::set-output name=value::$CONDA_ROOT" | |
echo "CONDA_ROOT=$CONDA_ROOT" >> $GITHUB_ENV | |
echo "CONDA_ROOT: $CONDA_ROOT" | |
# Use a smaller cache entry to enable a quicker exit if we | |
# have already built the testbed. Any small file will do | |
- id: cache-key | |
name: Retrieve cache key | |
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4 | |
with: | |
path: ./LICENSE | |
key: key-${{ matrix.os }}-${{ hashFiles('testbed') }} | |
- id: cache | |
name: Retrieve or create the conda cache | |
if: steps.cache-key.outputs.cache-hit != 'true' | |
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4 | |
with: | |
path: ${{ steps.conda-root.outputs.value }} | |
key: testbed-${{ matrix.os }}-${{ hashFiles('testbed') }} | |
- name: Verify or build the testbed | |
if: steps.cache-key.outputs.cache-hit != 'true' | |
# The argument tells the script we are in caching mode | |
run: testbed/build.sh | |
tests: | |
runs-on: ${{ matrix.os }} | |
needs: testbed | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest,ubuntu-latest,windows-latest] | |
pyver: ["3.8","3.9","3.10","3.11"] | |
steps: | |
- name: Retrieve the source code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
fetch-depth: 0 | |
- id: conda-root | |
name: Set CONDA_ROOT | |
run: | | |
CONDA_ROOT=$(dirname $GITHUB_WORKSPACE)/conda | |
echo "::set-output name=value::$CONDA_ROOT" | |
echo "CONDA_ROOT=$CONDA_ROOT" >> $GITHUB_ENV | |
echo "CONDA_ROOT: $CONDA_ROOT" | |
- name: Retrieve the testbed | |
uses: actions/cache@ab5e6d0c87105b4c9c2047343972218f562e4319 # v4 | |
with: | |
path: ${{ steps.conda-root.outputs.value }} | |
key: testbed-${{ matrix.os }}-${{ hashFiles('testbed') }} | |
- name: Verify or build the testbed | |
run: testbed/build.sh | |
- name: Build and test the package | |
run: | | |
source $CONDA_ROOT/etc/profile.d/conda.sh | |
[ "$RUNNER_OS" == "Windows" ] && export PYTHONIOENCODING=UTF-8 | |
conda build conda-recipe --python=${{ matrix.pyver }} | tee build.log | |
# Because Windows refuses to preserve the error code | |
if grep ' FAILED ' build.log; then exit -1; fi | |
mv $CONDA_ROOT/conda-bld . | |
- name: Upload the build artifact | |
if: github.event_name == 'push' | |
# Do not use v4 until merge behavior can be rebuilt | |
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3 | |
with: | |
# By uploading to the same artifact we can download all of the packages | |
# and upload them all to anaconda.org in a single job | |
name: package-${{ github.sha }} | |
path: conda-bld/*/*.tar.bz2 | |
upload: | |
needs: tests | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- name: Retrieve the source code | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
with: | |
fetch-depth: 0 | |
- name: Download the build artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: package-${{ github.sha }} | |
path: conda-bld | |
- name: Upload to anaconda.org | |
env: | |
ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} | |
run: | | |
source $CONDA/bin/activate | |
conda install -y anaconda-client | |
git describe --exact-match --tags HEAD || export LABEL="--label dev" | |
anaconda --verbose --token $ANACONDA_TOKEN upload --user jupycon $LABEL conda-bld/*/*.tar.bz2 --force | |
- name: Clean up older artifacts | |
uses: glassechidna/artifact-cleaner@master | |
with: | |
minimumAge: 86400 |