Skip to content

Commit 177b8bc

Browse files
committed
Create linux builds for old machines
1 parent 0e6f266 commit 177b8bc

File tree

5 files changed

+76
-35
lines changed

5 files changed

+76
-35
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
fail-fast: true
1414
matrix:
15-
os: [ ubuntu-22.04, macos-latest ]
15+
os: [ ubuntu-latest, macos-latest ]
1616
with:
1717
ref: ${{ github.sha }}
1818
runs-on: ${{ matrix.os }}

.github/workflows/pr.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: true
1616
matrix:
17-
os: [ ubuntu-22.04, macos-latest ]
17+
os: [ ubuntu-latest, macos-latest ]
1818
runs-on: ${{ matrix.os }}
1919
permissions:
2020
contents: read
@@ -46,7 +46,7 @@ jobs:
4646
strategy:
4747
fail-fast: true
4848
matrix:
49-
os: [ ubuntu-22.04, macos-latest ]
49+
os: [ ubuntu-latest, macos-latest ]
5050
runs-on: ${{ matrix.os }}
5151
steps:
5252
- uses: actions/checkout@v5

.github/workflows/release.yml

Lines changed: 50 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,20 @@ jobs:
6464
strategy:
6565
fail-fast: true
6666
matrix:
67-
os: [ ubuntu-22.04, windows-latest, macos-latest ]
67+
os: [ ubuntu-latest, windows-latest, macos-latest ]
6868
with:
6969
ref: ${{ needs.version-and-tag.outputs.tag }}
7070
runs-on: ${{ matrix.os }}
7171

72-
bundle-linux:
72+
bundle-linux-old:
7373
needs: [ get-configs, version-and-tag, build-and-test ]
7474
strategy:
7575
fail-fast: true
7676
matrix:
7777
include:
78-
- { arch: "x64", docker-platform: "linux/amd64", go-arch: "amd64", use_qemu: false, node-version: "22" }
79-
- { arch: "arm64", docker-platform: "linux/arm64", go-arch: "arm64", use_qemu: true, node-version: "22" }
80-
runs-on: ubuntu-22.04
78+
- { arch: "x64", docker-platform: "linux/amd64", go-arch: "amd64", use_qemu: false, node-version: "18" }
79+
- { arch: "arm64", docker-platform: "linux/arm64", go-arch: "arm64", use_qemu: true, node-version: "18" }
80+
runs-on: ubuntu-latest
8181
steps:
8282
- uses: actions/checkout@v5
8383
with:
@@ -95,11 +95,11 @@ jobs:
9595
9696
TAG=${{ needs.version-and-tag.outputs.tag }}
9797
if [[ "$TAG" =~ -alpha$ ]]; then
98-
FILE_NAME="${APP_NAME}-${VERSION}-alpha-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
98+
FILE_NAME="${APP_NAME}-${VERSION}-alpha-glib2.28-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
9999
elif [[ "$TAG" =~ -beta$ ]]; then
100-
FILE_NAME="${APP_NAME}-${VERSION}-beta-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
100+
FILE_NAME="${APP_NAME}-${VERSION}-beta-glib2.28-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
101101
else
102-
FILE_NAME="${APP_NAME}-${VERSION}-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
102+
FILE_NAME="${APP_NAME}-${VERSION}-glib2.28-linux-${{ matrix.arch }}-node${NODE_MAJOR}"
103103
fi
104104
105105
ASSET_NAME=$(echo "$FILE_NAME" | tr '[:upper:]' '[:lower:]')
@@ -109,38 +109,60 @@ jobs:
109109
if: matrix.use_qemu
110110
uses: docker/setup-qemu-action@v3
111111

