Skip to content

v0.3.3

v0.3.3 #25

Workflow file for this run

name: Build & Test
on:
release:
types: [created]
workflow_dispatch:
jobs:
build-api:
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: 'Build API image'
id: image
run: |
docker build backend/ \
--tag ghcr.io/${GITHUB_REPOSITORY,,}/aimaas-api:${GITHUB_REF_NAME,,} \
--tag ghcr.io/${GITHUB_REPOSITORY,,}/aimaas-api:latest
docker push ghcr.io/${GITHUB_REPOSITORY,,}/aimaas-api:${GITHUB_REF_NAME,,}
docker push ghcr.io/${GITHUB_REPOSITORY,,}/aimaas-api:latest
build-ui:
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@main
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
- name: 'Build UI image'
run: |
docker build frontend/ \
--tag ghcr.io/${GITHUB_REPOSITORY,,}/aimaas-ui:${GITHUB_REF_NAME,,} \
--tag ghcr.io/${GITHUB_REPOSITORY,,}/aimaas-ui:latest
docker push ghcr.io/${GITHUB_REPOSITORY,,}/aimaas-ui:${GITHUB_REF_NAME,,}
docker push ghcr.io/${GITHUB_REPOSITORY,,}/aimaas-ui:latest
test-api:
needs: build-api
runs-on: ubuntu-latest
services:
postgres:
image: postgres:latest
env:
POSTGRES_DB: test_aimaas
POSTGRES_USER: aimaas
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
steps:
- uses: actions/checkout@v2
- name: Test
run: |
docker run --rm --network host -e PG_USER=$PG_USER -e PG_PASSWORD=$PG_PASSWORD \
-e PG_HOST=$PG_HOST -e PG_PORT=$PG_PORT -e PG_DB=$PG_DB --entrypoint "" \
-v `pwd`:/src \
ghcr.io/${GITHUB_REPOSITORY,,}/aimaas-api:${GITHUB_REF_NAME,,} \
bash -c 'pip3 install -r /src/backend/requirements_test.txt; pytest /opt/aimaas/backend/tests/'
env:
PG_USER: aimaas
PG_PASSWORD: password
PG_HOST: localhost
PG_PORT: 5432
PG_DB: aimaas