Skip to content

Commit

Permalink
merge devel
Browse files Browse the repository at this point in the history
  • Loading branch information
usu committed Dec 28, 2023
2 parents 81b2e5a + c0fee66 commit 4b7629e
Show file tree
Hide file tree
Showing 181 changed files with 13,591 additions and 8,078 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- uses: shivammathur/setup-php@v2
with:
php-version: '8.2.12'
php-version: '8.3.1'
tools: composer:2.6.0
coverage: xdebug

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/continuous-integration-optional.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- uses: shivammathur/setup-php@v2
with:
php-version: '8.2.12'
php-version: '8.3.1'
tools: composer:2.6.0
coverage: xdebug

Expand All @@ -36,7 +36,7 @@ jobs:

- uses: shivammathur/setup-php@v2
with:
php-version: '8.2.12'
php-version: '8.3.1'
tools: composer:2.6.0
coverage: xdebug

Expand Down Expand Up @@ -66,7 +66,7 @@ jobs:

- uses: shivammathur/setup-php@v2
with:
php-version: '8.2.12'
php-version: '8.3.1'
tools: composer:2.6.0
coverage: xdebug

Expand Down Expand Up @@ -114,7 +114,7 @@ jobs:

- uses: shivammathur/setup-php@v2
with:
php-version: '8.2.12'
php-version: '8.3.1'
tools: composer:2.6.0
coverage: xdebug

Expand Down
187 changes: 48 additions & 139 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

- uses: shivammathur/setup-php@v2
with:
php-version: '8.2.12'
php-version: '8.3.1'
tools: composer:2.6.0
coverage: none

Expand Down Expand Up @@ -197,7 +197,7 @@ jobs:

- uses: shivammathur/setup-php@v2
with:
php-version: '8.2.12'
php-version: '8.3.1'
extensions: intl-73.1
tools: composer:2.6.0
coverage: pcov
Expand Down Expand Up @@ -277,17 +277,16 @@ jobs:
- run: npm run test:unit
working-directory: frontend

