Skip to content

build

build #141

Workflow file for this run

name: build
on:
workflow_call:
outputs:
date:
value: ${{ jobs.date.outputs.date }}
workflow_dispatch:
push:
release:
types:
- published
concurrency:
group: build-${{ github.ref }}
defaults:
run:
shell: micromamba-shell {0}
jobs:
date:
runs-on: ubuntu-latest
steps:
- run: echo "date=$(date +%Y.%m.%d)" >> $GITHUB_OUTPUT
id: date
shell: bash
outputs:
date: ${{ steps.date.outputs.date }}
build:
needs: [ date ]
strategy:
fail-fast: false
matrix:
# the macOS 13 runner is on Intel hardware
runs-on: [ ubuntu-latest, macos-13, macos-latest ]
python-version: [ '3.10', '3.11', '3.12' ]
runs-on: ${{ matrix.runs-on }}
name: build (Python ${{ matrix.python-version }}, ${{ matrix.runs-on }})
steps:
- uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v1
with:
environment-name: stenv-${{ runner.os }}-py${{ matrix.python-version }}
environment-file: environment.yaml
create-args: >-
python=${{ matrix.python-version }}
cache-downloads: true
cache-downloads-key: downloads-${{ needs.date.outputs.date }}
cache-environment: true
cache-environment-key: environment-${{ needs.date.outputs.date }}
init-shell: none
generate-run-shell: true
- run: echo "filename=stenv-${{ runner.os }}-${{ runner.arch }}-py${{ matrix.python-version }}-${{ needs.date.outputs.date }}.yaml" >> $GITHUB_OUTPUT
id: output
- run: |
micromamba env export --no-build | grep -v "name:" | grep -v "prefix:" > ${{ steps.output.outputs.filename }}
pip freeze > pip_requirements.txt
python tools/mamba_export_pip.py ${{ steps.output.outputs.filename }} pip_requirements.txt > mamba_packages.yml
mv mamba_packages.yml ${{ steps.output.outputs.filename }}
cat ${{ steps.output.outputs.filename }}
- run: pip install pytest pytest-xdist
- run: pytest -n auto tests/test_import.py
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.output.outputs.filename }}
path: ${{ steps.output.outputs.filename }}
- if: (github.event_name == 'release' && github.event.action == 'published')
uses: svenstaro/upload-release-action@v2
with:
file: ${{ steps.output.outputs.filename }}