-
Notifications
You must be signed in to change notification settings - Fork 8
98 lines (86 loc) · 2.81 KB
/
build_test_push_images.yml
File metadata and controls
98 lines (86 loc) · 2.81 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Build, Test and Push changed Dockerfiles
on:
push:
branches:
- main
pull_request:
branches: [main]
types: [synchronize, opened, reopened, ready_for_review]
jobs:
prepare-matrix-jobs:
name: Prepare Build and Test Jobs
runs-on: "ubuntu-latest"
outputs:
has_changed_files: ${{ steps.changed-files.outputs.any_changed }}
sorters: ${{ steps.get-changed-sorters.outputs.sorters }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v23
with:
files: |
*/Dockerfile
files_ignore: |
hdsort-compiled/*
ironclust-compiled/*
kilosort_no_license/*
kilosort_with_license/*
spikeinterface-jupyterlab/*
tests/*
waveclus-compiled/*
- name: Prepare jobs matrix
id: get-changed-sorters
run: |
# sorters variable will be a JSON-like array
sorters="["
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
# Removing /Dockerfile from string
parsed=${file%*/Dockerfile*}
# Appending to final string
sorters+="\"${parsed}\", "
done
sorters=${sorters%*, *}
sorters+="]"
echo ${sorters}
echo "::set-output name=sorters::${sorters}"
build-and-test-image:
name: Build and Test (${{ matrix.sorter }})
if: needs.prepare-matrix-jobs.outputs.has_changed_files == 'true'
needs: prepare-matrix-jobs
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# "macos-latest", "windows-latest"
os: ["ubuntu-latest", ]
sorter: ${{ fromJSON(needs.prepare-matrix-jobs.outputs.sorters) }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
python-version: 3.8
- name: Build ${{ matrix.sorter }} Docker image
run: |
cd ${{ matrix.sorter }}
bash build.sh
- uses: eWaterCycle/setup-singularity@v7
with:
singularity-version: 3.8.3
- name: Install dependencies & Test ${{ matrix.sorter }} image
run: |
if [[ ${{ matrix.sorter }} == 'tridesclous' ]]; then
pip install tridesclous
fi
pip install -r requirements_test.txt
pytest -sv tests/test_singularity_containers.py::test_${{ matrix.sorter }}
- name: Docker login & Push image
if: github.ref == 'refs/heads/main'
env:
DOCKER_USER: ${{ secrets.DOCKER_USER }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: |
docker login -u $DOCKER_USER -p $DOCKER_PASSWORD
cd ${{ matrix.sorter }}
bash push.sh