Skip to content

Commit de465a5

Browse files
committed
feat: add daily end to end testing
1 parent 7796c5a commit de465a5

7 files changed

Lines changed: 126 additions & 0 deletions

File tree

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
set -x
3+
4+
sudo apt-get purge -y nodejs npm golang-go 2>&1 | tail -20 || true
5+
sudo apt-get autoremove -y 2>&1 | tail -20 || true
6+
7+
# Catch anything left on PATH that wasn't apt-managed (hostedtoolcache symlinks, /usr/local, etc.)
8+
for bin in node npm go; do
9+
path="$(command -v "$bin" || true)"
10+
[ -n "$path" ] && sudo rm -f "$path"
11+
done
12+
sudo rm -rf /usr/local/go /opt/hostedtoolcache/node /opt/hostedtoolcache/go
13+
14+
hash -r
15+
command -v node && exit 1
16+
command -v go && exit 1
17+
echo "node/go removed."
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
set -x
3+
4+
brew uninstall --ignore-dependencies $(brew list | grep -E '^node(@|$)') 2>/dev/null || true
5+
brew uninstall --ignore-dependencies $(brew list | grep -E '^go$') 2>/dev/null || true
6+
7+
hash -r
8+
command -v node && exit 1
9+
command -v go && exit 1
10+
echo "node/go removed."
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{ "type": "apt", "install": ["jq"], "update": true },
3+
{ "type": "nvm", "nodeVersions": ["20.11.1"], "global": "20.11.1" },
4+
{ "type": "pyenv", "pythonVersions": ["3.11.9"], "global": "3.11.9" },
5+
{ "type": "goenv", "goVersions": ["1.22.5"], "global": "1.22.5" }
6+
]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{ "type": "homebrew", "formulae": ["jq"] },
3+
{ "type": "nvm", "nodeVersions": ["20.11.1"], "global": "20.11.1" },
4+
{ "type": "pyenv", "pythonVersions": ["3.11.9"], "global": "3.11.9" },
5+
{ "type": "goenv", "goVersions": ["1.22.5"], "global": "1.22.5" }
6+
]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
if [ -d "$HOME/.nvm" ]; then
5+
echo "FAIL: ~/.nvm still exists after destroy" >&2
6+
exit 1
7+
fi
8+
9+
if [ -d "$HOME/.goenv" ] || command -v goenv >/dev/null 2>&1; then
10+
echo "FAIL: goenv still present after destroy" >&2
11+
exit 1
12+
fi
13+
14+
echo "nvm and goenv confirmed removed."
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
if command -v brew >/dev/null 2>&1; then
5+
brew list jq
6+
jq --version
7+
fi
8+
9+
if command -v apt-get >/dev/null 2>&1; then
10+
dpkg -l jq
11+
jq --version
12+
fi
13+
14+
export NVM_DIR="$HOME/.nvm"
15+
. "$NVM_DIR/nvm.sh"
16+
[ "$(nvm current)" = "v20.11.1" ]
17+
node -v | grep -q "v20.11.1"
18+
19+
export PYENV_ROOT="$HOME/.pyenv"
20+
export PATH="$PYENV_ROOT/bin:$PATH"
21+
eval "$(pyenv init -)"
22+
pyenv doctor
23+
[ "$(pyenv version-name)" = "3.11.9" ]
24+
python --version | grep -q "3.11.9"
25+
26+
export GOENV_ROOT="$HOME/.goenv"
27+
export PATH="$GOENV_ROOT/bin:$GOENV_ROOT/shims:$PATH"
28+
eval "$(goenv init -)" 2>/dev/null || true # macOS installs goenv via brew; init still needed
29+
[ "$(goenv version-name)" = "1.22.5" ]
30+
go version | grep -q "go1.22.5"
31+
32+
echo "All resources verified."
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Daily Integration Test
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 6 * * *' # daily, off-peak UTC
7+
8+
jobs:
9+
integration-test:
10+
runs-on: ${{ matrix.os }}
11+
timeout-minutes: 35
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- os: macos-latest
17+
config: .github/daily-integration-test/macos.codify.jsonc
18+
- os: ubuntu-latest
19+
config: .github/daily-integration-test/linux.codify.jsonc
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Remove preinstalled Node/Python/Go
24+
run: .github/daily-integration-test/cleanup-${{ runner.os == 'macOS' && 'macos' || 'linux' }}.sh
25+
26+
- name: Install Codify via public installer
27+
run: curl -fsSL https://releases.codifycli.com/install.sh | bash
28+
29+
- run: codify --version
30+
31+
- name: Apply daily test config
32+
run: codify apply ${{ matrix.config }} -y --sudoPassword ci-runner --output plain
33+
34+
- name: Verify installed resources
35+
run: .github/daily-integration-test/verify.sh
36+
37+
- name: Destroy nvm and goenv
38+
run: codify destroy nvm goenv -y --sudoPassword ci-runner --output plain
39+
40+
- name: Verify destroy removed nvm/goenv
41+
run: .github/daily-integration-test/verify-destroyed.sh

0 commit comments

Comments
 (0)