Skip to content

Commit c1b0e10

Browse files
authored
Merge pull request #232 from yomaytk/refac-ci
Refactored `.github/workflows/tests.yml`
2 parents 587fd27 + 0892684 commit c1b0e10

1 file changed

Lines changed: 36 additions & 49 deletions

File tree

.github/workflows/tests.yml

Lines changed: 36 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -17,54 +17,49 @@ permissions:
1717
contents: read
1818

1919
jobs:
20-
build-and-test-aarch64:
21-
runs-on: ubuntu-22.04-arm
22-
name: AArch64 Build-and-Run
20+
build-and-test:
21+
name: ${{ matrix.arch }} Build-and-Run
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
include:
26+
- arch: AArch64
27+
runner: ubuntu-22.04-arm
28+
build-arg: ECV_AARCH64=1
29+
- arch: AMD64
30+
runner: ubuntu-22.04
31+
build-arg: ECV_X86=1
32+
runs-on: ${{ matrix.runner }}
2333
steps:
2434
- name: Checkout
2535
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
2636

2737
- name: build container image
28-
run: docker build . --build-arg ECV_AARCH64=1 -t elfconv-image
38+
run: docker build . --build-arg ${{ matrix.build-arg }} -t elfconv-image
2939

3040
- name: run integration test
31-
run: docker run --rm -w /root/elfconv/build elfconv-image "ninja test_dependencies && ctest"
32-
33-
build-and-test-amd64:
34-
runs-on: ubuntu-22.04
35-
name: AMD64 Build-and-Run
36-
steps:
37-
- name: Checkout
38-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
39-
40-
- name: build container image
41-
run: docker build . --build-arg ECV_X86=1 -t elfconv-image
42-
43-
- name: run instruction tests
4441
run: docker run --rm -w /root/elfconv/build elfconv-image "ninja test_dependencies && ctest --output-on-failure"
4542

46-
browser-test-aarch64:
47-
runs-on: ubuntu-22.04-arm
48-
name: Browser Integration Test (hello_world)
49-
steps:
50-
- name: Checkout
51-
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
52-
53-
- name: build container image
54-
run: docker build . --build-arg ECV_AARCH64=1 -t elfconv-image
55-
56-
- name: run browser test
57-
run: |
58-
docker run --rm -w /root/elfconv elfconv-image \
59-
"cd tests/browser && \
60-
npm install && \
61-
npx playwright install --with-deps chromium && \
62-
bash build.sh hello && \
63-
npx playwright test --project=hello"
64-
65-
browser-test-bash-aarch64:
43+
browser-test:
6644
runs-on: ubuntu-22.04-arm
67-
name: Browser Integration Test (bash)
45+
name: Browser Integration Test (${{ matrix.project }})
46+
strategy:
47+
fail-fast: false
48+
matrix:
49+
include:
50+
- project: hello
51+
setup: "true"
52+
- project: bash
53+
setup: >-
54+
apt-get update && apt-get install -qqy --no-install-recommends bash-static &&
55+
BUSYBOX_VERSION=1.36.1 &&
56+
wget -q https://busybox.net/downloads/busybox-\${BUSYBOX_VERSION}.tar.bz2 &&
57+
tar xjf busybox-\${BUSYBOX_VERSION}.tar.bz2 &&
58+
cp examples/examples-repos/.config busybox-\${BUSYBOX_VERSION}/.config &&
59+
make -C busybox-\${BUSYBOX_VERSION} -j\$(nproc) &&
60+
mkdir -p examples/examples-repos/busybox &&
61+
cp busybox-\${BUSYBOX_VERSION}/busybox examples/examples-repos/busybox/busybox &&
62+
rm -rf busybox-\${BUSYBOX_VERSION} busybox-\${BUSYBOX_VERSION}.tar.bz2
6863
steps:
6964
- name: Checkout
7065
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
@@ -75,17 +70,9 @@ jobs:
7570
- name: run browser test
7671
run: |
7772
docker run --rm -w /root/elfconv elfconv-image \
78-
"apt-get update && apt-get install -qqy --no-install-recommends bash-static && \
79-
BUSYBOX_VERSION=1.36.1 && \
80-
wget -q https://busybox.net/downloads/busybox-\${BUSYBOX_VERSION}.tar.bz2 && \
81-
tar xjf busybox-\${BUSYBOX_VERSION}.tar.bz2 && \
82-
cp examples/examples-repos/.config busybox-\${BUSYBOX_VERSION}/.config && \
83-
make -C busybox-\${BUSYBOX_VERSION} -j\$(nproc) && \
84-
mkdir -p examples/examples-repos/busybox && \
85-
cp busybox-\${BUSYBOX_VERSION}/busybox examples/examples-repos/busybox/busybox && \
86-
rm -rf busybox-\${BUSYBOX_VERSION} busybox-\${BUSYBOX_VERSION}.tar.bz2 && \
73+
"${{ matrix.setup }} && \
8774
cd tests/browser && \
8875
npm install && \
8976
npx playwright install --with-deps chromium && \
90-
bash build.sh bash && \
91-
npx playwright test --project=bash"
77+
bash build.sh ${{ matrix.project }} && \
78+
npx playwright test --project=${{ matrix.project }}"

0 commit comments

Comments
 (0)