Skip to content

Bump node from a9875b5 to bde0dae in the all-docker group #958

Bump node from a9875b5 to bde0dae in the all-docker group

Bump node from a9875b5 to bde0dae in the all-docker group #958

name: Build container image
# Controls when the workflow will run
on:
workflow_dispatch:
schedule:
- cron: '0 3 * * *' # Runs daily at 3 AM UTC
push:
branches:
- 'master'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'master'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
# permissions are needed if pushing to ghcr.io
permissions:
contents: read
packages: write
checks: write
pull-requests: write
jobs:
all-tests:
strategy:
matrix:
platform:
- { name: ubuntu-latest, playwright-cache-location: ~/.cache/ms-playwright }
# Disabled macos and windows. Browsers should be identical, and we only build docker images for linux.
# - macos-latest
# - windows-latest
node-version: [24.x]
runs-on: ${{ matrix.platform.name }}
permissions:
contents: read
actions: read
checks: write
pull-requests: write
steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
- name: Setup safe-chain
run: |
npm i -g @aikidosec/safe-chain
safe-chain setup-ci
- uses: actions/checkout@v7
# deps
- run: npm ci
# unit tests
- run: npm run test:unit
- name: Publish Unit Test Report
uses: mikepenz/action-junit-report@v6
if: success() || failure() # always run even if the previous step fails
with:
check_name: Unit test report (${{ matrix.platform.name }}, ${{ matrix.node-version }})
report_paths: 'test-results/TEST-**.xml'
annotate_notice: true
# playwright setup
- name: Get installed Playwright version
id: playwright-version
run: echo "PLAYWRIGHT_VERSION=$(npm ls --json @playwright/test | jq -r '.dependencies.["@playwright/test"].version')" >> $GITHUB_ENV
- name: Cache playwright binaries
uses: actions/cache@v6
id: playwright-cache
with:
path: ${{ matrix.platform.playwright-cache-location }}
key: ${{ matrix.platform.name }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
- run: npx playwright install --with-deps
if: steps.playwright-cache.outputs.cache-hit != 'true'
# webkit can't be cached
- run: npx playwright install webkit --with-deps
# e2e tests
- run: npm run build
- run: npm run test:e2e
- name: Publish E2E Test Report
uses: mikepenz/action-junit-report@v6
if: success() || failure() # always run even if the previous step fails
with:
check_name: E2E test report (${{ matrix.platform.name }}, ${{ matrix.node-version }})
report_paths: playwright-report/TEST-**.xml
annotate_notice: true
test-results:
if: ${{ always() }}
runs-on: ubuntu-latest
name: Cross-platform tests composite result
needs: [all-tests]
steps:
- run: |
result="${{ needs.all-tests.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
exit 0
else
exit 1
fi
build-image:
needs: all-tests
runs-on: ubuntu-latest
steps:
- name: Save current date
id: set-date
run: echo "DATE=$(date -Iseconds)" >> $GITHUB_OUTPUT
# Get the repository's code
- name: Checkout
uses: actions/checkout@v7
- name: Compute short SHA
id: sha
run: echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_OUTPUT
- name: Install qemu dependency
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build
id: build-image
uses: redhat-actions/buildah-build@v3
with:
tags: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ steps.sha.outputs.SHORT_SHA }}
labels: |
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ steps.set-date.outputs.DATE }}
containerfiles: |
./Dockerfile
# platforms: linux/amd64,linux/arm64
platforms: linux/amd64
context: .
- name: Push to GHCR
id: push-to-ghcr
uses: redhat-actions/push-to-registry@v3
if: github.event_name != 'pull_request'
with:
tags: ${{ steps.build-image.outputs.tags }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}