Skip to content

Implement support for job's input and output directories in PMAN's API #237

Implement support for job's input and output directories in PMAN's API

Implement support for job's input and output directories in PMAN's API #237

Workflow file for this run

# Run nose tests and CUBE integration tests.
# If both pass, build a multi-architectural docker image and push
# it to Dockerhub. When the git ref is tagged, the docker image
# will be tagged by the same name.
name: ci
on:
push:
branches: [ master ]
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
pull_request:
branches: [ master ]
jobs:
test-python:
name: unit tests
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install
run: |
pip install -r requirements/local.txt
pip install -e .
- name: Pytest
run: pytest --color=yes
test-docker:
name: tests (docker, podman)
runs-on: ubuntu-22.04
strategy:
matrix:
engine:
- docker
- podman
steps:
- uses: actions/checkout@v3
- name: Test
run: |
# podman is not configured to allow the Github Actions user to set CPU limits, so we need to ignore them.
# https://github.com/containers/podman/blob/main/troubleshooting.md#26-running-containers-with-resource-limits-fails-with-a-permissions-error
if [ '${{ matrix.engine }}' = 'podman' ]; then
export IGNORE_LIMITS=yes
fi
./test_docker.sh '${{ matrix.engine }}'
test-swarm:
name: tests (swarm)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run: ./test_swarm.sh
test-cube:
name: tests (integration)
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- run: docker build -t fnndsc/pman .
- uses: FNNDSC/cube-integration-action@master
build:
needs: [test-python, test-docker, test-swarm, test-cube]
if: github.event_name == 'push' || github.event_name == 'release'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: "0"
- name: Get build version
id: version
run: |
desc="$(git describe --tags)"
echo "Version=$desc"
echo "desc=$desc" >> $GITHUB_OUTPUT
- name: Get build tags
id: info
shell: python
run: |
import os
import datetime
import itertools
import subprocess as sp
short_sha = os.getenv('GITHUB_SHA', 'unknown')[:7]
git_refs = []
if os.getenv('GITHUB_REF', '').startswith('refs/tags/v'):
version_from_tag = os.getenv('GITHUB_REF')[11:]
git_refs.append(version_from_tag.replace('+', '.'))
registries = ['docker.io', 'ghcr.io']
repo = os.environ['GITHUB_REPOSITORY'].lower()
tags = ['latest'] + git_refs
names = ','.join(''.join(c) for c in itertools.product(
(r + '/' for r in registries),
[repo],
(':' + t for t in tags)
))
with open(os.getenv('GITHUB_OUTPUT'), 'a') as f:
f.write(f'tags={names}\n')
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
id: buildx
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3
with:
build-args: |
ENVIRONMENT=production
BUILD_VERSION=${{ steps.version.outputs.desc }}
push: true
context: .
file: ./Dockerfile
tags: "${{ steps.info.outputs.tags }}"
platforms: linux/amd64,linux/ppc64le,linux/arm64
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
- name: Update Docker Hub description
uses: peter-evans/dockerhub-description@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
short-description: ChRIS compute resource job dispatcher
readme-filepath: ./README.md
repository: fnndsc/pman