Fix unit tests (#415) #249
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 | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get development docker compose file | |
run: | | |
cd .. | |
wget https://raw.githubusercontent.com/Helioviewer-Project/helioviewer.org-docker/main/compose.yaml | |
wget https://raw.githubusercontent.com/Helioviewer-Project/helioviewer.org-docker/main/.env.example | |
mv .env.example .env | |
# Start up api service (test environment) | |
- name: Start services | |
# --no-build to force it to use whatever is published in the registry | |
# -d to detach, so the command returns | |
# --wait to wait for containers to be healthy, meaning the test data is downloaded and ready | |
run: cd .. && docker compose up --no-build --wait api | |
- name: Print container logs logs | |
if: always() | |
run: docker logs helioviewer-api-1 | |
# Run the tests inside the api container | |
- name: Run phpunit tests | |
run: docker exec -t helioviewer-api-1 composer run-script test | |
- name: Run python tests | |
run: docker exec -t helioviewer-api-1 composer run-script test-python |