-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (132 loc) · 4.92 KB
/
docker.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
---
name: docker build
on:
push:
branches: [main]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
USER_NAME: bids
REPO_NAME: cat12
IMAGE: /home/runner/work/Remi-Gau/cat12-container/docker
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# # cache tarred docker image to speed up build on follow up runs
# - uses: actions/cache@v4
# id: cache
# with:
# path: ${{ env.IMAGE }}/image.tar
# key: data
# - if: ${{ steps.cache.outputs.cache-hit != 'true' }}
# name: Load image
# run: docker load -i ${{ env.IMAGE }}/image.tar
- name: Build the Docker image
run: |
docker build . --tag ${{env.USER_NAME}}/${{env.REPO_NAME}}
- name: Check image size and version
run: |
docker images
docker run --rm ${{env.USER_NAME}}/${{env.REPO_NAME}} --version
- name: Run simple commands
run: |
docker run --rm ${{env.USER_NAME}}/${{env.REPO_NAME}} --help
docker run --rm ${{env.USER_NAME}}/${{env.REPO_NAME}} . /foo participant view segment --verbose 3
docker run --rm ${{env.USER_NAME}}/${{env.REPO_NAME}} . /foo participant copy segment --verbose 3
docker run --rm ${{env.USER_NAME}}/${{env.REPO_NAME}} . /foo participant segment --help
- name: Save docker image
run: |
mkdir -p ${{ env.IMAGE }}
docker save "${{env.USER_NAME}}/${{env.REPO_NAME}}" > "${{ env.IMAGE }}/image.tar"
- name: Upload docker artifacts
uses: actions/upload-artifact@v4
with:
name: docker
path: ${{ env.IMAGE }}
one-session:
runs-on: ubuntu-latest
strategy:
matrix:
type: [default, simple, enigma]
fail-fast: false
needs: docker-build
steps:
- name: Install dependencies
run: |
sudo apt-get -y -qq update
sudo apt-get -y install tree
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore docker image
uses: actions/download-artifact@v4
with:
name: docker
path: ${{ env.IMAGE }}
- name: Load image
run: docker load -i ${{ env.IMAGE }}/image.tar
- name: Get data
run: make tests/data/MoAEpilot
- name: Segment
run: |
docker run --rm \
-v ${PWD}/tests/data/MoAEpilot:/data \
${{env.USER_NAME}}/${{env.REPO_NAME}} \
/data /data/derivatives participant \
segment --verbose 3 --type ${{ matrix.type }}
tree ${PWD}/tests/data/
- name: Upload output artifact
uses: actions/upload-artifact@v4
with:
name: output_${{ matrix.type }}
path: /home/runner/work/cat12-container/cat12-container/tests/data/MoAEpilot/derivatives
two-sessions:
runs-on: ubuntu-latest
strategy:
matrix:
type: [long_0, long_2]
fail-fast: false
needs: docker-build
steps:
- name: Install python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
sudo apt-get -y -qq update
sudo apt-get -y install git-annex tree
pip install datalad
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Restore docker image
uses: actions/download-artifact@v4
with:
name: docker
path: ${{ env.IMAGE }}
- name: Load image
run: docker load -i ${{ env.IMAGE }}/image.tar
- name: Get data
run: make data_ds002799
- name: Segment
run: |
docker run --rm \
-v ${PWD}/tests/data/ds002799:/data \
${{env.USER_NAME}}/${{env.REPO_NAME}} \
/data /data/derivatives participant \
segment --verbose 3 --type ${{ matrix.type }} \
--participant_label 292 294 \
--skip_validation
tree ${PWD}/tests/data/
- name: Upload output artifact
uses: actions/upload-artifact@v4
with:
name: output_${{ matrix.type }}
path: /home/runner/work/cat12-container/cat12-container/tests/data/ds002799/derivatives