mirror of
https://github.com/MatthewL246/pretendo-docker.git
synced 2026-05-12 06:55:50 -05:00
45 lines
1.4 KiB
YAML
45 lines
1.4 KiB
YAML
name: Test scripts and build Docker images
|
|
|
|
on:
|
|
push:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
with:
|
|
submodules: true
|
|
|
|
- name: Set TERM environment variable
|
|
run: echo "TERM=xterm" >> "$GITHUB_ENV"
|
|
|
|
# Trying to expose ports in GitHub Actions causes a "bind: address already
|
|
# in use" error. Also, restarting containers should be disabled for
|
|
# testing whether any exit.
|
|
- name: Remove exposed ports configuration and disable container restart
|
|
run: |
|
|
yq eval 'del(.services.*.ports)' -i compose.yml
|
|
yq eval '.services.*.restart = "no"' -i compose.yml
|
|
# The databases seem to crash randomly sometimes in Actions
|
|
yq eval '.services.mongodb.restart = "unless-stopped"' -i compose.yml
|
|
yq eval '.services.postgres.restart = "unless-stopped"' -i compose.yml
|
|
|
|
- name: Run the setup script
|
|
run: ./setup.sh
|
|
|
|
- name: Test starting the servers
|
|
run: |
|
|
docker compose up -d
|
|
sleep 35
|
|
docker compose ps -a
|
|
docker compose logs
|
|
# Fail if any containers exited
|
|
! docker compose ps -a | grep Exited
|