Skip to content

Commit 3f76811

Browse files
committed
.github: Use devcontainer to run integration UI tests
1 parent 4d66334 commit 3f76811

1 file changed

Lines changed: 34 additions & 38 deletions

File tree

.github/workflows/pre-merge.yaml

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -358,32 +358,31 @@ jobs:
358358
run: poetry run pytest -vv
359359

360360
build_integration_container_nginx:
361-
needs: changed-files
361+
runs-on: ubuntu-latest
362+
needs:
363+
- build-devcontainer
364+
- changed-files
365+
container:
366+
image: ghcr.io/${{ github.repository }}/devcontainer:${{ github.sha }}
367+
# We have to use `root` for the moment
368+
# Sees: https://github.com/actions/checkout/issues/1575
369+
# Could work with a user with 1001 id but not for docker
370+
options: --user root
371+
credentials:
372+
username: ${{ github.repository_owner }}
373+
password: ${{ secrets.GITHUB_TOKEN }}
374+
defaults:
375+
run:
376+
shell: bash
362377
if: needs.changed-files.outputs.integration-tests-ui == 'true'
363-
runs-on: ubuntu-20.04
364378
permissions: write-all
365379
steps:
366380
- name: Checkout
367381
uses: actions/checkout@v4
382+
- name: Set safe directory (since container is root and not user 1001)
383+
run: git config --global --add safe.directory $GITHUB_WORKSPACE
368384
- name: Set up Docker Buildx
369385
uses: docker/setup-buildx-action@v3
370-
- name: Install node
371-
uses: actions/setup-node@v4
372-
with:
373-
node-version: "20"
374-
- name: Cache node modules
375-
id: cache-npm
376-
uses: actions/cache@v4
377-
env:
378-
cache-name: cache-node-modules
379-
with:
380-
# npm cache files are stored in `~/.npm` on Linux/macOS
381-
path: ~/.npm
382-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
383-
restore-keys: |
384-
${{ runner.os }}-build-${{ env.cache-name }}-
385-
${{ runner.os }}-build-
386-
${{ runner.os }}-
387386
- name: Install Shell UI dependencies
388387
run: |
389388
cd shell-ui
@@ -420,7 +419,6 @@ jobs:
420419
registry: ghcr.io
421420
username: ${{ github.repository_owner }}
422421
password: ${{ secrets.GITHUB_TOKEN }}
423-
424422
- uses: docker/build-push-action@v6
425423
with:
426424
push: true
@@ -429,10 +427,23 @@ jobs:
429427
tags: ghcr.io/${{ github.repository_owner }}/metalk8s-nginx-integration-tests:${{ github.sha }}
430428

431429
integration_tests_ui:
432-
runs-on: ubuntu-20.04
430+
runs-on: ubuntu-latest
433431
needs:
432+
- build-devcontainer
434433
- build_integration_container_nginx
435434
- changed-files
435+
container:
436+
image: ghcr.io/${{ github.repository }}/devcontainer:${{ github.sha }}
437+
# We have to use `root` for the moment
438+
# Sees: https://github.com/actions/checkout/issues/1575
439+
# Could work with a user with 1001 id but not for docker
440+
options: --user root
441+
credentials:
442+
username: ${{ github.repository_owner }}
443+
password: ${{ secrets.GITHUB_TOKEN }}
444+
defaults:
445+
run:
446+
shell: bash
436447
if: needs.changed-files.outputs.integration-tests-ui == 'true'
437448
services:
438449
app:
@@ -445,23 +456,8 @@ jobs:
445456
steps:
446457
- name: Checkout
447458
uses: actions/checkout@v4
448-
- name: Install node
449-
uses: actions/setup-node@v4
450-
with:
451-
node-version: "20"
452-
- name: Cache node modules
453-
id: cache-npm
454-
uses: actions/cache@v4
455-
env:
456-
cache-name: cache-node-modules
457-
with:
458-
# npm cache files are stored in `~/.npm` on Linux/macOS
459-
path: ~/.npm
460-
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
461-
restore-keys: |
462-
${{ runner.os }}-build-${{ env.cache-name }}-
463-
${{ runner.os }}-build-
464-
${{ runner.os }}-
459+
- name: Set safe directory (since container is root and not user 1001)
460+
run: git config --global --add safe.directory $GITHUB_WORKSPACE
465461
- name: Install Cypress and its dependencies
466462
run: |
467463
cd ui

0 commit comments

Comments
 (0)