-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: WIP - Create an action to check containers execution
- Loading branch information
Showing
2 changed files
with
83 additions
and
0 deletions.
There are no files selected for viewing
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
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
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" |