Added support for script_env_variables
#1315
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 | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
paths: | |
- ".github/workflows/main.yml" | |
- "conda.recipe/**" | |
- "constructor/**" | |
- "examples/**" | |
- "scripts/**" | |
- "tests/**" | |
- "dev/**" | |
- "pyproject.toml" | |
- "setup.cfg" | |
- "setup.py" | |
concurrency: | |
# Concurrency group that uses the workflow name and PR number if available | |
# or commit SHA as a fallback. If a new build is triggered under that | |
# concurrency group while a previous build is running it will be canceled. | |
# Repeated pushes to a PR will cancel all previous builds, while multiple | |
# merges to main will not cancel. | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash -el {0} | |
jobs: | |
tests: | |
name: ${{ matrix.os }}, Python ${{ matrix.python-version }}, ${{ matrix.conda-standalone }} | |
runs-on: ${{ matrix.os }}-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# UBUNTU | |
- os: ubuntu | |
python-version: "3.8" | |
conda-standalone: conda-standalone | |
check-docs: true | |
- os: ubuntu | |
python-version: "3.9" | |
conda-standalone: conda-standalone | |
check-docs: true | |
- os: ubuntu | |
python-version: "3.10" | |
conda-standalone: conda-standalone-nightly | |
- os: ubuntu | |
python-version: "3.11" | |
conda-standalone: micromamba | |
# MACOS | |
- os: macos | |
python-version: "3.8" | |
conda-standalone: conda-standalone-nightly | |
# Not running for 3.9 to save some CI resources | |
# - os: macos | |
# python-version: "3.9" | |
# conda-standalone: conda-standalone | |
- os: macos | |
python-version: "3.10" | |
conda-standalone: micromamba | |
- os: macos | |
python-version: "3.11" | |
conda-standalone: conda-standalone | |
# WINDOWS | |
- os: windows | |
python-version: "3.8" | |
conda-standalone: conda-standalone | |
- os: windows | |
python-version: "3.9" | |
conda-standalone: conda-standalone-nightly | |
- os: windows | |
python-version: "3.10" | |
conda-standalone: conda-standalone | |
- os: windows | |
python-version: "3.11" | |
conda-standalone: conda-standalone-nightly | |
# Micromamba doesn't support Windows yet (menuinst features missing) | |
# - os: windows | |
# python-version: 3.11 | |
# conda-standalone: micromamba | |
env: | |
PYTHONUNBUFFERED: "1" | |
steps: | |
- name: Retrieve the source code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
activate-environment: constructor-dev | |
environment-file: dev/environment.yml | |
python-version: ${{ matrix.python-version }} | |
- name: Supply extra dependencies and install constructor | |
run: | | |
files=(--file "tests/requirements.txt") | |
test -f dev/extra-requirements-${{ matrix.os }}.txt \ | |
&& files+=(--file "dev/extra-requirements-${{ matrix.os }}.txt") | |
conda install ${files[@]} -y | |
echo "NSIS_USING_LOG_BUILD=1" >> $GITHUB_ENV | |
pip install -e . --no-deps --no-build-isolation | |
- name: Set up conda executable | |
run: | | |
if [[ "${{ matrix.conda-standalone }}" == "micromamba" ]]; then | |
conda create -yqp "${{ runner.temp }}/micromamba" -c conda-forge micromamba | |
if [[ ${{ matrix.os }} == "windows" ]]; then | |
echo "CONSTRUCTOR_CONDA_EXE=${{ runner.temp }}/micromamba/Library/bin/micromamba.exe" >> $GITHUB_ENV | |
else | |
echo "CONSTRUCTOR_CONDA_EXE=${{ runner.temp }}/micromamba/bin/micromamba" >> $GITHUB_ENV | |
fi | |
elif [[ "${{ matrix.conda-standalone }}" == "conda-standalone-nightly" ]]; then | |
conda create -yqp "${{ runner.temp }}/conda-standalone-nightly" -c conda-canary/label/dev conda-standalone | |
echo "CONSTRUCTOR_CONDA_EXE=${{ runner.temp }}/conda-standalone-nightly/standalone_conda/conda.exe" >> $GITHUB_ENV | |
else | |
conda activate constructor-dev | |
echo "CONSTRUCTOR_CONDA_EXE=$CONDA_PREFIX/standalone_conda/conda.exe" >> $GITHUB_ENV | |
fi | |
- name: Run unit tests | |
run: | | |
pytest -vv --cov=constructor --cov-branch tests/ -m "not examples" | |
coverage run --branch --append -m constructor -V | |
coverage json | |
- uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: unit | |
- name: Run examples | |
env: | |
CONSTRUCTOR_EXAMPLES_KEEP_ARTIFACTS: "${{ runner.temp }}/examples_artifacts" | |
# signtool only exists on Windows, but doesn't cause errors on unix when absent | |
CONSTRUCTOR_SIGNTOOL_PATH: "C:/Program Files (x86)/Windows Kits/10/bin/10.0.17763.0/x86/signtool.exe" | |
run: | | |
rm -rf coverage.json | |
pytest -vv --cov=constructor --cov-branch tests/test_examples.py | |
coverage run --branch --append -m constructor -V | |
coverage json | |
- uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: integration | |
- name: Test with conda-libmamba-solver | |
run: | | |
conda install -yq conda-libmamba-solver | |
CONDA_SOLVER=libmamba CONDA_VERBOSITY=1 pytest -vv tests/test_examples.py -k noconda | |
- name: Check docs are up-to-date | |
if: matrix.check-docs | |
run: | | |
python scripts/make_docs.py | |
git diff --exit-code | |
- name: Upload the example installers as artifacts | |
if: github.event_name == 'pull_request' && matrix.python-version == '3.9' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: installers-${{ runner.os }}-${{ github.sha }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} | |
path: "${{ runner.temp }}/examples_artifacts" | |
retention-days: 7 | |
build: | |
name: Canary Build | |
needs: [tests] | |
# only build canary build if | |
# only build canary build if | |
# - prior steps succeeded, | |
# - this is the main repo, and | |
# - we are on the main (or feature) branch | |
if: >- | |
success() | |
&& !github.event.repository.fork | |
&& ( | |
github.ref_name == 'main' | |
|| startsWith(github.ref_name, 'feature/') | |
) | |
strategy: | |
matrix: | |
include: | |
- runner: ubuntu-latest | |
subdir: linux-64 | |
- runner: macos-latest | |
subdir: osx-64 | |
- runner: windows-latest | |
subdir: win-64 | |
runs-on: ${{ matrix.runner }} | |
steps: | |
# Clean checkout of specific git ref needed for package metadata version | |
# which needs env vars GIT_DESCRIBE_TAG and GIT_BUILD_STR: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.ref }} | |
clean: true | |
fetch-depth: 0 | |
- name: Create and upload canary build | |
uses: conda/actions/[email protected] | |
with: | |
package-name: ${{ github.event.repository.name }} | |
subdir: ${{ matrix.subdir }} | |
anaconda-org-channel: conda-canary | |
anaconda-org-label: ${{ github.ref_name == 'main' && 'dev' || format('{0}-{1}', github.event.repository.name, github.ref_name) }} | |
anaconda-org-token: ${{ secrets.ANACONDA_ORG_CONDA_CANARY_TOKEN }} | |
conda-build-arguments: '--override-channels -c conda-forge -c defaults' |