Skip to content

Commit

Permalink
test: WIP - Create an action to check containers execution
Browse files Browse the repository at this point in the history
  • Loading branch information
Yoan-MA committed Dec 26, 2022
1 parent ac2bd17 commit aa2e475
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy-image-on-master-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
# run it on push to the default repository branch
push:
branches: [master]
pull_request:

env:
REGISTRY: ghcr.io
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/test-image-execution.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Test Image execution on OS

on:
# run it on push to the default repository branch
push:
branches: [master]
pull_request:
# Only trigger, when the build workflow succeeded
workflow_run:
workflows: [ "Deploy Application images when Merging on Master" ]
types: [completed]

env:
REGISTRY: ghcr.io
REPOSITORY_NAME: ${{ github.repository }}
IMAGE_TAG: "latest"

jobs:
build:
name: Test containers execution
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
services:
listingapi:
image: "ghcr.io/meilleursagents/backend-technical-test/listingapi:latest"
ports:
- "8181:5000"
env:
FLASK_APP: "listingapi.app"
options: >-
--entrypoint ["flask", "run", "-h", "0.0.0.0"]
pricemap-python:
image: "ghcr.io/meilleursagents/backend-technical-test/pricemap-python:latest"
ports:
- "8080:5000"
env:
PGHOST: db
PGDATABASE: pricemap
PGUSER: pricemap
PGPASSWORD: pricemap
FLASK_DEBUG: 1
FLASK_APP: "pricemap.app"
options: >-
--entrypoint "/home/pricemap/wait-for-postgres.sh db:5432 -- flask run -h 0.0.0.0"
pricemap-typescript:
image: "ghcr.io/meilleursagents/backend-technical-test/pricemap-typescript:latest"
ports:
- "8282:5000"
- "9222:9222"
env:
PGHOST: db
PGDATABASE: pricemap
PGUSER: pricemap
PGPASSWORD: pricemap
options: >-
--entrypoint "npm run watch"
db:
image: "mdillon/postgis:11-alpine"
env:
POSTGRES_DB: pricemap
POSTGRES_USER: pricemap
POSTGRES_PASSWORD: pricemap
options: >-
--health-cmd pg_isready
--health-interval 20s
--health-timeout 5s
--health-retries 5
--health-start-period 15s
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432

# steps to perform in job
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Initialize Database
run: "psql -f pricemap-python/docker/db/init.sql postgresql://pricemap:pricemap@localhost:5432/pricemap"

0 comments on commit aa2e475

Please sign in to comment.