Skip to content

Commit 615d758

Browse files
authored
Run CI tests on Alpine (#607)
See: #606 Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent ef1bd1a commit 615d758

3 files changed

Lines changed: 21 additions & 5 deletions

File tree

.github/workflows/test.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ jobs:
2626
cc: gcc
2727
cxx: g++
2828
shell: sh
29+
- os: ubuntu-latest
30+
type: container
31+
container: alpine:3.21
32+
cc: gcc
33+
cxx: g++
34+
shell: sh
2935
- os: macos-15-intel
3036
type: native
3137
cc: clang
@@ -48,6 +54,7 @@ jobs:
4854
shell: ${{ matrix.platform.shell }}
4955

5056
runs-on: ${{ matrix.platform.os }}
57+
container: ${{ matrix.platform.container }}
5158
env:
5259
CC: ${{ matrix.platform.cc }}
5360
CXX: ${{ matrix.platform.cxx }}
@@ -60,6 +67,10 @@ jobs:
6067
additional-packages: cmake build-essential shellcheck pipx zsh jq
6168
wsl-version: 2
6269

70+
- name: Install dependencies (Alpine)
71+
if: matrix.platform.type == 'container'
72+
run: apk add --no-cache cmake make g++ zsh bash jq shellcheck pipx git
73+
6374
- name: Install pre-commit
6475
run: pipx install pre-commit
6576
- name: Surface pipx binaries to WSL
@@ -78,7 +89,7 @@ jobs:
7889
if: runner.os == 'windows' && matrix.platform.type == 'native'
7990
run: choco install shellcheck
8091
- name: Install dependencies (Linux)
81-
if: runner.os == 'linux'
92+
if: runner.os == 'linux' && matrix.platform.type == 'native'
8293
run: sudo apt-get update --yes && sudo apt-get install --yes zsh
8394

8495
- run: cmake --version
@@ -93,6 +104,8 @@ jobs:
93104
-DBUILD_SHARED_LIBS:BOOL=OFF
94105
-DCMAKE_COMPILE_WARNING_AS_ERROR:BOOL=ON
95106
- run: cmake --build ./build --config Release --target clang_format_test
107+
# TODO: As the downloaded `clang-format` binary won't run on Alpine
108+
if: matrix.platform.type != 'container'
96109
- run: cmake --build ./build --config Release --target shellcheck
97110
- run: cmake --build ./build --config Release --parallel 4
98111
- run: >

test/ci/precommit_lint.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
set -o errexit
44
set -o nounset
55

6+
# Ensure pipx-installed binaries are in PATH
7+
export PATH="$HOME/.local/bin:$PATH"
8+
69
TMP="$(mktemp -d)"
710
clean() { rm -rf "$TMP"; }
811
trap clean EXIT

test/format/fail_check_single_json.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ TMP="$(mktemp -d)"
77
clean() { rm -rf "$TMP"; }
88
trap clean EXIT
99

10-
mkdir -p "$TMP/this/is/a/very/very/very/long/path"
10+
mkdir -p "$TMP/this/is/a/very/very/very/very/very/very/long/path"
1111

12-
cat << 'EOF' > "$TMP/this/is/a/very/very/very/long/path/schema.json"
12+
cat << 'EOF' > "$TMP/this/is/a/very/very/very/very/very/very/long/path/schema.json"
1313
{
1414
"type": "string",
1515
"$schema": "http://json-schema.org/draft-04/schema#",
@@ -18,15 +18,15 @@ cat << 'EOF' > "$TMP/this/is/a/very/very/very/long/path/schema.json"
1818
}
1919
EOF
2020

21-
"$1" fmt "$TMP/this/is/a/very/very/very/long/path/schema.json" \
21+
"$1" fmt "$TMP/this/is/a/very/very/very/very/very/very/long/path/schema.json" \
2222
--check --json >"$TMP/output.json" 2>&1 && CODE="$?" || CODE="$?"
2323
test "$CODE" = "2" || exit 1
2424

2525
cat << EOF > "$TMP/expected.json"
2626
{
2727
"valid": false,
2828
"errors": [
29-
"$(realpath "$TMP")/this/is/a/very/very/very/long/path/schema.json"
29+
"$(realpath "$TMP")/this/is/a/very/very/very/very/very/very/long/path/schema.json"
3030
]
3131
}
3232
EOF

0 commit comments

Comments
 (0)