Skip to content

Commit 34f3dce

Browse files
Merge branch 'main' into ci-node-26
2 parents 5cecd4b + 73864d3 commit 34f3dce

109 files changed

Lines changed: 1659 additions & 2465 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/actions/colima-setup/action.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/actions/docker-rootless-setup/action.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/actions/npm-setup/action.yml

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,57 +9,58 @@ inputs:
99
description: "Node.js version to use"
1010
required: true
1111
workspace:
12-
description: "Key for the cache"
12+
description: "Workspace to install"
1313
required: true
1414

1515
outputs:
1616
workspace_path:
1717
description: "Full path to the workspace directory"
18-
value: ${{ steps.set-env.outputs.workspace_path }}
18+
value: ${{ steps.set-workspace.outputs.workspace_path }}
1919

2020
runs:
2121
using: "composite"
2222
steps:
23-
- name: Install NodeJS ${{ inputs.node-version }}
24-
uses: actions/setup-node@v4
25-
with:
26-
node-version: ${{ inputs.node-version }}
27-
28-
- name: Set cache configuration
23+
- name: Set workspace path
2924
shell: bash
30-
id: set-env
25+
id: set-workspace
3126
run: |
3227
if [ "${{ inputs.workspace }}" = "testcontainers" ]; then
33-
echo "CACHE_PATHS<<EOF" >> $GITHUB_ENV
34-
echo "node_modules" >> $GITHUB_ENV
35-
echo "packages/testcontainers/node_modules" >> $GITHUB_ENV
36-
echo "EOF" >> $GITHUB_ENV
37-
echo "WORKSPACE_PATH=packages/testcontainers" >> $GITHUB_ENV
38-
echo "workspace_path=packages/testcontainers" >> "$GITHUB_OUTPUT"
28+
workspace_path="packages/testcontainers"
29+
cache_paths=$'node_modules\npackages/testcontainers/node_modules'
3930
else
40-
echo "CACHE_PATHS<<EOF" >> $GITHUB_ENV
41-
echo "node_modules" >> $GITHUB_ENV
42-
echo "packages/testcontainers/node_modules" >> $GITHUB_ENV
43-
echo "packages/modules/${{ inputs.workspace }}/node_modules" >> $GITHUB_ENV
44-
echo "EOF" >> $GITHUB_ENV
45-
echo "WORKSPACE_PATH=packages/modules/${{ inputs.workspace }}" >> $GITHUB_ENV
46-
echo "workspace_path=packages/modules/${{ inputs.workspace }}" >> "$GITHUB_OUTPUT"
31+
workspace_path="packages/modules/${{ inputs.workspace }}"
32+
cache_paths=$'node_modules\npackages/testcontainers/node_modules\n'"${workspace_path}/node_modules"
4733
fi
4834
49-
- uses: actions/cache/restore@v4
35+
echo "WORKSPACE_PATH=${workspace_path}" >> "$GITHUB_ENV"
36+
echo "workspace_path=${workspace_path}" >> "$GITHUB_OUTPUT"
37+
{
38+
echo "cache_paths<<EOF"
39+
echo "${cache_paths}"
40+
echo "EOF"
41+
} >> "$GITHUB_OUTPUT"
42+
43+
- name: Install NodeJS ${{ inputs.node-version }}
44+
uses: actions/setup-node@v6
45+
with:
46+
node-version: ${{ inputs.node-version }}
47+
package-manager-cache: false
48+
49+
- name: Restore dependencies cache
50+
uses: actions/cache/restore@v4
5051
id: npm-cache
5152
with:
52-
path: ${{ env.CACHE_PATHS }}
53-
key: ${{ inputs.runner }}-node-${{ inputs.node-version }}-${{ inputs.workspace }}-${{ hashFiles('package-lock.json') }}
53+
path: ${{ steps.set-workspace.outputs.cache_paths }}
54+
key: npm-v2-${{ inputs.runner }}-node-${{ inputs.node-version }}-${{ inputs.workspace }}-${{ hashFiles('package-lock.json') }}
5455

5556
- name: Install dependencies
5657
if: steps.npm-cache.outputs.cache-hit != 'true'
5758
shell: bash
58-
run: npm ci --workspace ${{ env.WORKSPACE_PATH }} --include-workspace-root
59+
run: npm ci --workspace "${WORKSPACE_PATH}" --include-workspace-root
5960

60-
- name: Cache npm
61+
- name: Save dependencies cache
6162
if: steps.npm-cache.outputs.cache-hit != 'true'
6263
uses: actions/cache/save@v4
6364
with:
64-
path: ${{ env.CACHE_PATHS }}
65+
path: ${{ steps.set-workspace.outputs.cache_paths }}
6566
key: ${{ steps.npm-cache.outputs.cache-primary-key }}

