|
9 | 9 | distro: |
10 | 10 | required: true |
11 | 11 | type: string |
12 | | - with_datadog: |
| 12 | + with_datadog_profiling: |
13 | 13 | required: true |
14 | 14 | type: boolean |
15 | 15 |
|
16 | 16 | # Adapted from https://docs.docker.com/build/ci/github-actions/multi-platform/#distribute-build-across-multiple-runners |
17 | 17 | jobs: |
18 | 18 | build-docker: |
19 | | - name: Build Docker image for ${{ inputs.distro }} on ${{ matrix.platform }} (DD ${{ inputs.with_datadog }}) |
| 19 | + name: Build Docker image for ${{ inputs.distro }} on ${{ matrix.platform }} (DD ${{ inputs.with_datadog_profiling }}) |
20 | 20 | # We use a custom runner for ARM64 builds. |
21 | 21 | runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-22.04' || 'ubuntu-22.04-arm' }} |
22 | 22 | strategy: |
|
31 | 31 | env: |
32 | 32 | DATABASE_URL: postgresql://postgres:postgres@localhost/nittei |
33 | 33 |
|
34 | | - services: |
35 | | - postgres: |
36 | | - image: postgres:13 |
37 | | - env: |
38 | | - POSTGRES_PASSWORD: postgres |
39 | | - POSTGRES_DB: nittei |
40 | | - ports: |
41 | | - - 5432:5432 |
42 | | - |
43 | 34 | steps: |
44 | 35 | - name: Prepare |
45 | 36 | run: | |
@@ -74,35 +65,13 @@ jobs: |
74 | 65 | id: build |
75 | 66 | uses: docker/build-push-action@v6 |
76 | 67 | with: |
77 | | - file: "./${{ inputs.distro }}${{ inputs.with_datadog && 'WithDD' || '' }}.Dockerfile" |
| 68 | + file: "./${{ inputs.distro }}${{ inputs.with_datadog_profiling && 'WithDD' || '' }}.Dockerfile" |
78 | 69 | platforms: ${{ matrix.platform }} |
79 | | - # This is for the Alpine image |
| 70 | + # Handle the correct arch |
80 | 71 | build-args: | |
81 | 72 | ARCH=${{ matrix.platform == 'linux/amd64' && 'x86_64' || 'aarch64' }} |
82 | | - labels: ${{ steps.meta.outputs.labels }} |
83 | 73 | outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true |
84 | 74 |
|
85 | | - - name: Test image |
86 | | - run: | |
87 | | -
|
88 | | - # Test the image by running a container from it, linking to the host network, and running the JS tests |
89 | | - docker run --rm -e DATABASE_URL=$DATABASE_URL -e NITTEI__HTTP_PORT=5000 -e NITTEI__DATABASE_URL=$DATABASE_URL -p 5000:5000 --network host --name nittei-test ${{ steps.build.outputs.image }} |
90 | | -
|
91 | | - # Wait for the server to start |
92 | | - sleep 5 |
93 | | -
|
94 | | - - name: Run tests |
95 | | - run: | |
96 | | -
|
97 | | - # Run the tests |
98 | | - cd clients/javascript |
99 | | - pnpm i |
100 | | - pnpm run test |
101 | | -
|
102 | | - - name: Stop test container |
103 | | - run: | |
104 | | - docker stop nittei-test |
105 | | -
|
106 | 75 | - name: Export digest |
107 | 76 | run: | |
108 | 77 | mkdir -p /tmp/digests |
@@ -153,13 +122,13 @@ jobs: |
153 | 122 | # For alpine with DD: alpine-dd-latest, alpine-dd, alpine-dd-1.0.0 |
154 | 123 |
|
155 | 124 | if [[ "${{ inputs.distro }}" == "debian" ]]; then |
156 | | - if [[ "${{ inputs.with_datadog }}" == "true" ]]; then |
| 125 | + if [[ "${{ inputs.with_datadog_profiling }}" == "true" ]]; then |
157 | 126 | echo "TAGS=dd-latest, debian-dd, dd-${{ env.VERSION }}" >> $GITHUB_ENV |
158 | 127 | else |
159 | 128 | echo "TAGS=latest, debian, ${{ env.VERSION }}" >> $GITHUB_ENV |
160 | 129 | fi |
161 | 130 | elif [[ "${{ inputs.distro }}" == "alpine" ]]; then |
162 | | - if [[ "${{ inputs.with_datadog }}" == "true" ]]; then |
| 131 | + if [[ "${{ inputs.with_datadog_profiling }}" == "true" ]]; then |
163 | 132 | echo "TAGS=alpine-dd-latest, alpine-dd, alpine-dd-${{ env.VERSION }}" >> $GITHUB_ENV |
164 | 133 | else |
165 | 134 | echo "TAGS=alpine-latest, alpine, alpine-${{ env.VERSION }}" >> $GITHUB_ENV |
|
0 commit comments