Merge pull request #52 from IGNF/fix-docker-ghaction #52
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: cicd_full | |
on: | |
# Run tests for pull-requests on master | |
pull_request: | |
branches: | |
- master | |
# Also run when the pull request merges (which generates a push) | |
# So that we can tag the docker image appropriately. | |
push: | |
branches: | |
- dev | |
env: | |
IMAGE_NAME: ${{ github.repository }} | |
REGISTRY: ghcr.io | |
TEST_TAG: ${{ github.repository }}:test | |
jobs: | |
deploy_docker: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v4 | |
- name: Build the Docker image | |
id: build | |
uses: docker/build-push-action@v5 | |
with: | |
load: true | |
tags: ${{ env.TEST_TAG }} | |
# run the test on the docker image | |
- name: Run tests in docker image | |
run: > | |
docker run | |
--ipc=host | |
${{ env.TEST_TAG }} | |
python -m pytest ./test -s --log-cli-level DEBUG | |
test_local: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout branch | |
uses: actions/checkout@v3 | |
# See https://github.com/marketplace/actions/setup-micromamba | |
- name: setup-micromamba | |
uses: mamba-org/[email protected] | |
with: | |
micromamba-version: '1.5.8-0' # temporary fix as setup-mircomamba hangs with later mamba version | |
environment-file: environment.yml | |
environment-name: pdaltools # activate the environment | |
cache-environment: true | |
cache-downloads: true | |
generate-run-shell: true | |
- name: Run tests with pytest | |
shell: micromamba-shell {0} | |
run: python -m pytest ./test -s --log-cli-level DEBUG |