|
| 1 | +name: Docker Compose CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + branches: |
| 9 | + - main |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + |
| 14 | +jobs: |
| 15 | + check-docker-compose: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Check out Git repository |
| 19 | + uses: actions/checkout@v6 |
| 20 | + |
| 21 | + - name: build |
| 22 | + shell: bash |
| 23 | + run: | |
| 24 | + if ! docker compose build; then |
| 25 | + echo 'ERROR: docker compose build failed' |
| 26 | + fi |
| 27 | +
|
| 28 | + - name: dbinitcheck |
| 29 | + shell: bash |
| 30 | + run: | |
| 31 | + if ! docker compose up \ |
| 32 | + --exit-code-from dbinit \ |
| 33 | + db dbinit |
| 34 | + then |
| 35 | + echo 'ERROR: dbinit first execution did not exit with 0' |
| 36 | + exit 1 |
| 37 | + fi |
| 38 | +
|
| 39 | + if ! docker compose up \ |
| 40 | + --exit-code-from dbinit \ |
| 41 | + db dbinit |
| 42 | + then |
| 43 | + echo 'ERROR: dbinit second execution did not exit with 0' |
| 44 | + exit 1 |
| 45 | + fi |
| 46 | +
|
| 47 | + if ! docker compose down; then |
| 48 | + echo 'ERROR: docker compose down failed' |
| 49 | + fi |
| 50 | +
|
| 51 | + - name: dbreadonlycheck |
| 52 | + shell: bash |
| 53 | + run: | |
| 54 | + if ! COMPOSE_PROFILES=ci docker compose up \ |
| 55 | + --exit-code-from dbreadonlycheck \ |
| 56 | + dbreadonlycheck |
| 57 | + then |
| 58 | + echo 'ERROR: dbreadonlycheck did not exit with 0' |
| 59 | + exit 1 |
| 60 | + fi |
| 61 | +
|
| 62 | + if ! docker compose down; then |
| 63 | + echo 'ERROR: docker compose down failed' |
| 64 | + fi |
| 65 | +
|
| 66 | + - name: sites-smoke-test |
| 67 | + shell: bash |
| 68 | + run: | |
| 69 | + if ! docker compose up --wait; then |
| 70 | + echo 'ERROR: docker compose up --wait did not exit with 0' |
| 71 | + exit 1 |
| 72 | + fi |
| 73 | +
|
| 74 | + if ! curl --fail http://127.0.0.1:3001; then |
| 75 | + echo 'ERROR: partners site is not accessible. Logs:' |
| 76 | + docker compose logs partners |
| 77 | + exit 1 |
| 78 | + fi |
| 79 | +
|
| 80 | + if ! curl --fail http://127.0.0.1:3000; then |
| 81 | + echo 'ERROR: public site is not accessible. Logs:' |
| 82 | + docker compose logs public |
| 83 | + exit 1 |
| 84 | + fi |
| 85 | +
|
| 86 | + if ! docker compose down; then |
| 87 | + echo 'ERROR: docker compose down failed' |
| 88 | + exit 1 |
| 89 | + fi |
0 commit comments