|
1 | | -# name: CI |
| 1 | +name: CI |
2 | 2 |
|
3 | | -# on: |
4 | | -# push: |
5 | | -# branches: |
6 | | -# - deploy-v3 |
7 | | -# pull_request: ~ |
8 | | -# workflow_dispatch: ~ |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - deploy-v3 |
| 7 | + pull_request: ~ |
| 8 | + workflow_dispatch: ~ |
9 | 9 |
|
10 | | -# concurrency: |
11 | | -# group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
12 | | -# cancel-in-progress: true |
| 10 | +concurrency: |
| 11 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 12 | + cancel-in-progress: true |
13 | 13 |
|
14 | | -# jobs: |
15 | | -# tests: |
16 | | -# name: Tests |
17 | | -# runs-on: ubuntu-latest |
18 | | -# permissions: |
19 | | -# contents: 'read' |
20 | | -# id-token: 'write' |
21 | | -# steps: |
22 | | -# - name: Checkout |
23 | | -# uses: actions/checkout@v3 |
24 | | -# - name: Pull images |
25 | | -# run: docker compose pull --ignore-pull-failures || true |
26 | | -# - name: Start services |
27 | | -# run: docker compose up --build -d |
28 | | -# - name: Wait for services |
29 | | -# run: | |
30 | | -# while status="$(docker inspect --format="{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{end}}" "$(docker compose ps -q php)")"; do |
31 | | -# case $status in |
32 | | -# starting) sleep 1;; |
33 | | -# healthy) exit 0;; |
34 | | -# unhealthy) |
35 | | -# docker compose ps |
36 | | -# docker compose logs |
37 | | -# exit 1 |
38 | | -# ;; |
39 | | -# esac |
40 | | -# done |
41 | | -# exit 1 |
42 | | -# - name: Check HTTP reachability |
43 | | -# run: curl -v -o /dev/null http://localhost |
44 | | -# - name: Check API reachability |
45 | | -# run: curl -vk -o /dev/null https://localhost |
46 | | -# - name: Check PWA reachability |
47 | | -# run: "curl -vk -o /dev/null -H 'Accept: text/html' https://localhost" |
48 | | -# - name: Create test database |
49 | | -# run: | |
50 | | -# docker compose exec -T php bin/console -e test doctrine:database:create |
51 | | -# docker compose exec -T php bin/console -e test doctrine:migrations:migrate --no-interaction |
52 | | -# - name: PHPUnit |
53 | | -# run: docker compose exec -T php bin/phpunit |
54 | | -# - name: Doctrine Schema Validator |
55 | | -# run: docker compose exec -T php bin/console doctrine:schema:validate |
56 | | -# - name: Psalm |
57 | | -# run: docker compose exec -T php vendor/bin/psalm |
58 | | -# # gcloud does not work with Python 3.10 because collections. Mappings were removed in Python 3.10. |
59 | | -# - uses: actions/setup-python@v4 |
60 | | -# with: |
61 | | -# python-version: 3.9.15 |
62 | | -# - name: Setup gcloud |
63 | | -# uses: google-github-actions/setup-gcloud@v1 |
64 | | -# - name: Lint Helm |
65 | | -# run: helm lint ./helm/api-platform/ |
| 14 | +jobs: |
| 15 | + tests: |
| 16 | + name: Tests |
| 17 | + runs-on: ubuntu-latest |
| 18 | + permissions: |
| 19 | + contents: 'read' |
| 20 | + id-token: 'write' |
| 21 | + steps: |
| 22 | + - name: Checkout |
| 23 | + uses: actions/checkout@v3 |
| 24 | + - name: Pull images |
| 25 | + run: docker compose pull --ignore-pull-failures || true |
| 26 | + - name: Start services |
| 27 | + run: docker compose up --build -d |
| 28 | + - name: Wait for services |
| 29 | + run: | |
| 30 | + while status="$(docker inspect --format="{{if .Config.Healthcheck}}{{print .State.Health.Status}}{{end}}" "$(docker compose ps -q php)")"; do |
| 31 | + case $status in |
| 32 | + starting) sleep 1;; |
| 33 | + healthy) exit 0;; |
| 34 | + unhealthy) |
| 35 | + docker compose ps |
| 36 | + docker compose logs |
| 37 | + exit 1 |
| 38 | + ;; |
| 39 | + esac |
| 40 | + done |
| 41 | + exit 1 |
| 42 | + - name: Check HTTP reachability |
| 43 | + run: curl -v -o /dev/null http://localhost |
| 44 | + - name: Check API reachability |
| 45 | + run: curl -vk -o /dev/null https://localhost |
| 46 | + - name: Check PWA reachability |
| 47 | + run: "curl -vk -o /dev/null -H 'Accept: text/html' https://localhost" |
| 48 | + - name: Create test database |
| 49 | + run: | |
| 50 | + docker compose exec -T php bin/console -e test doctrine:database:create |
| 51 | + docker compose exec -T php bin/console -e test doctrine:migrations:migrate --no-interaction |
| 52 | + - name: PHPUnit |
| 53 | + run: docker compose exec -T php bin/phpunit |
| 54 | + - name: Doctrine Schema Validator |
| 55 | + run: docker compose exec -T php bin/console doctrine:schema:validate |
| 56 | + - name: Psalm |
| 57 | + run: docker compose exec -T php vendor/bin/psalm |
| 58 | + # gcloud does not work with Python 3.10 because collections. Mappings were removed in Python 3.10. |
| 59 | + - uses: actions/setup-python@v4 |
| 60 | + with: |
| 61 | + python-version: 3.9.15 |
| 62 | + - name: Setup gcloud |
| 63 | + uses: google-github-actions/setup-gcloud@v1 |
| 64 | + - name: Lint Helm |
| 65 | + run: helm lint ./helm/api-platform/ |
0 commit comments