Skip to content

Commit 9c165d9

Browse files
actions (#2)
1 parent 1042475 commit 9c165d9

File tree

4 files changed

+89
-0
lines changed

4 files changed

+89
-0
lines changed

.env.test

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
APP_ENV=dev
2+
APP_SECRET=81d3d3ed250384f60d23b45f6716d2a0
3+
DATABASE_URL=pgsql://symfony:symfony@postgres:5432/symfony?serverVersion=16&charset=utf8
4+
MESSENGER_TRANSPORT_DSN=doctrine://default?auto_setup=0
5+
MAILER_DSN=null://null
6+
APPLICATION_PATH=/src
7+
8+
###> nelmio/cors-bundle ###
9+
CORS_ALLOW_ORIGIN='^https?://(localhost|127\.0\.0\.1)(:[0-9]+)?$'
10+
###< nelmio/cors-bundle ###

.github/test-setup.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
IFS=$'\n\t'
4+
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5+
PROJECT_ROOT=$( dirname "$DIR" )
6+
7+
# project root
8+
cd "$PROJECT_ROOT"
9+
set -x
10+
11+
sed -i "s+user: 1000:1000+user: $(id -u):$(id -g)+g" compose.yaml
12+
sed -i "s+restart: on-failure+restart: no+g" compose.yaml
13+
cp .env.dist .env
14+
15+
# To avoid Git error 'Can not get current git branch: fatal: detected dubious ownership in repository at '/src'
16+
git config --global --add safe.directory "$PROJECT_ROOT"

.github/workflows/tests.yaml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Run Tests
2+
3+
# Controls when the workflow will run
4+
on:
5+
# Triggers the workflow on push or pull request events but only for the main branch
6+
push:
7+
branches: [ main ]
8+
pull_request:
9+
branches: [ main ]
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
workflow_call:
14+
15+
jobs:
16+
run-tests:
17+
# The type of runner that the job will run on
18+
runs-on: ubuntu-latest
19+
20+
# Steps represent a sequence of tasks that will be executed as part of the job
21+
steps:
22+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
- name: Setup test environment
28+
run: .github/test-setup.sh
29+
30+
- name: Start docker
31+
run: docker compose --file compose.yaml --file compose.test.yaml up --detach
32+
33+
- name: Install dependencies
34+
run: docker compose exec --no-TTY phpnginx bash -c '
35+
composer install --no-progress --no-interaction
36+
'
37+
38+
# - name: Install assets
39+
# run: docker compose run --rm --interactive=false frontend -c '
40+
# yarn install &&
41+
# yarn build
42+
# '
43+
44+
# - name: Create database
45+
# run: docker compose exec --no-TTY phpnginx bash -c '
46+
# bin/console --env=test doctrine:database:drop --force --if-exists &&
47+
# bin/console --env=test doctrine:database:create
48+
# '
49+
50+
# - name: Yarn check
51+
# run: docker compose exec --no-TTY frontend bin/frontendCheck.sh
52+
53+
- name: ECS
54+
run: docker compose exec --no-TTY phpnginx bin/ecs.sh
55+
56+
- name: Symfony lint
57+
run: docker compose exec --no-TTY phpnginx bin/symfony-lint.sh
58+
59+
- name: PHPStan
60+
run: docker compose exec --no-TTY phpnginx bin/phpstan.sh

compose.test.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
services:
2+
postgres:
3+
command: postgres -c fsync=off -c full_page_writes=off -c synchronous_commit=off -c max_locks_per_transaction=256 -c max_connections=200

0 commit comments

Comments
 (0)