|
| 1 | +# To upgrade pinned actions: Use https://github.com/mheap/pin-github-action |
| 2 | + |
| 3 | +name: CI - E2E |
| 4 | + |
| 5 | +env: |
| 6 | + OS: &os ubuntu-24.04 |
| 7 | + |
| 8 | + # run job only under the following conditions: |
| 9 | + # - can be triggered manually from any repository |
| 10 | + # - can be triggered as workflow call by another workflow |
| 11 | + # - if on pull request, only run if from a fork |
| 12 | + # (our own repo is covered by the push event) |
| 13 | + # - if on push, only run CI automatically for the |
| 14 | + # main getkirby/kirby repo and for forks |
| 15 | + SHOULD_RUN: &should-run >- |
| 16 | + github.event_name == 'workflow_dispatch' || |
| 17 | + github.event_name == 'workflow_call' || |
| 18 | + (github.event_name == 'pull_request' && |
| 19 | + github.event.pull_request.head.repo.full_name != github.repository) || |
| 20 | + (github.event_name == 'push' && |
| 21 | + (github.repository == 'getkirby/kirby' || github.repository_owner != 'getkirby')) |
| 22 | + |
| 23 | +on: |
| 24 | + push: &e2e-triggers |
| 25 | + branches-ignore: |
| 26 | + - "main" |
| 27 | + - "release/**" |
| 28 | + paths: |
| 29 | + - "**" |
| 30 | + - "!.github/**" |
| 31 | + - ".github/actions/setup-npm/**" |
| 32 | + - ".github/actions/setup-php/**" |
| 33 | + - ".github/workflows/e2e.yml" |
| 34 | + - "!.tx/**" |
| 35 | + - "!.vscode/**" |
| 36 | + - "!assets/**" |
| 37 | + - "!scripts/**" |
| 38 | + pull_request: *e2e-triggers |
| 39 | + workflow_call: |
| 40 | + workflow_dispatch: |
| 41 | + |
| 42 | +concurrency: |
| 43 | + group: e2e-${{ github.ref }} |
| 44 | + cancel-in-progress: true |
| 45 | + |
| 46 | +jobs: |
| 47 | + tests: |
| 48 | + name: "Tests" |
| 49 | + if: *should-run |
| 50 | + runs-on: *os |
| 51 | + timeout-minutes: 15 |
| 52 | + |
| 53 | + steps: |
| 54 | + - name: Checkout sandbox |
| 55 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 56 | + with: |
| 57 | + repository: getkirby/sandbox |
| 58 | + ref: feat/develop-license |
| 59 | + path: sandbox |
| 60 | + |
| 61 | + - name: Checkout kirby into sandbox |
| 62 | + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 |
| 63 | + with: |
| 64 | + path: sandbox/kirby |
| 65 | + |
| 66 | + - name: Setup PHP environment |
| 67 | + uses: ./sandbox/kirby/.github/actions/setup-php |
| 68 | + with: |
| 69 | + php: "8.4" |
| 70 | + extensions: "mbstring, ctype, curl, gd" |
| 71 | + |
| 72 | + - name: Create sandbox config |
| 73 | + run: | |
| 74 | + cat > sandbox/sandbox.config.php << 'EOF' |
| 75 | + <?php |
| 76 | + return [ |
| 77 | + 'url' => 'http://localhost:8000', |
| 78 | + 'panel' => ['dev' => false] |
| 79 | + ]; |
| 80 | + EOF |
| 81 | +
|
| 82 | + - name: Start PHP server |
| 83 | + run: php -S localhost:8000 -t sandbox sandbox/router.php & |
| 84 | + |
| 85 | + - name: Set up Node.js and cache npm dependencies |
| 86 | + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 |
| 87 | + with: |
| 88 | + node-version: 22 |
| 89 | + cache: "npm" |
| 90 | + cache-dependency-path: sandbox/kirby/panel/package-lock.json |
| 91 | + |
| 92 | + - name: Install npm dependencies |
| 93 | + working-directory: sandbox/kirby/panel |
| 94 | + run: npm ci |
| 95 | + |
| 96 | + - name: Install Playwright browsers |
| 97 | + working-directory: sandbox/kirby/panel |
| 98 | + run: npx playwright install --with-deps chromium |
| 99 | + |
| 100 | + - name: Build Panel |
| 101 | + working-directory: sandbox/kirby/panel |
| 102 | + run: npm run build |
| 103 | + |
| 104 | + - name: Run E2E tests |
| 105 | + working-directory: sandbox/kirby/panel |
| 106 | + run: npm run test:e2e |
| 107 | + env: |
| 108 | + BASE_URL: http://localhost:8000 |
0 commit comments