Skip to content

Commit 1d38d69

Browse files
committed
create build and test pipeline
1 parent 21266c7 commit 1d38d69

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/test.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Test pipeline
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
11+
build:
12+
runs-on: ubuntu-latest
13+
outputs:
14+
image_tag: ${{ steps.set_image_tag.outputs.image_tag }}
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up environment variables
19+
id: set_image_tag
20+
run: echo "::set-output name=image_tag::$(date +%s)"
21+
- name: Build the Docker image
22+
run: docker build . --file Dockerfile --tag dhgen:${{ steps.set_image_tag.outputs.image_tag }}
23+
- name: Save Docker image as artifact
24+
run: docker save dhgen:${{ steps.set_image_tag.outputs.image_tag }} -o dhgen.tar
25+
- name: Upload Docker image artifact
26+
uses: actions/upload-artifact@v3
27+
with:
28+
name: dhgen-image
29+
path: dhgen.tar
30+
31+
test:
32+
runs-on: ubuntu-latest
33+
needs: build
34+
35+
steps:
36+
- name: Download Docker image artifact
37+
uses: actions/download-artifact@v3
38+
with:
39+
name: dhgen-image
40+
- name: Load Docker image
41+
run: docker load -i dhgen.tar
42+
- name: Run the tests
43+
run: docker run --rm dhgen:${{ needs.build.outputs.image_tag }} python -m unittest discover -s tests

0 commit comments

Comments
 (0)