Skip to content

Commit a0429bc

Browse files
committed
feat: add github actions cleanup
1 parent 3ac1f18 commit a0429bc

2 files changed

Lines changed: 44 additions & 3 deletions

File tree

.github/workflows/run-all-unit-tests.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ jobs:
2626
with:
2727
node-version: '24.x'
2828
cache: 'npm'
29-
- name: Setup tmate session
30-
uses: mxschmitt/action-tmate@v3
3129
- name: Enable linger for admin user (Linux only)
3230
if: runner.os == 'Linux'
3331
run: loginctl enable-linger $(whoami)
3432
- run: npm ci
35-
- run: npx tsx scripts/cleanup-circleci.ts
33+
- run: npx tsx scripts/cleanup-github-actions.ts
34+
35+
- name: Setup tmate session
36+
uses: mxschmitt/action-tmate@v3
37+
3638
- run: npm run test -- ./test --no-file-parallelism --disable-console-intercept

scripts/cleanup-github-actions.ts

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { PluginTester, testSpawn } from '@codifycli/plugin-test';
2+
import path from 'node:path';
3+
4+
const pluginPath = path.resolve('./src/index.ts');
5+
6+
// Uninstall resources that have Codify resource definitions
7+
await PluginTester.uninstall(pluginPath, [
8+
{ type: 'docker' }
9+
]);
10+
11+
// Remove pre-installed tools that don't have Codify resources
12+
// Python — remove all python-related binaries and symlinks
13+
await testSpawn('bash -c \'rm -f /usr/bin/python* /usr/local/bin/python*\'', { requiresRoot: true });
14+
15+
16+
// Go
17+
await testSpawn('bash -c \'rm -f /usr/bin/go* /usr/local/bin/go* && rm -rf /usr/local/go\'', { requiresRoot: true });
18+
19+
// Ruby — remove binaries and gems
20+
await testSpawn('bash -c \'rm -f /usr/bin/ruby* /usr/local/bin/ruby* /usr/bin/gem* /usr/local/bin/gem*\'', { requiresRoot: true });
21+
22+
// Zig
23+
await testSpawn('bash -c \'rm -f /usr/bin/zig* /usr/local/bin/zig*\'', { requiresRoot: true });
24+
25+
// Google Cloud SDK
26+
await testSpawn('rm -rf /opt/google/google-cloud-sdk', { requiresRoot: true });
27+
28+
// Apache Maven
29+
await testSpawn('rm -rf /usr/local/apache-maven', { requiresRoot: true });
30+
31+
// Gradle
32+
await testSpawn('rm -rf /usr/local/gradle-*', { requiresRoot: true });
33+
34+
// Yarn (installed via ~/.yarn and ~/.config/yarn)
35+
await testSpawn('rm -rf ~/.yarn ~/.config/yarn');
36+
37+
// Docker — remove user-level config and data directories
38+
await testSpawn('rm -rf ~/.docker');
39+

0 commit comments

Comments
 (0)