.github/actions/podman-setup/action.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ description: "Sets up Podman"
33
runs:
44
using: "composite"
55
steps:
6-
- name: Podman setup
6+
- name: Verify Podman
7+
shell: bash
8+
run: podman --version
9+
10+
- name: Configure Podman
711
shell: bash
812
run: |
9-
curl -fsSL "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_$(lsb_release -rs)/Release.key" | gpg --dearmor | sudo tee /etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg > /dev/null
10-
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/devel_kubic_libcontainers_unstable.gpg] https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_$(lsb_release -rs)/ /" | sudo tee /etc/apt/sources.list.d/devel:kubic:libcontainers:unstable.list > /dev/null
11-
sudo apt-get update
12-
sudo apt-get -y install podman
13-
systemctl enable --now --user podman podman.socket
14-
podman info
15-
echo "DOCKER_HOST=unix://${XDG_RUNTIME_DIR}/podman/podman.sock" >> $GITHUB_ENV
16-
echo "CI_ROOTLESS=true" >> $GITHUB_ENV
13+
PODMAN_SOCKET="${RUNNER_TEMP:-/tmp}/podman.sock"
14+
15+
sudo mkdir -p /etc/systemd/system/podman.socket.d
16+
printf '[Socket]\nListenStream=\nListenStream=%s\nSocketUser=%s\nSocketMode=0600\n' "${PODMAN_SOCKET}" "$(id -un)" | sudo tee /etc/systemd/system/podman.socket.d/runner.conf
17+
sudo systemctl daemon-reload
18+
sudo systemctl restart podman.socket
19+
podman --url="unix://${PODMAN_SOCKET}" info
20+
echo "DOCKER_HOST=unix://${PODMAN_SOCKET}" >> $GITHUB_ENV
1721
echo "CI_PODMAN=true" >> $GITHUB_ENV

.github/actions/rancher-desktop-setup/action.yml

Lines changed: 0 additions & 77 deletions
This file was deleted.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import { existsSync, readdirSync, readFileSync } from "node:fs";
2+
import { dirname, resolve } from "node:path";
3+
import process from "node:process";
4+
import { fileURLToPath } from "node:url";
5+
6+
const rootDir = resolve(dirname(fileURLToPath(import.meta.url)), "../..");
7+
8+
const ignoredPaths = [
9+
/^README\.md$/,
10+
/^docs\//,
11+
/^mkdocs\.yml$/,
12+
/^\.github\/FUNDING\.yml$/,
13+
/^\.github\/ISSUE_TEMPLATE\//,
14+
/^\.github\/release-drafter\.yml$/,
15+
];
16+
17+
const allPackagesPaths = [
18+
/^packages\/testcontainers\//,
19+
/^package(-lock)?\.json$/,
20+
/^tsconfig\.base\.json$/,
21+
/^eslint\.config\.js$/,
22+
/^vitest\.config\.ts$/,
23+
/^\.npmrc$/,
24+
/^\.github\/actions\//,
25+
/^\.github\/scripts\//,
26+
/^\.github\/workflows\/(checks|test-template)\.yml$/,
27+
];
28+
29+
const changedFiles = readFileSync(0, "utf8")
30+
.split(/\r?\n/)
31+
.map((file) => file.trim())
32+
.filter(Boolean);
33+
34+
const modulesDir = resolve(rootDir, "packages/modules");
35+
const moduleNames = new Set(
36+
readdirSync(modulesDir, { withFileTypes: true })
37+
.filter((entry) => entry.isDirectory())
38+
.filter((entry) => existsSync(resolve(modulesDir, entry.name, "package.json")))
39+
.map((entry) => entry.name)
40+
);
41+
42+
const allPackages = () => ["testcontainers", ...moduleNames].sort();
43+
const selectedPackages = new Set();
44+
45+
for (const file of changedFiles) {
46+
if (ignoredPaths.some((pattern) => pattern.test(file))) {
47+
continue;
48+
}
49+
50+
const moduleMatch = file.match(/^packages\/modules\/([^/]+)\//);
51+
if (moduleMatch) {
52+
const moduleName = moduleMatch[1];
53+
if (moduleNames.has(moduleName)) {
54+
selectedPackages.add(moduleName);
55+
}
56+
continue;
57+
}
58+
59+
if (allPackagesPaths.some((pattern) => pattern.test(file))) {
60+
process.stdout.write(`${JSON.stringify(allPackages())}\n`);
61+
process.exit(0);
62+
}
63+
}
64+
65+
process.stdout.write(`${JSON.stringify([...selectedPackages].sort())}\n`);

0 commit comments

Comments
 (0)