This repository has been archived by the owner on Jan 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
80 lines (69 loc) · 2.94 KB
/
wdl-ci-integration.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Integration Tests
on:
push
env:
LC_ALL: C.UTF-8
LANG: C.UTF-8
DEBIAN_FRONTEND: noninteractive
jobs:
cancel-previous:
runs-on: self-hosted
steps:
- uses: styfle/cancel-workflow-action@0.9.0
with:
access_token: ${{ github.token }}
list-workflow-dirs:
runs-on: self-hosted
outputs:
matrix: ${{steps.list_dirs.outputs.matrix}}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- id: list_dirs
# only run on wdl dirs with diff
run: echo "::set-output name=matrix::$(ls */*.wdl|xargs dirname|xargs git diff --name-status HEAD^|cut -c 3-|xargs dirname|sed 's/\/.*$//g'|sort|uniq|jq -cnR '[inputs|select(length>0)]')"
wdl-ci:
runs-on: self-hosted
needs: list-workflow-dirs
strategy:
matrix:
workflow_dir: ${{fromJson(needs['list-workflow-dirs'].outputs.matrix)}}
steps:
- uses: actions/checkout@v2
- name: docker build + push to ghcr.io
run: |
TAG=$(git describe --long --tags --always --dirty)
IMAGE_NAME=idseq-${{ matrix.workflow_dir }}-public
IMAGE_URI="ghcr.io/${GITHUB_REPOSITORY}/${IMAGE_NAME}"
CACHE_FROM=""; docker pull "$IMAGE_URI" && CACHE_FROM="--cache-from $IMAGE_URI"
docker build "${{ matrix.workflow_dir }}" --tag "${IMAGE_URI}:${TAG}" $CACHE_FROM \
|| docker build "${{ matrix.workflow_dir }}" --tag "${IMAGE_URI}:${TAG}"
# docker push "${IMAGE_URI}:${TAG}" don't push while testing
if [[ ${GITHUB_REF##*/} == "main" ]]; then
docker tag "${IMAGE_URI}:${TAG}" "${IMAGE_URI}:latest"
# docker push "${IMAGE_URI}:latest" don't push while testing
fi
echo "IMAGE_URI=${IMAGE_URI}" >> $GITHUB_ENV
echo "TAG=${TAG}" >> $GITHUB_ENV
- name: run tests
run: |
[ -d "${{ matrix.workflow_dir }}/integration_test" ] || exit 0
source /etc/profile
# explicitly block EC2 IMDS endpoint to work around awscli issue:
# https://github.com/aws/aws-cli/issues/5234#issuecomment-635459464
# https://github.com/aws/aws-cli/issues/5262
# configure miniwdl to auto-delete task working directories, to reduce chance of worker
# running out of space
export MINIWDL__FILE_IO__OUTPUT_HARDLINKS=true
export MINIWDL__FILE_IO__DELETE_WORK=success
export MINIWDL__DOWNLOAD_CACHE__GET=true
export MINIWDL__DOWNLOAD_CACHE__PUT=true
export MINIWDL__DOWNLOAD_CACHE__DIR=/tmp/miniwdl_download_cache_workflows/
sudo apt-get -qq update
sudo apt-get -qq install --yes jq moreutils make virtualenv zip unzip httpie git shellcheck
virtualenv --python=python3.8 .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
export DOCKER_IMAGE_ID="${IMAGE_URI}:${TAG}"
make integration-test-${{ matrix.workflow_dir }}