112-
- name: Bundle (${{ matrix.docker-platform }}
112+
- name: Bundle (${{ matrix.docker-platform }}-${{ node-version }})
113113
run: |
114-
docker run --rm -v ${{ github.workspace }}:/work -w /work \
114+
docker run --rm -t -v ${{ github.workspace }}:/work -w /work \
115115
--platform ${{ matrix.docker-platform }} \
116-
amazonlinux:2023 \
116+
node:18-buster \
117117
/bin/bash -c '
118-
set -ex
119-
yum install -y make gcc-c++ python3 tar gzip wget tree
118+
set -e
119+
120+
git config --global --add safe.directory /work
121+
echo "deb http://archive.debian.org/debian buster main" > /etc/apt/sources.list
122+
echo "deb http://archive.debian.org/debian-security buster/updates main" >> /etc/apt/sources.list
123+
apt-get -o Acquire::Check-Valid-Until=false update
124+
125+
apt-get update
126+
apt-get install -y make g++ python3 build-essential tar gzip wget tree
127+
128+
SYS_LIB=$(find /usr/lib -name libstdc++.so.6 | head -n 1)
129+
SYS_MAX=$(strings "$SYS_LIB" | grep "GLIBCXX_[0-9]" | sort -V | tail -n 1)
130+
SYS_MIN=$(strings "$SYS_LIB" | grep "GLIBCXX_[0-9]" | sort -V | head -n 1)
131+
echo "----------------------------------------------------------------"
132+
echo "SYSTEM BASELINE:"
133+
echo "Library Path: $SYS_LIB"
134+
echo "Max GLIBCXX Supported: $SYS_MAX"
135+
echo "Min GLIBCXX Supported: $SYS_MIN"
136+
echo "----------------------------------------------------------------"
120137
121138
wget -q https://go.dev/dl/go${{ needs.get-configs.outputs.go-version }}.linux-${{ matrix.go-arch }}.tar.gz
122139
tar -C /usr/local -xzf go${{ needs.get-configs.outputs.go-version }}.linux-${{ matrix.go-arch }}.tar.gz
123140
export PATH=$PATH:/usr/local/go/bin
124141
125-
curl -fsSL https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash
126-
export NVM_DIR="$HOME/.nvm"
127-
. "$NVM_DIR/nvm.sh"
128-
nvm install ${{ matrix.node-version }}
129-
nvm use ${{ matrix.node-version }}
142+
uname -r && node -v && npm -v && go version
130143
131144
npm ci
132145
133146
TAG="${{ needs.version-and-tag.outputs.tag }}"
134147
if [[ "$TAG" =~ -alpha$ ]]; then
135-
npm run bundle:alpha
148+
npm run bundle:alpha -- --env rebuild=true
136149
elif [[ "$TAG" =~ -beta$ ]]; then
137-
npm run bundle:beta
150+
npm run bundle:beta -- --env rebuild=true
138151
else
139-
npm run bundle:prod
152+
npm run bundle:prod -- --env rebuild=true
140153
fi
141154
142-
tree -f bundle/production/node_modules/tree-sitter
143-
tree -f bundle/production/node_modules/tree-sitter-json
155+
if [ -z "$(find . -name "*.node" -print -quit)" ]; then
156+
echo "::warning::No .node files found to check"
157+
exit 1
158+
else
159+
find . -name "*.node" -print0 | while IFS= read -r -d "" file; do
160+
echo "Inspecting: $file"
161+
FILE_MAX=$(strings "$file" | grep "GLIBCXX_[0-9]" | sort -V | tail -n 1)
162+
FILE_MIN=$(strings "$file" | grep "GLIBCXX_[0-9]" | sort -V | head -n 1)
163+
echo " > FileMAX - $FILE_MAX FileMIN - $FILE_MIN"
164+
done
165+
fi
144166
145167
GOARCH=${{ matrix.go-arch }} go build -C ./cfn-init/cmd -v -o ../../bundle/production/bin/cfn-init
146168
cp ./cfn-init/THIRD-PARTY-LICENSES.txt ./bundle/production/bin/
@@ -155,12 +177,14 @@ jobs:
155177
include-hidden-files: true
156178
compression-level: 6
157179

158-
bundle-win-mac:
180+
bundle:
159181
needs: [ get-configs, version-and-tag, build-and-test ]
160182
strategy:
161183
fail-fast: true
162184
matrix:
163185
include:
186+
- { os: "ubuntu-latest", arch: "x64", platform: "linux", go-arch: "amd64", node-version: "22.x" }
187+
- { os: "ubuntu-24.04-arm", arch: "arm64", platform: "linux", go-arch: "arm64", node-version: "22.x" }
164188
- { os: "macos-15-intel", arch: "x64", platform: "darwin", go-arch: "amd64", node-version: "22.x" }
165189
- { os: "macos-latest", arch: "arm64", platform: "darwin", go-arch: "arm64", node-version: "22.x" }
166190
- { os: "windows-latest", arch: "x64", platform: "win32", go-arch: "amd64", node-version: "22.x" }
@@ -191,7 +215,7 @@ jobs:
191215
- name: Install Dependencies
192216
run: npm ci
193217

194-
- name: Bundle (${{ matrix.platform }}-${{ matrix.arch }})
218+
- name: Bundle (${{ matrix.platform }}/${{ matrix.arch }}-${{ node-version }})
195219
shell: bash
196220
run: |
197221
TAG=${{ needs.version-and-tag.outputs.tag }}
@@ -249,7 +273,7 @@ jobs:
249273
compression-level: 6
250274

251275
release:
252-
needs: [ version-and-tag, bundle-linux, bundle-win-mac ]
276+
needs: [ version-and-tag, bundle-linux-old, bundle ]
253277
runs-on: ubuntu-latest
254278
permissions:
255279
contents: write

package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,5 +177,10 @@
177177
],
178178
"unusedDependencies": [
179179
"cbor-x"
180+
],
181+
"rebuildDependencies": [
182+
"@tree-sitter-grammars/tree-sitter-yaml",
183+
"tree-sitter",
184+
"tree-sitter-json"
180185
]
181186
}

