diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 734101c6f..93e81e3b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -27,16 +29,6 @@ jobs: - name: "Check out NIPAP repository" uses: actions/checkout@v2 - - name: "Hadolint nipapd" - uses: hadolint/hadolint-action@v3.1.0 - with: - Dockerfile: Dockerfile.nipapd - - - name: "Hadolint WWW" - uses: hadolint/hadolint-action@v3.1.0 - with: - Dockerfile: Dockerfile.www - - name: "Install dependencies and prepare NIPAP" run: | # Set up NIPAP repo @@ -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/hadolint-action@v3.1.0 + with: + Dockerfile: Dockerfile.nipapd + + - name: "Hadolint WWW" + uses: hadolint/hadolint-action@v3.1.0 + 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