|
1 | | -name: Demo |
| 1 | +--- |
| 2 | +name: Test Demo |
2 | 3 |
|
3 | | -on: [push, pull_request] |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: ["develop", "release/**"] |
| 7 | + pull_request: |
| 8 | + types: ["opened", "synchronize"] |
| 9 | + merge_group: |
4 | 10 |
|
5 | 11 | defaults: |
6 | 12 | run: |
7 | 13 | shell: bash |
8 | 14 |
|
9 | 15 | jobs: |
10 | 16 | build: |
11 | | - name: Build demo |
| 17 | + name: Build Demo |
| 18 | + uses: freedomofpress/actionslib/.github/workflows/oci-build.yaml@main |
| 19 | + with: |
| 20 | + context: "." |
| 21 | + tags: demo |
| 22 | + containerfile: securedrop/dockerfiles/noble/python3/DemoDockerfile |
| 23 | + |
| 24 | + test: |
| 25 | + name: Test Demo |
12 | 26 | runs-on: ubuntu-24.04 |
| 27 | + needs: |
| 28 | + - build |
13 | 29 | env: |
14 | 30 | DOCKERIZE_VERSION: v0.6.1 |
15 | 31 | steps: |
16 | 32 | - uses: actions/checkout@v5 |
17 | 33 | with: |
18 | 34 | persist-credentials: false |
19 | | - - name: Build container |
| 35 | + - name: Download artifact |
| 36 | + uses: actions/download-artifact@v5 |
| 37 | + with: |
| 38 | + name: ${{ needs.build.outputs.artifact-name }} |
| 39 | + - name: Restore container image |
| 40 | + env: |
| 41 | + IMAGE_FILE: ${{ needs.build.outputs.artifact-image }} |
20 | 42 | run: | |
21 | | - podman build -t demo -f securedrop/dockerfiles/noble/python3/DemoDockerfile . |
| 43 | + podman image load --input="${GITHUB_WORKSPACE}/${IMAGE_FILE}" |
22 | 44 | - name: Install dockerize |
23 | 45 | run: | |
24 | 46 | wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz |
25 | 47 | tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz |
26 | 48 | rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz |
27 | 49 | - name: Run container and verify it's up |
| 50 | + env: |
| 51 | + IMAGE: ${{ needs.build.outputs.image-url }} |
28 | 52 | run: | |
29 | 53 | function debug() { |
30 | 54 | # Dump container logs on failure |
31 | 55 | podman logs demo |
32 | 56 | exit 1 |
33 | 57 | } |
34 | 58 | # Start the container in the background |
35 | | - podman run --name=demo -d -t -p 8080:8080 -p 8081:8081 demo |
| 59 | + podman run --name=demo -d -t -p 8080:8080 -p 8081:8081 "${IMAGE}" |
36 | 60 | # And wait for both ports to be up! |
37 | 61 | dockerize -wait http://127.0.0.1:8080 -timeout 2m || debug |
38 | 62 | dockerize -wait http://127.0.0.1:8081 -timeout 2m || debug |
0 commit comments