Bump test dependencies #89
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
--- | |
# Build and test the ATMOSPEC Docker image on every push and pull request. | |
# Publishes Docker images to Github Container Repository (ghcr.io), | |
# and runs the automated tests with pytest. | |
name: CI | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- "*" | |
pull_request: | |
branches: | |
- main | |
env: | |
REGISTRY: ghcr.io/ | |
ISPG_IMAGE: ${{ github.repository_owner }}/atmospec | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
permissions: | |
packages: write | |
contents: read | |
outputs: | |
image_digest: ${{ steps.build.outputs.digest }} | |
steps: | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}${{ env.ISPG_IMAGE }} | |
# Before tests pass, we tag the image by 'tip' to indicate latest build, | |
# and by pull request number, e.g. pr-11 | |
# https://github.com/docker/metadata-action#tags-input | |
# See the release workflow for the release tags. | |
# TODO: Figure out a better solution rather than using 'tip' tag | |
tags: | | |
type=raw,value=tip # Must be here so we have at least one tag | |
type=ref,event=pr | |
- name: Build image | |
id: build | |
uses: docker/build-push-action@v3 | |
with: | |
tags: ${{ steps.meta.outputs.tags }} | |
push: true | |
test: | |
needs: build | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
permissions: | |
packages: read | |
contents: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Python test environment | |
uses: mamba-org/provision-with-micromamba@v13 | |
with: | |
cache-env: true | |
- name: Run tests | |
shell: bash -l {0} # required to activate the conda environment | |
run: pytest -vs | |
env: | |
# Image that was build in the build workflow | |
ISPG_IMAGE: ${{ env.ISPG_IMAGE }}@${{ needs.build.outputs.image_digest }} | |
release: | |
if: >- | |
github.repository == 'ispg-group/aiidalab-ispg-docker-stack' | |
&& (github.ref_type == 'tag' || github.ref_name == 'main') | |
needs: | |
- build | |
- test | |
permissions: | |
packages: write | |
contents: write | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}${{ env.ISPG_IMAGE }} | |
tags: | | |
type=edge | |
type=raw,value={{tag}},enable=${{ github.ref_type == 'tag' && ! startsWith(github.ref_name, 'v') }} | |
type=match,pattern=v(\d{4}\.\d{2}.\d+(-.+)?),group=1 | |
- name: Release image | |
uses: akhilerm/[email protected] | |
with: | |
src: ${{ env.REGISTRY }}${{ env.ISPG_IMAGE }}@${{ needs.build.outputs.image_digest }} | |
dst: ${{ steps.meta.outputs.tags }} | |
- uses: softprops/[email protected] | |
name: Create release | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
generate_release_notes: true |