Docker-Compose Validation #70
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker-Compose Validation | |
on: | |
push: | |
branches: | |
- '*' | |
schedule: | |
- cron: '30 5 * * 2,4' | |
jobs: | |
test-docker: | |
name: Docker Image Build | |
strategy: | |
fail-fast: false | |
matrix: | |
node: ['18', '20'] | |
implementation: ['restify', 'plain', 'express', 'koa', 'fastify'] | |
runson: ['ubuntu-20.04', 'ubuntu-22.04'] | |
runs-on: ${{ matrix.runson }} | |
steps: | |
- name: Checkout the commit triggering this job | |
uses: actions/checkout@v4 | |
# Commands you use with run start in new containers with configuration defined by that of | |
# the service, including volumes, links, and other details, except: | |
# 1) The command passed as an argument overrides the defined command. | |
# 2) None of the ports specified in the service configuration are bound. | |
# | |
# - https://docs.docker.com/compose/reference/run/, https://github.com/docker/compose/pull/4954 | |
- name: Build and bring up the stack described in docker-compose.yml | |
run: | | |
docker-compose build | |
docker-compose up -d database | |
docker-compose run -d --service-ports backend npm run start:${{ matrix.implementation }} | |
- name: Setup Node with npm cache | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'npm' | |
- name: Install dependencies from package.json | |
run: npm install | |
- name: Run tests against live Postgres and Node server | |
run: npm --test_live_pg_server=true --test_live_node_server=true run test:${{ matrix.implementation}} | |
- name: Bring down stack | |
run: docker-compose down |