diff --git a/.github/workflows/ci-test.yml b/.github/workflows/ci-test.yml index 01ce5696..42c8faf9 100644 --- a/.github/workflows/ci-test.yml +++ b/.github/workflows/ci-test.yml @@ -37,7 +37,7 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build Docker image - AMD + - name: Build Docker image - AMD dev run: | docker build \ --target development \ @@ -46,11 +46,25 @@ jobs: -f ./docker/Dockerfile \ . docker save api:dev-amd | gzip > api-dev-amd.tar.gz + - name: Build Docker image - AMD prod + run: | + docker build \ + --target production \ + --build-arg="VERSION=$( cat composer.json | jq -r .version )" \ + -t api:prod-amd \ + -f ./docker/Dockerfile \ + . + docker save api:prod-amd | gzip > api-prod-amd.tar.gz - uses: actions/upload-artifact@v4 with: name: docker-image-api-dev-amd path: api-dev-amd.tar.gz retention-days: 7 + - uses: actions/upload-artifact@v4 + with: + name: docker-image-api-prod-amd + path: api-prod-amd.tar.gz + retention-days: 7 cs-lint: runs-on: ubuntu-latest @@ -186,6 +200,10 @@ jobs: with: name: docker-image-api-dev-amd path: /tmp/docker + - uses: actions/download-artifact@v4 + with: + name: docker-image-api-prod-amd + path: /tmp/docker - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -195,11 +213,12 @@ jobs: run: | chmod 777 ./bin/test-feature-prepare docker load < /tmp/docker/api-dev-amd.tar.gz + docker load < /tmp/docker/api-prod-amd.tar.gz docker compose -f ./tests/FeatureTests/docker-compose-${{ matrix.dockerCompose }}.yml up --quiet-pull -d echo "waiting for containers to star tup (10s)" sleep 10 echo "finished waiting" - docker exec ember-nexus-api bash -c "composer install --ignore-platform-req=php --quiet && composer test:feature && composer test:feature:deprecated" + docker exec ember-nexus-api-dev bash -c "export API_DOMAIN=\"http://ember-nexus-api-prod\" && echo \$API_DOMAIN && composer install --ignore-platform-req=php --quiet && composer test:feature && composer test:feature:deprecated" test-example-generation-controller: runs-on: buildjet-2vcpu-ubuntu-2204 @@ -219,6 +238,10 @@ jobs: with: name: docker-image-api-dev-amd path: /tmp/docker + - uses: actions/download-artifact@v4 + with: + name: docker-image-api-prod-amd + path: /tmp/docker - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -228,11 +251,12 @@ jobs: run: | chmod 777 ./bin/test-feature-prepare docker load < /tmp/docker/api-dev-amd.tar.gz + docker load < /tmp/docker/api-prod-amd.tar.gz docker compose -f ./tests/ExampleGenerationController/docker-compose.yml up --quiet-pull -d echo "waiting for containers to star tup (10s)" sleep 10 echo "finished waiting" - docker exec ember-nexus-api bash -c "composer install --ignore-platform-req=php --quiet && composer test:example-generation-controller && composer test:example-generation-controller:deprecated" + docker exec ember-nexus-api-dev bash -c "export API_DOMAIN=\"http://ember-nexus-api\" && echo \$API_DOMAIN && composer install --ignore-platform-req=php --quiet && composer test:example-generation-controller && composer test:example-generation-controller:deprecated" test-example-generation-command: diff --git a/CHANGELOG.md b/CHANGELOG.md index aaaeda57..41e88daa 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Server exceptions with the HTTP status code 500 will now always log their message. - Upgrade PHP to 8.3.7, closes #310. - Update PHP dependencies, related to #310. +- Feature tests use production docker build in CI, closes #297. ## 0.1.6 - 2024-04-22 ### Added diff --git a/docs/api-endpoints/system/get-instance-configuration/200-response-body.json b/docs/api-endpoints/system/get-instance-configuration/200-response-body.json index 010b1cb3..c828a5ff 100644 --- a/docs/api-endpoints/system/get-instance-configuration/200-response-body.json +++ b/docs/api-endpoints/system/get-instance-configuration/200-response-body.json @@ -1,5 +1,5 @@ { - "version": "dev", + "version": "0.1.6", "pageSize": { "min": 5, "default": 25, diff --git a/tests/ExampleGenerationController/docker-compose.yml b/tests/ExampleGenerationController/docker-compose.yml index 5552e327..c0c1730f 100644 --- a/tests/ExampleGenerationController/docker-compose.yml +++ b/tests/ExampleGenerationController/docker-compose.yml @@ -1,8 +1,17 @@ services: + ember-nexus-api-dev: + container_name: ember-nexus-api-dev + image: api:dev-amd + expose: + - "80" + volumes: + - ../../:/var/www/html + - ./well-known-security.txt:/well-known-security.txt + ember-nexus-api: container_name: ember-nexus-api - image: api:dev-amd + image: api:prod-amd expose: - "80" volumes: diff --git a/tests/FeatureTests/docker-compose-neo4j-5.14.yml b/tests/FeatureTests/docker-compose-neo4j-5.14.yml index b5e5df5b..783dea6c 100644 --- a/tests/FeatureTests/docker-compose-neo4j-5.14.yml +++ b/tests/FeatureTests/docker-compose-neo4j-5.14.yml @@ -1,7 +1,7 @@ services: - ember-nexus-api: - container_name: ember-nexus-api + ember-nexus-api-dev: + container_name: ember-nexus-api-dev image: api:dev-amd expose: - "80" @@ -9,6 +9,15 @@ services: - ../../:/var/www/html - ./well-known-security.txt:/well-known-security.txt + ember-nexus-api-prod: + container_name: ember-nexus-api-prod + image: api:prod-amd + expose: + - "80" + volumes: + - ../../:/var/www/html + - ./well-known-security.txt:/well-known-security.txt + ember-nexus-neo4j: container_name: ember-nexus-neo4j image: neo4j:5.14 diff --git a/tests/FeatureTests/docker-compose-neo4j-5.15.yml b/tests/FeatureTests/docker-compose-neo4j-5.15.yml index 78efb8f5..eebae03e 100644 --- a/tests/FeatureTests/docker-compose-neo4j-5.15.yml +++ b/tests/FeatureTests/docker-compose-neo4j-5.15.yml @@ -1,7 +1,7 @@ services: - ember-nexus-api: - container_name: ember-nexus-api + ember-nexus-api-dev: + container_name: ember-nexus-api-dev image: api:dev-amd expose: - "80" @@ -9,6 +9,15 @@ services: - ../../:/var/www/html - ./well-known-security.txt:/well-known-security.txt + ember-nexus-api-prod: + container_name: ember-nexus-api-prod + image: api:prod-amd + expose: + - "80" + volumes: + - ../../:/var/www/html + - ./well-known-security.txt:/well-known-security.txt + ember-nexus-neo4j: container_name: ember-nexus-neo4j image: neo4j:5.15 diff --git a/tests/FeatureTests/docker-compose-neo4j-5.7.yml b/tests/FeatureTests/docker-compose-neo4j-5.7.yml index 4183500c..396a6d6b 100644 --- a/tests/FeatureTests/docker-compose-neo4j-5.7.yml +++ b/tests/FeatureTests/docker-compose-neo4j-5.7.yml @@ -1,7 +1,7 @@ services: - ember-nexus-api: - container_name: ember-nexus-api + ember-nexus-api-dev: + container_name: ember-nexus-api-dev image: api:dev-amd expose: - "80" @@ -9,6 +9,15 @@ services: - ../../:/var/www/html - ./well-known-security.txt:/well-known-security.txt + ember-nexus-api-prod: + container_name: ember-nexus-api-prod + image: api:prod-amd + expose: + - "80" + volumes: + - ../../:/var/www/html + - ./well-known-security.txt:/well-known-security.txt + ember-nexus-neo4j: container_name: ember-nexus-neo4j image: neo4j:5.7