Skip to content

Commit

Permalink
Test creating the container with container key
Browse files Browse the repository at this point in the history
  • Loading branch information
JVT038 committed Mar 22, 2024
1 parent 3981e71 commit 5eb35dd
Showing 1 changed file with 29 additions and 10 deletions.
39 changes: 29 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@ jobs:
ports:
- 3306:3306

container:
image: webdevops/php-nginx:8.3-alpine
env:
DATABASE_MODE: mysql
DATABASE_MYSQL_HOST: database
DATABASE_MYSQL_PORT: 3306
DATABASE_MYSQL_USER: root
DATABASE_MYSQL_NAME: movary
DATABASE_MYSQL_PASSWORD: ''
WEB_DOCUMENT_ROOT: /app/public
PHP_DISMOD: imagick
ports:
- 80
volumes:
- /home/runner/work/movary/movary:/app
options: -u application -w /app --name movary apk add --no-cache make nano

steps:
- uses: actions/checkout@v3
- name: Set environment variables
Expand All @@ -34,32 +51,34 @@ jobs:
run: |
curl -f -L -o ijhttp.zip "https://jb.gg/ijhttp/latest"
unzip ijhttp.zip
# - name: Get Docker network name of GitHub services
# run: docker inspect database --format='{{json .NetworkSettings.Networks}}'
# NETWORK=$( docker network ls --format "{{ .Name }}" | sed -n 1p) &&

- name: Build docker development image
run: docker build --target development --tag movary ./build/php/

- name: Install dependencies
run: docker run --rm -p 80:80 -v /home/runner/work/movary/movary:/app movary composer --no-interaction install
run: docker exec movary composer --no-interaction install

- name: Run PHPCs
run: docker run --rm -p 80:80 -v /home/runner/work/movary/movary:/app movary vendor/bin/phpcs --standard=./settings/phpcs.xml --report=checkstyle -q ./src ./tests | vendor/bin/cs2pr
run: docker exec movary vendor/bin/phpcs --standard=./settings/phpcs.xml --report=checkstyle -q ./src ./tests | vendor/bin/cs2pr

- name: Run PHPStan
run: docker run --rm -p 80:80 -v /home/runner/work/movary/movary:/app movary vendor/bin/phpstan analyse -c ./settings/phpstan.neon
run: docker exec movary vendor/bin/phpstan analyse -c ./settings/phpstan.neon

- name: Run Psalm
run: docker run --rm -p 80:80 -v /home/runner/work/movary/movary:/app movary vendor/bin/psalm -c ./settings/psalm.xml --show-info=false --output-format=github
run: docker exec movary vendor/bin/psalm -c ./settings/psalm.xml --show-info=false --output-format=github

- name: Run PHPUnit
run: docker run --rm -p 80:80 -v /home/runner/work/movary/movary:/app movary vendor/bin/phpunit -c ./settings/phpunit.xml --testsuite unit
run: docker exec movary vendor/bin/phpunit -c ./settings/phpunit.xml --testsuite unit

- name: Prepare for the tests
run: |
docker run --rm -p 80:80 -v /home/runner/work/movary/movary:/app movary php bin/console.php database:migration:migrate
docker run --rm -p 80:80 -v /home/runner/work/movary/movary:/app movary php bin/console.php user:create testUser@domain.com password1234 testUser true
docker exec movary php bin/console.php database:migration:migrate
docker exec movary php bin/console.php user:create testUser@domain.com password1234 testUser true
- name: Run the HTTP tests
run: |
docker run --rm -d -p 80:80 -v /home/runner/work/movary/movary:/app movary &&
./ijhttp/ijhttp tests/rest/api/authentication.http --env-file tests/rest/api/http-client.env.json --env CI &&
docker stop movary && docker rm movary
./ijhttp/ijhttp tests/rest/api/authentication.http --env-file tests/rest/api/http-client.env.json --env CI

0 comments on commit 5eb35dd

Please sign in to comment.