Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM mcr.microsoft.com/devcontainers/base:1.0.20-bookworm
FROM mcr.microsoft.com/devcontainers/base:2.1.9-trixie
18 changes: 8 additions & 10 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
{
"name": "PF dev-feat DEV",
"build": {
"dockerfile": "Dockerfile",
"options": [
"--add-host=host.docker.internal:host-gateway"
]
"dockerfile": "Dockerfile"
Comment thread
eraserix marked this conversation as resolved.
},
"runArgs": [
"--add-host=host.docker.internal:host-gateway"
],
"containerEnv": {
"GOMODCACHE": "${containerWorkspaceFolder}/.go_cache"
},
"features": {
"ghcr.io/postfinance/devcontainer-features/go:1.0.0": {
"version": "1.25.9"
"version": "1.26.5"
},
"ghcr.io/postfinance/devcontainer-features/docker-out:1.0.0": {
"version": "29.6.2",
"composeVersion": "5.3.1",
"buildxVersion": "0.35.0"
},
"ghcr.io/devcontainers/features/docker-outside-of-docker:1": {},
"ghcr.io/devcontainers-extra/features/devcontainers-cli:1": {}
},
"customizations": {
Expand All @@ -26,4 +24,4 @@
]
}
}
}
}
59 changes: 49 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,61 @@ on:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 20 * * 2'
timezone: Europe/Zurich
workflow_dispatch:
inputs:
force-tests:
description: 'Force build/test even if version is already published'
required: false
default: 'false'
default: false
type: boolean
strategy-fail-fast:
description: 'Keep matrix fail-fast enabled (set false to continue running remaining matrix jobs after a failure)'
required: false
default: true
type: boolean

env:
GO_VERSION: 1.25.9
GO_VERSION: 1.26.5
NODE_VERSION: 22

jobs:
# README Consistency Job
verify-readme-files:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup environment
uses: ./.github/actions/setup-env
with:
go-version: ${{ env.GO_VERSION }}
node-version: ${{ env.NODE_VERSION }}

- name: Update README files
run: go run ./build --target "Update-Readme-Files"

- name: Verify README files are up to date
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "README files are out of date. Run 'go run ./build --target Update-Readme-Files' and commit the changes."
git --no-pager status --short
exit 1
fi

