Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the integration tests up and running again #1300

Merged
merged 16 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,23 @@ PANTHER_APP_ENV=panther
PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots

# Mbin variables
DATABASE_URL="postgresql://kbin:ChangeMe@127.0.0.1:5432/kbin_test?serverVersion=13&charset=utf8"
DATABASE_HOST=127.0.0.1
DATABASE_PORT=5433
DATABASE_URL="postgresql://mbin:ChangeThisPostgresPass@${DATABASE_HOST}:${DATABASE_PORT}/mbin?serverVersion=16&charset=utf8"
REDIS_HOST=127.0.0.1
REDIS_PORT=6380
REDIS_DNS=redis://${REDIS_HOST}:${REDIS_PORT}
MAILER_DSN=null://default
KBIN_JS_ENABLED=false
KBIN_DEFAULT_LANG=en
KBIN_DOMAIN=kbin.test
ELASTICSEARCH_ENABLED=false
KBIN_API_ITEMS_PER_PAGE=2
KBIN_FEDERATION_ENABLED=false

###> league/oauth2-server-bundle ###
OAUTH_PRIVATE_KEY=%kernel.project_dir%/config/oauth2/tests/private.pem
OAUTH_PUBLIC_KEY=%kernel.project_dir%/config/oauth2/tests/public.pem
OAUTH_ENCRYPTION_KEY=MF3Sks6dIHhMvk1SALv68e8LydunZopLennBuF9jALk=
OAUTH_PASSPHRASE=null
###< league/oauth2-server-bundle ###
73 changes: 65 additions & 8 deletions .github/workflows/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
build:
runs-on: ubuntu-latest
container:
image: danger89/mbin-pipeline:1.2.0
image: danger89/mbin-pipeline:1.3.0
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -51,10 +51,10 @@ jobs:
- name: Build frontend (production)
run: npm run build

unit-test:
automated-tests:
runs-on: ubuntu-latest
container:
image: danger89/mbin-pipeline:1.2.0
image: danger89/mbin-pipeline:1.3.0
steps:
- uses: actions/checkout@v4

Expand All @@ -63,26 +63,84 @@ jobs:
run: |
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Get NPM cache directory path
id: npm-cache-dir-path
run: echo "dir=$(npm get cache)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
key: ${{ runner.os }}-composer-${{ hashFiles('*/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- run: cp .env.example .env
- uses: actions/cache@v4
id: npm-cache
with:
path: ${{ steps.npm-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('*/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-

- name: Composer install
run: composer install --no-scripts --no-progress

- run: cp .env.example .env

- name: NPM install
run: npm ci --include=dev
env:
NODE_ENV: production

- name: Build frontend (production)
run: npm run build

- name: Run unit tests
env:
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
SYMFONY_DEPRECATIONS_HELPER: disabled
DATABASE_HOST: postgres
DATABASE_PORT: 5432
REDIS_HOST: valkey
REDIS_PORT: 6379
run: php bin/phpunit tests/Unit

- name: Run integration tests
env:
COMPOSER_CACHE_DIR: ${{ steps.composer-cache.outputs.dir }}
SYMFONY_DEPRECATIONS_HELPER: disabled
DATABASE_HOST: postgres
DATABASE_PORT: 5432
REDIS_HOST: valkey
REDIS_PORT: 6379
run: php bin/phpunit tests/Functional
services:
postgres:
# Docker Hub image
image: postgres:16
# Provide the password for postgres
env:
POSTGRES_DB: mbin_test
POSTGRES_USER: mbin
POSTGRES_PASSWORD: ChangeThisPostgresPass
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
valkey:
# Docker Hub image
image: valkey/valkey
# Set health checks to wait until redis has started
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5

audit-check:
runs-on: ubuntu-latest
container:
image: danger89/mbin-pipeline:1.2.0
image: danger89/mbin-pipeline:1.3.0
continue-on-error: true
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -114,7 +172,7 @@ jobs:
fixer-dry-run:
runs-on: ubuntu-latest
container:
image: danger89/mbin-pipeline:1.2.0
image: danger89/mbin-pipeline:1.3.0
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -168,4 +226,3 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# TODO: Integration tests
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"wohali/oauth2-discord-new": "^1.2.1"
},
"require-dev": {
"brianium/paratest": "^7.6",
"dama/doctrine-test-bundle": "^8.2.0",
"doctrine/doctrine-fixtures-bundle": "^3.6.1",
"fakerphp/faker": "^1.23.1",
Expand Down
215 changes: 214 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading