Skip to content

Commit 8029369

Browse files
committed
Simply docker usage on CI
1 parent 33302b3 commit 8029369

File tree

4 files changed

+17
-179
lines changed

4 files changed

+17
-179
lines changed

.github/actions/launch_stack.sh

Lines changed: 0 additions & 35 deletions
This file was deleted.

.github/actions/tests.sh

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 16 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# TODO use anchor when supported https://github.community/t/support-for-yaml-anchors/16128/81
2-
name: Docker Image CI
3-
41
on:
52
push:
63
branches: [master, dev]
@@ -94,7 +91,8 @@ jobs:
9491
runs-on: ubuntu-latest
9592
env:
9693
OPTIONS: "COV=false LOG_LEVEL=info SKIP_DICHO=true SKIP_REAL_CASES=true SKIP_PERIODIC=true SKIP_SPLIT_CLUSTERING=true"
97-
steps:
94+
TIMEOUT: 10m
95+
steps: &test_steps
9896
- name: Checkout
9997
uses: actions/checkout@v4
10098
- name: Download Docker image
@@ -105,171 +103,57 @@ jobs:
105103
- name: Load Docker image
106104
run: docker load --input /tmp/optimizer-api.tar
107105
- name: Launch Stack
108-
timeout-minutes: 4
109-
env:
110-
COMPOSE_FILE: ./docker/docker-compose.test.yml
111-
run: ./.github/actions/launch_stack.sh
112-
shell: bash
106+
run: timeout 4m docker compose -f ./docker/docker-compose.test.yml up --wait
113107
- name: Starting tests
114-
timeout-minutes: 10
115-
run: ./.github/actions/tests.sh
116-
shell: bash
108+
run: timeout ${TIMEOUT} docker compose -f ./docker/docker-compose.test.yml exec api rake test TESTOPTS="${TESTOPTS}" ${OPTIONS}
117109

118110
test_dicho:
119111
needs: build
120112
runs-on: ubuntu-latest
121113
env:
122114
OPTIONS: "COV=false LOG_LEVEL=info TEST=test/lib/heuristics/dichotomous_test.rb"
123-
steps:
124-
- name: Checkout
125-
uses: actions/checkout@v4
126-
- name: Download Docker image
127-
uses: actions/download-artifact@v4
128-
with:
129-
name: docker-image
130-
path: /tmp
131-
- name: Load Docker image
132-
run: docker load --input /tmp/optimizer-api.tar
133-
- name: Launch Stack
134-
timeout-minutes: 4
135-
env:
136-
COMPOSE_FILE: ./docker/docker-compose.test.yml
137-
run: ./.github/actions/launch_stack.sh
138-
shell: bash
139-
- name: Starting tests
140-
timeout-minutes: 20
141-
run: ./.github/actions/tests.sh
142-
shell: bash
115+
TIMEOUT: 20m
116+
steps: *test_steps
143117

144118
test_real:
145119
needs: build
146120
runs-on: ubuntu-latest
147121
env:
148122
OPTIONS: "COV=false LOG_LEVEL=info TEST=test/real_cases_test.rb"
149-
steps:
150-
- name: Checkout
151-
uses: actions/checkout@v4
152-
- name: Download Docker image
153-
uses: actions/download-artifact@v4
154-
with:
155-
name: docker-image
156-
path: /tmp
157-
- name: Load Docker image
158-
run: docker load --input /tmp/optimizer-api.tar
159-
- name: Launch Stack
160-
env:
161-
COMPOSE_FILE: ./docker/docker-compose.test.yml
162-
timeout-minutes: 4
163-
run: ./.github/actions/launch_stack.sh
164-
shell: bash
165-
- name: Starting tests
166-
timeout-minutes: 10
167-
run: ./.github/actions/tests.sh
168-
shell: bash
123+
TIMEOUT: 10m
124+
steps: *test_steps
169125

