Skip to content

Bump actions/setup-python from 4 to 5 (#127) #88

Bump actions/setup-python from 4 to 5 (#127)

Bump actions/setup-python from 4 to 5 (#127) #88

Workflow file for this run

name: build
on:
push:
release:
types:
- published
workflow_call:
outputs:
date:
value: ${{ jobs.date.outputs.date }}
workflow_dispatch:
inputs:
upload_to_release:
description: upload exported files to a release of the current tag
required: false
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
defaults:
run:
shell: micromamba-shell {0}
jobs:
date:
name: get current 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:
name: build (py${{ matrix.python-version }}, ${{ matrix.runs-on }})
needs: [ date ]
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
runs-on: [ ubuntu-latest, macos-latest ]
python-version: [ '3.9', '3.10', '3.11' ]
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 }}
conda
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: conda env export --no-build | grep -v "name:" | grep -v "prefix:"
- run: pytest -n auto tests/test_import.py
version:
name: parse version from tag
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- uses: mtkennerly/dunamai-action@v1
id: version
with:
args: --pattern "(?P<base>\d+\.\d+\.\d+)"
export:
name: export (py${{ matrix.python-version }}, ${{ matrix.runs-on }})
needs: [ build, version, date ]
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
runs-on: [ ubuntu-latest, macos-latest ]
python-version: [ '3.9', '3.10', '3.11' ]
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 }}
conda
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.version.outputs.version }}.yaml" >> $GITHUB_OUTPUT
id: output
- run: conda env export --no-build | grep -v "name:" | grep -v "prefix:" > ${{ steps.output.outputs.filename }}
- run: cat ${{ steps.output.outputs.filename }}
- uses: actions/upload-artifact@v3
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 }}