Migrate from Travis CI to GH Actions #2
Workflow file for this run
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: Tests | |
on: | |
pull_request: | |
branches: | |
- development | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: | |
name: development | |
env: | |
APPLICATION_NAME: scorpio | |
CONTAINER: scorpio-web | |
APPLICATION_PORT: 8013 | |
services: | |
docker: | |
image: docker:stable | |
options: --privileged | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python and cache pip | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
cache: 'pip' | |
- name: Copy config file | |
run: cp ${{ env.APPLICATION_NAME }}/config.py.example ${{ env.APPLICATION_NAME }}/config.py | |
- name: Login to Docker | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
- name: Start Docker containers | |
run: docker compose up -d | |
- name: Wait for services to be ready | |
run: ./wait-for-it.sh $CONTAINER:$APPLICATION_PORT -- echo "$CONTAINER is ready" | |
- name: Install pre-commit | |
run: | | |
pip install "pre-commit===2.13.0" | |
pre-commit install | |
- name: Run pre-commit checks | |
run: pre-commit run --all-files --show-diff-on-failure | |
- name: Run tests | |
run: docker compose exec -T $CONTAINER python manage.py test |