webpack.config.js

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ function generateExternals() {
5656

5757
const EXTERNALS = generateExternals();
5858

59-
function createPlugins(isDevelopment, outputPath, mode, env) {
59+
function createPlugins(isDevelopment, outputPath, mode, env, rebuild = false) {
6060
const plugins = [];
6161

6262
plugins.push(
@@ -131,18 +131,29 @@ function createPlugins(isDevelopment, outputPath, mode, env) {
131131
execSync('npm ci --omit=dev', { cwd: tmpDir, stdio: 'inherit' });
132132

133133
const externals = ExternalsDeps.map((dep) => {
134-
if (dep === 'cfn-guard') {
135-
return `${dep}@${PackageLock.packages[`node_modules/${dep}`].version}`;
136-
}
137134
return `${dep}@${PackageLock.packages[`node_modules/${dep}`].version}`;
138135
});
139136
console.log(
140137
`[InstallDependencies] Installing externals: ${JSON.stringify(externals, null, 2)}`,
141138
);
142-
execSync(`npm install --save-exact ${externals.join(' ')}`, {
139+
execSync(`npm install --save-exact --${externals.join(' ')}`, {
143140
cwd: tmpDir,
144141
stdio: 'inherit',
145142
});
143+
144+
if (rebuild) {
145+
const rebuildDeps = Package.rebuildDependencies || [];
146+
console.log(`[InstallDependencies] Rebuilding: ${rebuildDeps.join(' ')}`);
147+
for (const dep of rebuildDeps) {
148+
const prebuildPath = path.join(tmpDir, 'node_modules', dep, 'prebuilds');
149+
if (fs.existsSync(prebuildPath)) {
150+
console.log(`[InstallDependencies] Removing prebuilds: ${prebuildPath}`);
151+
fs.rmSync(prebuildPath, { recursive: true, force: true });
152+
}
153+
}
154+
execSync(`npm rebuild ${rebuildDeps.join(' ')}`, { cwd: tmpDir, stdio: 'inherit' });
155+
}
156+
146157
callback();
147158
} catch (error) {
148159
console.error('[InstallDependencies] Error:', error);
@@ -262,6 +273,7 @@ const baseConfig = {
262273
module.exports = (env = {}) => {
263274
const mode = env.mode;
264275
let awsEnv = env.env;
276+
const rebuild = env.rebuild === 'true' || env.rebuild === true;
265277

266278
// Validate mode
267279
const validModes = ['development', 'production'];
@@ -315,6 +327,6 @@ module.exports = (env = {}) => {
315327
chunks: 'all',
316328
},
317329
},
318-
plugins: createPlugins(isDevelopment, outputPath, mode, awsEnv),
330+
plugins: createPlugins(isDevelopment, outputPath, mode, awsEnv, rebuild),
319331
};
320332
};

0 commit comments

Comments
 (0)