# Build Job
build:
needs: verify-readme-files
strategy:
# we want to fail-fast unless:
# - workflow inputs specifies not to fail-fast
# - scheduled build
fail-fast: ${{ github.event_name != 'schedule' && (github.event_name != 'workflow_dispatch' || inputs.strategy-fail-fast) }}
Comment thread
eraserix marked this conversation as resolved.
matrix:
feature: [
"browsers",
Expand Down Expand Up @@ -76,36 +115,36 @@ jobs:
- name: Check if version already published
id: check-version
run: |
if [[ "${{ inputs.force-tests }}" == "true" ]]; then
echo "already_published=false" >> $GITHUB_OUTPUT
if [[ "${{ github.event_name }}" == "schedule" || ( "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.force-tests }}" == "true" ) ]]; then
Comment thread
eraserix marked this conversation as resolved.
echo "run_tests=true" >> $GITHUB_OUTPUT
else
VERSION=$(jq -r '.version' features/src/${{ matrix.feature }}/devcontainer-feature.json)
if docker manifest inspect "ghcr.io/postfinance/devcontainer-features/${{ matrix.feature }}:$VERSION" > /dev/null 2>&1; then
echo "already_published=true" >> $GITHUB_OUTPUT
echo "run_tests=false" >> $GITHUB_OUTPUT
else
echo "already_published=false" >> $GITHUB_OUTPUT
echo "run_tests=true" >> $GITHUB_OUTPUT
fi
fi

- name: Setup environment
if: steps.check-version.outputs.already_published == 'false'
if: ${{ steps.check-version.outputs.run_tests == 'true' }}
uses: ./.github/actions/setup-env
with:
go-version: ${{ env.GO_VERSION }}
node-version: ${{ env.NODE_VERSION }}

- name: Build
if: steps.check-version.outputs.already_published == 'false'
if: ${{ steps.check-version.outputs.run_tests == 'true' }}
run: go run ./build --target "Feature:${{ matrix.feature }}:Package"

- name: Test
if: steps.check-version.outputs.already_published == 'false'
if: ${{ steps.check-version.outputs.run_tests == 'true' }}
run: go run ./build --target "Feature:${{ matrix.feature }}:Test"

# Publish Job
publish:
needs: build
if: github.ref == 'refs/heads/main'
if: ${{ github.ref == 'refs/heads/main' && github.event_name != 'schedule' }}
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
20 changes: 20 additions & 0 deletions features/src/playwright-deps/NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,23 @@ Also don't forget to add `.ms-playwright` to your `.gitignore` file.
### Download URL from within Playwright

To change the downloads that Playwright does to a custom remote, you can adjust the `PLAYWRIGHT_DOWNLOAD_HOST` environment variable to eg. `https://mycompany.com/artifactory/playwright-remote/`. You might also want to increase the `PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT` to something like `300000`.

### Poor performance of `playwright test --ui`

If you find the UI launched with `playwright test --ui` too slow, you can run
Playwright in server mode and connect from your host browser.

For VS Code, you only need to launch Playwright in server mode:

```sh
npx playwright test --ui-host 0.0.0.0 --ui-port 8085
```

If you are using the devcontainer CLI to build the container:

1. In your `devcontainer.json`, add a port forward:
```json
"appPort": [ "32222:8085" ]
```
2. Launch Playwright in server mode: `npx playwright test --ui-host 0.0.0.0 --ui-port 8085`
3. Access Playwright from your host browser: <https://localhost:32222>
22 changes: 21 additions & 1 deletion features/src/playwright-deps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Installs all dependencies required to run Playwright.

```json
"features": {
"ghcr.io/postfinance/devcontainer-features/playwright-deps:1.0.0": {
"ghcr.io/postfinance/devcontainer-features/playwright-deps:2.0.0": {
"installChromiumDeps": true,
"installFirefoxDeps": true,
"installWebkitDeps": true
Expand Down Expand Up @@ -50,3 +50,23 @@ Also don't forget to add `.ms-playwright` to your `.gitignore` file.
### Download URL from within Playwright

To change the downloads that Playwright does to a custom remote, you can adjust the `PLAYWRIGHT_DOWNLOAD_HOST` environment variable to eg. `https://mycompany.com/artifactory/playwright-remote/`. You might also want to increase the `PLAYWRIGHT_DOWNLOAD_CONNECTION_TIMEOUT` to something like `300000`.

### Poor performance of `playwright test --ui`

If you find the UI launched with `playwright test --ui` too slow, you can run
Playwright in server mode and connect from your host browser.

For VS Code, you only need to launch Playwright in server mode:

```sh
npx playwright test --ui-host 0.0.0.0 --ui-port 8085
```

If you are using the devcontainer CLI to build the container:

1. In your `devcontainer.json`, add a port forward:
```json
"appPort": [ "32222:8085" ]
```
2. Launch Playwright in server mode: `npx playwright test --ui-host 0.0.0.0 --ui-port 8085`
3. Access Playwright from your host browser: <https://localhost:32222>
4 changes: 2 additions & 2 deletions features/src/playwright-deps/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "playwright-deps",
"version": "1.0.0",
"version": "2.0.0",
"name": "Playwright Dependencies",
"description": "Installs all dependencies required to run Playwright.",
"options": {
Expand All @@ -23,4 +23,4 @@
"containerEnv": {
"PLAYWRIGHT_HTML_HOST": "0.0.0.0"
}
}
}
71 changes: 33 additions & 38 deletions features/src/playwright-deps/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ var dependencies = map[string]map[string][]string{
"firefox": []string{
"libasound2t64",
"libatk1.0-0t64",
"libavcodec60",
"libcairo-gobject2",
"libcairo2",
"libdbus-1-3",
Expand Down Expand Up @@ -431,8 +432,7 @@ var dependencies = map[string]map[string][]string{
"libavif16",
},
},

"debian11": {
"ubuntu26": {
"tools": []string{
"xvfb",
"fonts-noto-color-emoji",
Expand All @@ -448,20 +448,19 @@ var dependencies = map[string]map[string][]string{
"fonts-freefont-ttf",
},
"chromium": []string{
"libasound2",
"libatk-bridge2.0-0",
"libatk1.0-0",
"libatspi2.0-0",
"libasound2t64",
"libatk-bridge2.0-0t64",
"libatk1.0-0t64",
"libatspi2.0-0t64",
"libcairo2",
"libcups2",
"libcups2t64",
"libdbus-1-3",
"libdrm2",
"libgbm1",
"libglib2.0-0",
"libglib2.0-0t64",
"libnspr4",
"libnss3",
"libpango-1.0-0",
"libwayland-client0",
"libx11-6",
"libxcb1",
"libxcomposite1",
Expand All @@ -472,18 +471,17 @@ var dependencies = map[string]map[string][]string{
"libxrandr2",
},
"firefox": []string{
"libasound2",
"libatk1.0-0",
"libasound2t64",
"libatk1.0-0t64",
"libavcodec62",
"libcairo-gobject2",
"libcairo2",
"libdbus-1-3",
"libdbus-glib-1-2",
"libfontconfig1",
"libfreetype6",
"libgdk-pixbuf-2.0-0",
"libglib2.0-0",
"libgtk-3-0",
"libharfbuzz0b",
"libglib2.0-0t64",
"libgtk-3-0t64",
"libpango-1.0-0",
"libpangocairo-1.0-0",
"libx11-6",
Expand All @@ -498,66 +496,62 @@ var dependencies = map[string]map[string][]string{
"libxi6",
"libxrandr2",
"libxrender1",
"libxtst6",
},
"webkit": []string{
"gstreamer1.0-libav",
"gstreamer1.0-plugins-bad",
"gstreamer1.0-plugins-base",
"gstreamer1.0-plugins-good",
"libatk-bridge2.0-0",
"libatk1.0-0",
"libicu78",
"libatomic1",
"libatk-bridge2.0-0t64",
"libatk1.0-0t64",
"libcairo-gobject2",
"libcairo2",
"libdbus-1-3",
"libdrm2",
"libegl1",
"libenchant-2-2",
"libepoxy0",
"libevdev2",
"libevent-2.1-7t64",
"libflite1",
"libfontconfig1",
"libfreetype6",
"libgbm1",
"libgdk-pixbuf-2.0-0",
"libgles2",
"libglib2.0-0",
"libglx0",
"libglib2.0-0t64",
"libgstreamer-gl1.0-0",
"libgstreamer-plugins-bad1.0-0",
"libgstreamer-plugins-base1.0-0",
"libgstreamer1.0-0",
"libgtk-3-0",
"libgudev-1.0-0",
"libgtk-4-1",
"libharfbuzz-icu0",
"libharfbuzz0b",
"libhyphen0",
"libicu67",
"libjpeg62-turbo",
"libjpeg-turbo8",
"liblcms2-2",
"libmanette-0.2-0",
"libnghttp2-14",
"libnotify4",
"libopengl0",
"libopenjp2-7",
"libopus0",
"libpango-1.0-0",
"libpng16-16",
"libproxy1v5",
"libpangocairo-1.0-0",
"libpng16-16t64",
"libsecret-1-0",
"libvpx12",
"libwayland-client0",
"libwayland-egl1",
"libwayland-server0",
"libwebp6",
"libwebp7",
"libwebpdemux2",
"libwoff1",
"libx11-6",
"libxcomposite1",
"libxdamage1",
"libxkbcommon0",
"libxml2",
"libxml2-16",
"libxslt1.1",
"libatomic1",
"libevent-2.1-7",
"libx264-165",
"libavif16",
},
},

"debian12": {
"tools": []string{
"xvfb",
Expand Down Expand Up @@ -723,6 +717,7 @@ var dependencies = map[string]map[string][]string{
"firefox": []string{
"libasound2",
"libatk1.0-0t64",
"libavcodec61",
"libcairo-gobject2",
"libcairo2",
"libdbus-1-3",
Expand Down
Loading