-
Notifications
You must be signed in to change notification settings - Fork 7
81 lines (70 loc) · 3.06 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
81
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, idseq-dev]
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
list-workflow-dirs:
runs-on: [self-hosted, idseq-dev]
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 "matrix=$(./scripts/diff-workflows.sh |jq -cnR '[inputs|select(length>0)]')" >> $GITHUB_OUTPUT
wdl-ci:
runs-on: [self-hosted, idseq-dev]
needs: list-workflow-dirs
if: ${{ needs['list-workflow-dirs'].outputs.matrix != '[]' && needs['list-workflow-dirs'].outputs.matrix != '' }}
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=czid-${{ matrix.workflow_dir }}-public
IMAGE_URI="ghcr.io/${GITHUB_REPOSITORY}/${IMAGE_NAME}"
CACHE_FROM=""; docker pull "$IMAGE_URI" && CACHE_FROM="--cache-from $IMAGE_URI"
./scripts/docker-build.sh "workflows/${{ matrix.workflow_dir }}" --tag "${IMAGE_URI}:${TAG}" $CACHE_FROM \
|| ./scripts/docker-build.sh "workflows/${{ 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.10 .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
export DOCKER_IMAGE_ID="${IMAGE_URI}:${TAG}"
make integration-test-${{ matrix.workflow_dir }}