Build and test service #333
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: Build and test service | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- master | |
schedule: | |
# 7am EST / 8am EDT Mondays | |
- cron: '0 12 * * 1' | |
jobs: | |
build-test: | |
if: | | |
github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
|| ! contains(github.event.head_commit.message, '[skip ci]') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install hatch | |
run: pip install hatch | |
- name: Build the image | |
run: | | |
VERSION=`hatch version | tail -n1` | |
echo $VERSION | |
docker compose build --build-arg BUILDTYPE=latest-test --build-arg DEPLOYSERVER=uvicorn --build-arg VERSION=$VERSION | |
- name: Start all the things | |
run: docker compose up -d | |
- name: Test the things | |
run: docker exec app bash -c "pytest /src/migas/server" | |
- name: Stop all the things | |
run: docker compose down |