Skip to content

Commit

Permalink
ci: First stab on Docker tests
Browse files Browse the repository at this point in the history
  • Loading branch information
garberg committed Jun 13, 2024
1 parent 5c5d27b commit 410b184
Showing 1 changed file with 50 additions and 10 deletions.
60 changes: 50 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
env:
ACTIONS_RUNNER_DEBUG: true
ACTIONS_STEP_DEBUG: true
NIPAPD_CI_TAG: nipap/nipapd:ci
WWW_CI_TAG: nipap/nipap-www:ci

jobs:
test:
Expand All @@ -27,16 +29,6 @@ jobs:
- name: "Check out NIPAP repository"
uses: actions/checkout@v2

- name: "Hadolint nipapd"
uses: hadolint/[email protected]
with:
Dockerfile: Dockerfile.nipapd

- name: "Hadolint WWW"
uses: hadolint/[email protected]
with:
Dockerfile: Dockerfile.www

- name: "Install dependencies and prepare NIPAP"
run: |
# Set up NIPAP repo
Expand Down Expand Up @@ -175,3 +167,51 @@ jobs:
sudo cat /var/log/syslog || true
sudo cat /var/log/postgresql/postgresql-*-main.log || true
sudo cat /tmp/nipap.log || true
docker:
name: "Test Docker deployment"
runs-on: ubuntu-22.04
steps:

- name: "Set up QEMU"
uses: docker/setup-qemu-action@v3

- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v3

- name: "Hadolint nipapd"
uses: hadolint/[email protected]
with:
Dockerfile: Dockerfile.nipapd

- name: "Hadolint WWW"
uses: hadolint/[email protected]
with:
Dockerfile: Dockerfile.www

- name: "Build nipapd Docker image"
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.nipapd
load: true
tags: ${{ env.NIPAPD_CI_TAG }}
push: false

- name: "Build www Docker image"
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.www
load: true
tags: ${{ env.WWW_CI_TAG }}
push: false

- name: "Run Docker test suite"
run: |
# Set up database
sudo su -c "cd nipap/sql; PGPASSWORD=papin make install" postgres
docker run --network=host --rm -d --name=nipapd_ci -e DB_HOST=127.0.0.1 -e DB_USERNAME=nipap -e DB_PASSWORD=papin ${{ env.NIPAPD_CI_TAG }}
sleep 5
docker logs nipapd_ci

0 comments on commit 410b184

Please sign in to comment.