- name: send coverage info
- name: replace paths in lcov.info that they reflect repo path
run: |
sed -i "s|src/|frontend/src/|g" frontend/data/coverage/lcov.info
cat frontend/data/coverage/lcov.info | npx coveralls .
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
COVERALLS_SERVICE_NUMBER: ${{ github.run_id }}
CI_PULL_REQUEST: ${{ github.event.number }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: frontend
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
flag-name: frontend
parallel: true
fail-on-error: false

print-tests:
name: 'Tests: Print'
Expand Down Expand Up @@ -317,17 +316,16 @@ jobs:
- run: npm run test
working-directory: print

- name: send coverage info
- name: replace paths in lcov.info that they reflect repo path
run: |
sed -i "s|SF:|SF:print/|g" print/coverage/lcov.info
cat print/coverage/lcov.info | npx coveralls .
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
COVERALLS_SERVICE_NUMBER: ${{ github.run_id }}
CI_PULL_REQUEST: ${{ github.event.number }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: print
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
flag-name: print
parallel: true
fail-on-error: false

pdf-tests:
name: 'Tests: PDF'
Expand Down Expand Up @@ -355,143 +353,45 @@ jobs:
- run: npm run test:unit
working-directory: pdf

- name: send coverage info
- name: replace paths in lcov.info that they reflect repo path
run: |
sed -i "s|src/|pdf/src/|g" pdf/data/coverage/lcov.info
cat pdf/data/coverage/lcov.info | npx coveralls .
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_SERVICE_NAME: github
COVERALLS_SERVICE_NUMBER: ${{ github.run_id }}
CI_PULL_REQUEST: ${{ github.event.number }}
COVERALLS_PARALLEL: true
COVERALLS_FLAG_NAME: pdf

e2e-tests-build:
name: 'Tests: End-to-end (build job)'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

# build API (using cache; provide image to docker compose)
- name: Build docker image (API/PHP)
uses: docker/build-push-action@v5
with:
file: api/Dockerfile
context: './api'
push: false
load: true
target: api_platform_php_dev
builder: ${{ steps.buildx.outputs.name }}
tags: ecamp/ecamp3-dev-api-php
cache-from: type=gha,scope=api
cache-to: type=gha,scope=api,mode=max
outputs: type=docker,dest=/tmp/ecamp3-dev-api-php.tar

# build caddy (using cache; provide image to docker compose)
- name: Build docker image (Caddy)
uses: docker/build-push-action@v5
with:
file: api/Dockerfile
context: './api'
push: false
load: true
target: api_platform_caddy
builder: ${{ steps.buildx.outputs.name }}
tags: ecamp/ecamp3-dev-api-caddy
cache-from: type=gha,scope=caddy
cache-to: type=gha,scope=caddy,mode=max
outputs: type=docker,dest=/tmp/ecamp3-dev-api-caddy.tar

- uses: actions/upload-artifact@v3
- name: Coveralls Parallel
uses: coverallsapp/github-action@v2
with:
name: e2e-tests-images
path: /tmp/ecamp3-dev-*.tar

e2e-tests-run:
name: 'Tests: End-to-end'
runs-on: ubuntu-latest
needs: e2e-tests-build
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
browser:
- chrome
- firefox
- edge
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4

- run: cp .env.ci .env
flag-name: pdf
parallel: true
fail-on-error: false

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: Restore tmp folder
uses: actions/download-artifact@v3
with:
name: e2e-tests-images
path: /tmp

- name: Load images
run: |
docker load --input /tmp/ecamp3-dev-api-php.tar
docker load --input /tmp/ecamp3-dev-api-caddy.tar
docker image ls -a --digests
- name: Restore cache volumes (npm, composer)
uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3
with:
path: .cache
key: docker-compose-${{ hashFiles('frontend/package-lock.json', 'print/package-lock.json', 'api/composer.lock') }}-${{ matrix.browser }}
restore-keys: |
docker-compose-
# start necessary containers
- run: docker compose up -d php caddy frontend pdf print browserless database docker-host

- uses: cypress-io/github-action@v5
with:
working-directory: e2e
browser: ${{ matrix.browser }}
wait-on: 'http://localhost:3000, http://localhost:3000/api, http://localhost:3000/print/health'
wait-on-timeout: 300

# store screenshots and videos on GitHub as artifacts, for downloading and debugging in case of problems
- uses: actions/upload-artifact@v3
if: always()
with:
name: cypress-output-${{ matrix.browser }}
path: |
e2e/data/**/*
e2e-tests-build:
name: 'Tests: End-to-end build'
uses: ./.github/workflows/reusable-e2e-tests-build.yml

# print docker container logs (good for debugging; can be disabled again later on)
- run: docker compose logs --tail="all"
if: always()
e2e-tests-run:
name: 'Tests: End-to-end run'
needs:
- e2e-tests-build
uses: ./.github/workflows/reusable-e2e-tests-run.yml

coveralls-finished:
name: 'Finish coveralls report'
needs:
- api-tests
- frontend-tests
- print-tests
- pdf-tests
runs-on: ubuntu-latest
steps:
- uses: coverallsapp/github-action@master
- uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

ci-passed-event:
name: 'Send out CI success event'
if: github.event_name == 'push' && (github.event.pull_request && github.event.pull_request.number)
carryforward: "api,frontend,print,pdf"
fail-on-error: false

workflow-success:
name: workflow-success
needs:
- api-cs-check
- frontend-eslint
Expand All @@ -502,6 +402,15 @@ jobs:
- print-tests
- e2e-tests-run
runs-on: ubuntu-latest
steps:
- run: exit 0

ci-passed-event:
name: 'Send out CI success event'
if: github.event_name == 'push' && (github.event.pull_request && github.event.pull_request.number)
needs:
- workflow-success
runs-on: ubuntu-latest
steps:
- uses: peter-evans/repository-dispatch@bf47d102fdb849e755b0b0023ea3e81a44b6f570 # v2
with:
Expand Down
59 changes: 59 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: "Tests: End to End to detect flaky tests"

on:
workflow_dispatch:
inputs:
pr_number:
type: number
description: |
Number of times the tests should run
required: true
default: 10
pull_request:
types: [opened, labeled, unlabeled, synchronize]
schedule:
- cron: '42 4 * * *'

concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref_name }}
cancel-in-progress: false

jobs:
create-array:
name: 'Create large array for matrix'
if: contains(github.event.pull_request.labels.*.name, 'test-flaky-e2e!') || github.event_name != 'pull_request'
runs-on: ubuntu-latest
outputs:
array: ${{ steps.array.outputs.result }}

steps:
- name: Create large array
uses: actions/github-script@v7
id: array
with:
script: |
function range(start, stop) {
return Array(stop - start)
.fill(start)
.map((value, index) => value + index);
}
return range(0, ${{ inputs.pr_number != null && inputs.pr_number || 10 }})
e2e-tests-build:
name: 'Tests: End-to-end build to detect flaky tests'
needs:
- create-array
uses: ./.github/workflows/reusable-e2e-tests-build.yml

e2e-tests-run:
name: 'Tests: End-to-end run to detect flaky tests'
needs:
- create-array
- e2e-tests-build
uses: ./.github/workflows/reusable-e2e-tests-run.yml
with:
run-identifier: ${{ matrix.array }}
strategy:
fail-fast: false
matrix:
array: ${{ fromJSON(needs.create-array.outputs.array) }}
2 changes: 1 addition & 1 deletion .github/workflows/fast-forward.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
if: steps.has_permission.outputs.require-result != 'true'
run: exit 1

- uses: actions/github-script@v6
- uses: actions/github-script@v7
id: current_pr
with:
github-token: ${{ secrets.FAST_FORWARD_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-dev-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
name: ${{ inputs.env }}
steps:
- name: Get link to currently running job logs
uses: Tiryoh/gha-jobid-action@v1.0.0
uses: Tiryoh/gha-jobid-action@v1.1.0
id: job-url
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
Loading

0 comments on commit 4b7629e

Please sign in to comment.