-
-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (138 loc) · 4.57 KB
/
test-cross-platform.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: test-cross-platform
on:
push:
branches: [main]
paths-ignore:
- '**/*.md'
pull_request:
branches: [main]
paths-ignore:
- '**/*.md'
jobs:
build-packages:
runs-on: ubuntu-latest
steps:
- name: Set up checkout
uses: actions/checkout@v4
- name: Set up node
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: npm
- name: Set up cache
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Set up node_modules
run: npm ci
- name: Build packages
run: |
mkdir packs
npm pack --workspace packages --pack-destination packs
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: packs
path: ./packs
github-actions-runner-images:
strategy:
matrix:
runner-image:
- macos-15
- macos-14
- macos-13
- ubuntu-24.04
- ubuntu-22.04
- windows-2022
node-version:
- 22
- 20
- 18
- 16
runs-on: ${{ matrix.runner-image }}
needs: build-packages
steps:
- name: Set up node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Download artifact
uses: actions/download-artifact@v4
with:
path: .
- name: Initialize npm
run: npm init -y
- name: Debug directory structure
if: runner.os != 'Windows'
run: ls -alR
- name: Debug GLIBC version
if: runner.os == 'Linux'
run: ldd --version
- name: Install packages
if: runner.os != 'Windows'
run: |
npm install $(find . -name "clang-format-node-*.tgz")
npm install $(find . -name "clang-format-git-*.tgz")
- name: Install packages
if: runner.os == 'Windows'
run: |
Get-ChildItem -Recurse -Filter "clang-format-node-*.tgz" | ForEach-Object { npm install $_.FullName }
Get-ChildItem -Recurse -Filter "clang-format-git-*.tgz" | ForEach-Object { npm install $_.FullName }
- name: Test clang-format-git
run: npx clang-format-git --help
- name: Test clang-format-git-python
run: npx clang-format-git-python --help
- name: Test clang-format-node
run: |
npx clang-format-node --help
npx clang-format-node --version
docker-images:
strategy:
matrix:
docker:
- platform: arm/v7
ubuntu-image: arm32v7
node-name: arm
- platform: arm64/v8
ubuntu-image: arm64v8
node-name: arm64
- platform: ppc64le
ubuntu-image: ppc64le
node-name: ppc64
- platform: s390x
ubuntu-image: s390x
node-name: s390x
runs-on: ubuntu-22.04
steps:
- name: Set up checkout
uses: actions/checkout@v4
- name: Set up QEMU
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- name: Docker run background
run: docker run -d --name ${{ matrix.docker.node-name }} --platform linux/${{ matrix.docker.platform }} ${{ matrix.docker.ubuntu-image }}/ubuntu:22.04 tail -f /dev/null
- name: Copy git-clang-format file to Docker container
run: docker cp ./packages/clang-format-git/src/bin/cfg-linux-${{ matrix.docker.node-name }}/git-clang-format ${{ matrix.docker.node-name }}:/
- name: Copy clang-format file to Docker container
run: docker cp ./packages/clang-format-node/src/bin/cfn-linux-${{ matrix.docker.node-name }}/clang-format ${{ matrix.docker.node-name }}:/
- name: Docker exec
run: |
docker exec ${{ matrix.docker.node-name }} /bin/bash -c "
echo ---Set up dependencies--- &&
apt update -y &&
apt install -y git &&
echo ---Debug uname -m--- &&
uname -m &&
echo ---Debug pwd--- &&
pwd &&
echo ---Debug ls -l--- &&
ls -l /git-clang-format /clang-format &&
echo ---Chmod--- &&
chmod 755 /git-clang-format /clang-format &&
ls -l /git-clang-format /clang-format &&
echo ---Test git-clang-format--- &&
/git-clang-format --help &&
echo ---Test clang-format--- &&
/clang-format --help &&
/clang-format --version
"