Skip to content

Commit 4aaf380

Browse files
Refactor workflows (#1016)
1 parent 1002460 commit 4aaf380

File tree

12 files changed

+238
-221
lines changed

12 files changed

+238
-221
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: "Colima Setup"
2+
description: "Sets up Colima"
3+
inputs:
4+
runner:
5+
description: "The runner type (e.g., macos-latest)"
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Colima constraints
11+
shell: bash
12+
run: |
13+
if [[ ! "${{ inputs.runner }}" =~ ^macos.* ]]; then
14+
echo "::error::Colima is only supported on macOS"
15+
exit 1
16+
fi
17+
- name: Colima setup
18+
shell: bash
19+
run: |
20+
brew install docker docker-compose colima
21+
colima start --cpu 3 --memory 14 --disk 14 --runtime docker
22+
colima status
23+
colima --version
24+
echo "DOCKER_HOST=unix://${HOME}/.colima/default/docker.sock" >> $GITHUB_ENV
25+
echo "TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock" >> $GITHUB_ENV
26+
echo "NODE_OPTIONS=--dns-result-order=ipv4first" >> $GITHUB_ENV
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: "Docker Rootless Setup"
2+
description: "Sets up Docker in rootless mode"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Docker rootless setup 1/2
7+
uses: ScribeMD/[email protected]
8+
- name: Docker rootless setup 2/2
9+
shell: bash
10+
run: |
11+
sudo rm -rf /var/run/docker.sock
12+
echo "CI_ROOTLESS=true" >> $GITHUB_ENV
Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
1-
name: 'NPM Setup'
2-
description: 'Sets up Node.js and installs NPM dependencies with caching'
1+
name: "NPM Setup"
2+
description: "Sets up Node.js and installs NPM dependencies with caching"
33

44
inputs:
55
runner:
6-
description: 'Runner to use'
6+
description: "Runner to use"
77
required: true
88
node-version:
9-
description: 'Node.js version to use'
9+
description: "Node.js version to use"
1010
required: true
1111
workspace:
12-
description: 'Key for the cache'
12+
description: "Key for the cache"
1313
required: true
1414

1515
outputs:
1616
workspace_path:
1717
description: "Full path to the workspace directory"
1818
value: ${{ steps.set-env.outputs.workspace_path }}
19-
19+
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
29-
shell: bash
30-
id: set-env
31-
run: |
32-
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"
39-
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"
47-
fi
48-
49-
- uses: actions/cache/restore@v4
50-
id: npm-cache
51-
with:
52-
path: ${{ env.CACHE_PATHS }}
53-
key: ${{ inputs.runner }}-node-${{ inputs.node-version }}-${{ inputs.workspace }}-${{ hashFiles('package-lock.json', 'packages/testcontainers/package-lock.json', format('packages/modules/{0}/package-lock.json', inputs.workspace)) }}
54-
restore-keys: |
55-
${{ inputs.runner }}-node-${{ inputs.node-version }}-${{ inputs.workspace }}-
56-
${{ inputs.runner }}-node-${{ inputs.node-version }}-
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
29+
shell: bash
30+
id: set-env
31+
run: |
32+
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"
39+
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"
47+
fi
48+
49+
- uses: actions/cache/restore@v4
50+
id: npm-cache
51+
with:
52+
path: ${{ env.CACHE_PATHS }}
53+
key: ${{ inputs.runner }}-node-${{ inputs.node-version }}-${{ inputs.workspace }}-${{ hashFiles('package-lock.json', 'packages/testcontainers/package-lock.json', format('packages/modules/{0}/package-lock.json', inputs.workspace)) }}
54+
restore-keys: |
55+
${{ inputs.runner }}-node-${{ inputs.node-version }}-${{ inputs.workspace }}-
56+
${{ inputs.runner }}-node-${{ inputs.node-version }}-
5757
58-
- name: Install dependencies
59-
if: steps.npm-cache.outputs.cache-hit != 'true'
60-
shell: bash
61-
run: npm ci --workspace ${{ env.WORKSPACE_PATH }} --include-workspace-root
58+
- name: Install dependencies
59+
if: steps.npm-cache.outputs.cache-hit != 'true'
60+
shell: bash
61+
run: npm ci --workspace ${{ env.WORKSPACE_PATH }} --include-workspace-root
6262

63-
- name: Cache npm
64-
if: steps.npm-cache.outputs.cache-hit != 'true'
65-
uses: actions/cache/save@v4
66-
with:
67-
path: ${{ env.CACHE_PATHS }}
68-
key: ${{ steps.npm-cache.outputs.cache-primary-key }}
63+
- name: Cache npm
64+
if: steps.npm-cache.outputs.cache-hit != 'true'
65+
uses: actions/cache/save@v4
66+
with:
67+
path: ${{ env.CACHE_PATHS }}
68+
key: ${{ steps.npm-cache.outputs.cache-primary-key }}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "Podman Setup"
2+
description: "Sets up Podman"
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Podman setup
7+
shell: bash
8+
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
17+
echo "CI_PODMAN=true" >> $GITHUB_ENV
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: "Rancher Desktop Setup"
2+
description: "Sets up Rancher Desktop"
3+
inputs:
4+
runner:
5+
description: "The runner type (e.g., macos-latest)"
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Rancher Desktop constraints
11+
shell: bash
12+
run: |
13+
if [[ ! "${{ inputs.runner }}" =~ ^macos.* ]]; then
14+
echo "::error::Rancher Desktop is only supported on macOS"
15+
exit 1
16+
fi
17+
- name: Rancher Desktop setup
18+
shell: bash
19+
run: |
20+
brew install docker docker-compose
21+
brew install --cask rancher
22+
23+
TIMEOUT_SECS_CLI_TOOLS=60
24+
TIMEOUT_SECS_USER_SOCKET=300
25+
26+
echo "Open Rancher Desktop app"
27+
open "/Applications/Rancher Desktop.app"
28+
29+
echo "Wait max of ${TIMEOUT_SECS_CLI_TOOLS}s for Rancher Desktop to create CLI tools"
30+
for i in $(seq 1 ${TIMEOUT_SECS_CLI_TOOLS}); do
31+
if [ -e "$HOME/.rd/bin/rdctl" ]; then
32+
echo "Rancher Desktop CLI tools created after ${i}s"
33+
break
34+
fi
35+
sleep 1
36+
done
37+
38+
if [ ! -e "$HOME/.rd/bin/rdctl" ]; then
39+
echo "Rancher Desktop CLI tools not found"
40+
exit 1
41+
fi
42+
43+
echo "Rancher Desktop initialised successfully, now configure the container runtime"
44+
$HOME/.rd/bin/rdctl set \
45+
--container-engine.name=moby \
46+
--application.admin-access=false \
47+
--kubernetes.enabled=false \
48+
--application.start-in-background=true \
49+
--application.path-management-strategy=manual \
50+
--virtual-machine.number-cpus=3 \
51+
--virtual-machine.memory-in-gb=14 \
52+
|| true
53+
54+
echo "Restart Rancher Desktop"
55+
$HOME/.rd/bin/rdctl shutdown
56+
$HOME/.rd/bin/rdctl start
57+
58+
echo "Wait max of ${TIMEOUT_SECS_USER_SOCKET}s for Rancher socket"
59+
60+
for i in $(seq 1 ${TIMEOUT_SECS_USER_SOCKET}); do
61+
if [ -e "$HOME/.rd/docker.sock" ]; then
62+
echo "Rancher Desktop socket created after ${i}s"
63+
break
64+
fi
65+
sleep 1
66+
done
67+
68+
if [ ! -e "$HOME/.rd/docker.sock" ]; then
69+
echo "Rancher Desktop socket not found"
70+
exit 1
71+
fi
72+
73+
echo "{}" > $HOME/.docker/config.json
74+
75+
echo "DOCKER_HOST=unix://${HOME}/.rd/docker.sock" >> $GITHUB_ENV
76+
echo "TESTCONTAINERS_DOCKER_SOCKET_OVERRIDE=/var/run/docker.sock" >> $GITHUB_ENV
77+
echo "NODE_OPTIONS=--dns-result-order=ipv4first" >> $GITHUB_ENV

.github/release-drafter.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
name-template: 'v$RESOLVED_VERSION'
2-
tag-template: 'v$RESOLVED_VERSION'
1+
name-template: "v$RESOLVED_VERSION"
2+
tag-template: "v$RESOLVED_VERSION"
33
categories:
4-
- title: '🚀 Features'
4+
- title: "🚀 Features"
55
labels:
6-
- 'enhancement'
7-
- title: '🐛 Bug Fixes'
6+
- "enhancement"
7+
- title: "🐛 Bug Fixes"
88
labels:
9-
- 'bug'
10-
- title: '📖 Documentation'
9+
- "bug"
10+
- title: "📖 Documentation"
1111
labels:
12-
- 'documentation'
13-
- title: '🧹 Maintenance'
12+
- "documentation"
13+
- title: "🧹 Maintenance"
1414
labels:
15-
- 'maintenance'
16-
- title: '📦 Dependency Updates'
15+
- "maintenance"
16+
- title: "📦 Dependency Updates"
1717
labels:
18-
- 'dependencies'
19-
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
18+
- "dependencies"
19+
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
2020
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
2121
version-resolver:
2222
major:
2323
labels:
24-
- 'major'
24+
- "major"
2525
minor:
2626
labels:
27-
- 'minor'
27+
- "minor"
2828
patch:
2929
labels:
30-
- 'patch'
30+
- "patch"
3131
default: patch
3232
template: |
3333
## Changes
3434
35-
$CHANGES
35+
$CHANGES

0 commit comments

Comments
 (0)