Skip to content

Commit

Permalink
ci: update docker image test to test-cross-platform.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
lumirlumir committed Sep 10, 2024
1 parent 6fbdbb4 commit 89380c4
Showing 1 changed file with 72 additions and 2 deletions.
74 changes: 72 additions & 2 deletions .github/workflows/test-cross-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,27 @@ on:
branches: [main]

jobs:
# stage1
setup-env:
runs-on: ubuntu-latest

steps:
- name: Set up environment variables
run: |
REPOSITORY_NAME=$(echo "${{ github.repository }}" | cut -d '/' -f2)
echo "REPOSITORY_NAME=$REPOSITORY_NAME" >> $GITHUB_ENV
echo "REPOSITORY_NAME: $REPOSITORY_NAME"
outputs:
REPOSITORY_NAME: ${{ env.REPOSITORY_NAME }}

# stage2
github-actions-runner-images:
needs: [setup-env]

strategy:
matrix:
os-version:
runner-image:
# - macos-14-large # macos-latest-large or macos-14-large
- macos-14 # macos-latest, macos-14, macos-latest-xlarge or macos-14-xlarge
# - macos-13-xlarge # macos-13-xlarge
Expand All @@ -23,7 +40,7 @@ jobs:
- windows-2022 # windows-latest or windows-2022
# - windows-2019 # windows-2019

runs-on: ${{ matrix.os-version }}
runs-on: ${{ matrix.runner-image }}

steps:
- name: Set up checkout
Expand Down Expand Up @@ -51,3 +68,56 @@ jobs:

- name: Test
run: npx clang-format --version

# stage2
docker-images:
needs: [setup-env]

strategy:
matrix:
docker:
- platform: arm/v7
ubuntu-image: arm32v7
- platform: arm64/v8
ubuntu-image: arm64v8
- platform: ppc64le
ubuntu-image: ppc64le
- platform: s390x
ubuntu-image: s390x

runs-on: ubuntu-22.04

steps:
- name: Set up QEMU
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes

- name: Docker run
run: |
docker run --platform linux/${{ matrix.docker.platform }} ${{ matrix.docker.ubuntu-image }}/ubuntu:22.04 /bin/bash -c "
echo ---Debug architecture and working directory--- &&
uname -m &&
pwd &&
echo ---Set up environment variables--- &&
export DEBIAN_FRONTEND=noninteractive &&
echo ---Set up dependencies using apt--- &&
apt update -y &&
apt install -y git nodejs &&
echo ---Set up checkout--- &&
git clone --depth 1 https://github.com/${{ github.repository }}.git &&
cd ${{ needs.setup-env.outputs.REPOSITORY_NAME }} &&
echo ---Set up node_modules--- &&
npm ci &&
echo ---Build--- &&
npm run build &&
echo ---Chmod--- &&
npm run postinstall &&
echo ---Test--- &&
npx clang-format --version
"

0 comments on commit 89380c4

Please sign in to comment.