ci: update docker image test to test-cross-platform.yml #34
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test-cross-platform | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
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: | |
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 | |
- macos-13 # macos-13 or macos-13-large | |
- macos-12 # macos-12 or macos-12-large | |
- ubuntu-24.04 # ubuntu-24.04 | |
- ubuntu-22.04 # ubuntu-latest or ubuntu-22.04 | |
# - ubuntu-20.04 # ubuntu-20.04 | |
- windows-2022 # windows-latest or windows-2022 | |
# - windows-2019 # windows-2019 | |
runs-on: ${{ matrix.runner-image }} | |
steps: | |
- name: Set up checkout | |
uses: actions/checkout@v4 | |
- name: Set up node | |
uses: actions/setup-node@v4 | |
- name: Set up node_modules | |
run: npm ci | |
- name: Debug GLIBC version | |
if: runner.os == 'Linux' | |
run: ldd --version | |
- name: Build | |
run: npm run build | |
- name: Chmod | |
run: npm run postinstall | |
- name: Debug Permission | |
if: runner.os != 'Windows' | |
run: ls -alR build/bin | |
- 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 | |
" |