mirror of
https://github.com/OpenFreeEnergy/openfe.git
synced 2026-06-04 14:14:22 +08:00
89 lines
2.7 KiB
YAML
89 lines
2.7 KiB
YAML
name: "cron: docker image daily tests"
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
schedule:
|
|
# nightly tests
|
|
- cron: "0 14 * * 0"
|
|
|
|
workflow_dispatch:
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash -leo pipefail {0}
|
|
|
|
env:
|
|
REGISTRY: ghcr.io
|
|
IMAGE_NAME: openfreeenergy/openfe
|
|
|
|
jobs:
|
|
build-and-push-image:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Use dev tag for nightly builds
|
|
id: latest-version
|
|
run: |
|
|
VERSION=dev
|
|
echo $VERSION
|
|
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
|
|
|
|
- name: Print Latest Version
|
|
run: echo ${{ steps.latest-version.outputs.VERSION }}
|
|
|
|
- name: Create fully qualified image registry path
|
|
id: fqirp
|
|
run: |
|
|
FQIRP=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.latest-version.outputs.VERSION }}
|
|
echo "FQIRP=$FQIRP" >> $GITHUB_OUTPUT
|
|
|
|
- name: Print FQIRP
|
|
run: echo ${{ steps.fqirp.outputs.FQIRP }}
|
|
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
|
|
with:
|
|
registry: ${{ env.REGISTRY }}
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
|
|
with:
|
|
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
|
tags: |
|
|
type=schedule,pattern=nightly,enable=true,priority=1000
|
|
type=ref,event=branch,enable=true,priority=600
|
|
type=ref,event=tag,enable=true,priority=600
|
|
type=ref,event=pr,prefix=pr-,enable=true,priority=600
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=semver,pattern={{version}}
|
|
type=sha
|
|
${{ steps.latest-version.outputs.VERSION }}
|
|
|
|
- name: Build and export to Docker
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: production/Dockerfile
|
|
load: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
- name: Test image
|
|
run: |
|
|
docker run --rm ${{ steps.fqirp.outputs.FQIRP }} openfe --help
|
|
docker run --rm ${{ steps.fqirp.outputs.FQIRP }} openfe --version
|
|
docker run --rm ${{ steps.fqirp.outputs.FQIRP }} python -c "import gufe; print(f'{gufe.__version__=}')"
|
|
docker run --rm ${{ steps.fqirp.outputs.FQIRP }} pytest --pyargs gufe -v
|
|
docker run --rm ${{ steps.fqirp.outputs.FQIRP }} pytest --pyargs openfe -v
|