170126
test_real_periodic:
171127
needs: build
172128
runs-on: ubuntu-latest
173129
env:
174130
OPTIONS: "COV=false LOG_LEVEL=info TEST=test/real_cases_periodic_test.rb"
175-
steps:
176-
- name: Checkout
177-
uses: actions/checkout@v4
178-
- name: Download Docker image
179-
uses: actions/download-artifact@v4
180-
with:
181-
name: docker-image
182-
path: /tmp
183-
- name: Load Docker image
184-
run: docker load --input /tmp/optimizer-api.tar
185-
- name: Launch Stack
186-
env:
187-
COMPOSE_FILE: ./docker/docker-compose.test.yml
188-
timeout-minutes: 4
189-
run: ./.github/actions/launch_stack.sh
190-
shell: bash
191-
- name: Starting tests
192-
timeout-minutes: 10
193-
run: ./.github/actions/tests.sh
194-
shell: bash
131+
TIMEOUT: 10m
132+
steps: *test_steps
195133

196134
test_real_periodic_solver:
197135
needs: build
198136
runs-on: ubuntu-latest
199137
env:
200138
OPTIONS: "COV=false LOG_LEVEL=info TEST=test/real_cases_periodic_solver_test.rb"
201-
steps:
202-
- name: Checkout
203-
uses: actions/checkout@v4
204-
- name: Download Docker image
205-
uses: actions/download-artifact@v4
206-
with:
207-
name: docker-image
208-
path: /tmp
209-
- name: Load Docker image
210-
run: docker load --input /tmp/optimizer-api.tar
211-
- name: Launch Stack
212-
env:
213-
COMPOSE_FILE: ./docker/docker-compose.test.yml
214-
timeout-minutes: 4
215-
run: ./.github/actions/launch_stack.sh
216-
shell: bash
217-
- name: Starting tests
218-
timeout-minutes: 25
219-
run: ./.github/actions/tests.sh
220-
shell: bash
139+
TIMEOUT: 25m
140+
steps: *test_steps
221141

222142
test_periodic:
223143
needs: build
224144
runs-on: ubuntu-latest
225145
env:
226146
OPTIONS: "COV=false LOG_LEVEL=info TEST=test/lib/heuristics/periodic_*"
227-
steps:
228-
- name: Checkout
229-
uses: actions/checkout@v4
230-
- name: Download Docker image
231-
uses: actions/download-artifact@v4
232-
with:
233-
name: docker-image
234-
path: /tmp
235-
- name: Load Docker image
236-
run: docker load --input /tmp/optimizer-api.tar
237-
- name: Launch Stack
238-
env:
239-
COMPOSE_FILE: ./docker/docker-compose.test.yml
240-
timeout-minutes: 4
241-
run: ./.github/actions/launch_stack.sh
242-
shell: bash
243-
- name: Starting tests
244-
timeout-minutes: 3
245-
run: ./.github/actions/tests.sh
246-
shell: bash
147+
TIMEOUT: 3m
148+
steps: *test_steps
247149

248150
test_split_clustering:
249151
needs: build
250152
runs-on: ubuntu-latest
251153
env:
252154
OPTIONS: "COV=false LOG_LEVEL=info TEST=test/lib/interpreters/split_clustering_test.rb"
253-
steps:
254-
- name: Checkout
255-
uses: actions/checkout@v4
256-
- name: Download Docker image
257-
uses: actions/download-artifact@v4
258-
with:
259-
name: docker-image
260-
path: /tmp
261-
- name: Load Docker image
262-
run: docker load --input /tmp/optimizer-api.tar
263-
- name: Launch Stack
264-
env:
265-
COMPOSE_FILE: ./docker/docker-compose.test.yml
266-
timeout-minutes: 4
267-
run: ./.github/actions/launch_stack.sh
268-
shell: bash
269-
- name: Starting tests
270-
timeout-minutes: 25
271-
run: ./.github/actions/tests.sh
272-
shell: bash
155+
TIMEOUT: 25m
156+
steps: *test_steps
273157

274158
docker:
275159
runs-on: ubuntu-latest

docker/docker-compose.test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ services:
2828
QUEUES: DEFAULT
2929
command: bundle exec rake resque:workers --trace
3030
healthcheck:
31-
disable: true
31+
test: echo ok
3232

3333
redis-resque:
3434
image: redis:${REDIS_VERSION:-7-alpine}

0 commit comments

Comments
 (0)