Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows #260
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: Test and Deploy | |
on: | |
# Run this workflow every time a PR is opened or a new commit is pushed to the PR | |
pull_request: | |
# Run this workflow every time a PR is merged to main or a release tag is added | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Create env | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
activate-environment: mg | |
environment-file: continuous_integration/environment.yml | |
- name: Update env | |
run: | | |
conda install -q conda-build | |
pip install -e . | |
- name: Lint with Black | |
run: | | |
black --version | |
black metagraph *.py --check --diff | |
- name: Pytest | |
run: | | |
pytest metagraph | |
pytest metagraph --dask --cov-append | |
- name: Coveralls | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
conda install -c conda-forge coveralls | |
coveralls --service=github | |
- name: Conda Build | |
run: | | |
conda build -c defaults -c conda-forge --python 3.8 continuous_integration/conda | |
# This doesn't rebuild, but simply computes the name of the file that was previously built | |
OUTPUT=$(conda build --output -c defaults -c conda-forge --python 3.8 continuous_integration/conda) | |
echo $OUTPUT | |
# Build tarball of output | |
mkdir tarball | |
cd tarball | |
for outpt in $OUTPUT; do | |
cp $outpt . | |
done | |
tar -cf output.tar `ls` | |
echo "CONDA_BUILD_OUTPUT=`pwd`/output.tar" >> $GITHUB_ENV | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: built_package | |
path: ${{ env.CONDA_BUILD_OUTPUT }} | |
retention-days: 7 | |
test_pyver: | |
runs-on: ubuntu-latest | |
needs: build | |
strategy: | |
matrix: | |
pyver: | |
- 3.8 | |
steps: | |
- name: Download build artifact | |
uses: actions/[email protected] | |
with: | |
name: built_package | |
path: ./artifact_storage | |
- name: Create env | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-update-conda: true | |
python-version: ${{ matrix.pyver }} | |
- name: Update env | |
shell: bash -l {0} | |
run: | | |
# Install built_packages | |
cd ./artifact_storage | |
tar -xvf output.tar | |
rm output.tar | |
conda install `ls` | |
cd .. | |
conda list | |
# Install dependencies listed in built package | |
# (This is a workaround because conda does not install dependencies for local file installs) | |
conda update -c defaults -c conda-forge metagraph | |
conda list | |
conda update -c defaults -c conda-forge metagraph-dev | |
conda list | |
- name: Pytest | |
shell: bash -l {0} | |
run: | | |
python -m metagraph.tests | |
python -m metagraph.tests --dask | |
dev_deploy: | |
runs-on: ubuntu-latest | |
needs: test_pyver | |
if: (github.ref == 'refs/heads/main') || contains(github.ref, 'refs/tags/') | |
env: | |
AC_LABEL: -l dev | |
steps: | |
- name: Download build artifact | |
uses: actions/[email protected] | |
with: | |
name: built_package | |
path: ./artifact_storage | |
- name: Determine label | |
if: contains(github.ref, 'refs/tags/') | |
run: | | |
echo "AC_LABEL=-l main -l dev" >> $GITHUB_ENV | |
- name: Deploy to Anaconda Cloud | |
run: | | |
conda install -q anaconda-client | |
cd ./artifact_storage | |
tar -xvf output.tar | |
rm output.tar | |
ls -la . | |
UPLOAD=`ls .` | |
echo "Uploading $UPLOAD with label=${{ env.AC_LABEL }}" | |
$CONDA/bin/anaconda -t ${{ secrets.ANACONDA_ORG_TOKEN }} upload -u metagraph ${{ env.AC_LABEL }} --no-progress --force --no-register $UPLOAD |