Fix gh actions integration testing #64
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 | |
# The containers need to be able update config files | |
- name: Make writeable config files | |
run: | | |
touch install/settings/settings.cfg | |
chmod o+rw install/settings/settings.cfg | |
touch settings/Config.ini | |
chmod o+rw settings/Config.ini | |
touch settings/Config.php | |
chmod o+rw settings/Config.php | |
# Start up api service | |
# Start up cli service (installs test data) | |
- name: Start services | |
run: cd .. && docker compose up --no-build -d api cli | |
- name: Wait for containers to be ready | |
# Wait for the cli container to get the data used in unit tests | |
# This will wait up to 2 minutes | |
run: bash .github/workflows/wait_for_ready.sh | |
# 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 | |
# - name: Cache Composer packages | |
# id: composer-cache | |
# uses: actions/cache@v3 | |
# with: | |
# path: vendor | |
# key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
# restore-keys: | | |
# ${{ runner.os }}-php | |
# - name: Set up test environment | |
# run: | | |
# mkdir log | |
# mkdir cache | |
# ln -s $PWD /home/helioviewer/api.helioviewer.org | |
# ln -s /tmp/jp2 docroot/jp2 | |
# composer run-script make-test-config | |
# - name: Install dependencies | |
# run: composer install --prefer-dist --no-progress | |
# - name: Install python packages for root user | |
# run: | | |
# su helioviewer -c "python3 -m pip freeze > /tmp/helioviewer-packages" | |
# python3 -m pip install -r /tmp/helioviewer-packages | |
# - name: Startup background services | |
# run: | | |
# httpd | |
# mysqld --user=mysql -D | |
# redis-server --daemonize yes | |
# tcsh scripts/movie_queue.tcsh | |
# ./vendor/bin/start_hgs2hpc | |
# - name: Re-install Helioviewer Database for current branch | |
# run: | | |
# mysql -e "drop database helioviewer; drop user 'helioviewer'@'localhost';" | |
# cd management/data && ./setup_db.exp | |
# - name: Run PHP test suite | |
# run: composer run-script test | |
# - name: Run Python test suite | |
# run: composer run-script test-python |