From de465a573ce74639bd607df9dc3f6c8446eab110 Mon Sep 17 00:00:00 2001 From: kevinwang Date: Thu, 3 Sep 2026 20:05:33 -0400 Subject: [PATCH] feat: add daily end to end testing --- .../daily-integration-test/cleanup-linux.sh | 17 ++++++++ .../daily-integration-test/cleanup-macos.sh | 10 +++++ .../daily-integration-test/linux.codify.jsonc | 6 +++ .../daily-integration-test/macos.codify.jsonc | 6 +++ .../verify-destroyed.sh | 14 +++++++ .github/daily-integration-test/verify.sh | 32 +++++++++++++++ .github/workflows/daily-integration-test.yaml | 41 +++++++++++++++++++ 7 files changed, 126 insertions(+) create mode 100755 .github/daily-integration-test/cleanup-linux.sh create mode 100755 .github/daily-integration-test/cleanup-macos.sh create mode 100644 .github/daily-integration-test/linux.codify.jsonc create mode 100644 .github/daily-integration-test/macos.codify.jsonc create mode 100755 .github/daily-integration-test/verify-destroyed.sh create mode 100755 .github/daily-integration-test/verify.sh create mode 100644 .github/workflows/daily-integration-test.yaml diff --git a/.github/daily-integration-test/cleanup-linux.sh b/.github/daily-integration-test/cleanup-linux.sh new file mode 100755 index 00000000..36be9ab9 --- /dev/null +++ b/.github/daily-integration-test/cleanup-linux.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -x + +sudo apt-get purge -y nodejs npm golang-go 2>&1 | tail -20 || true +sudo apt-get autoremove -y 2>&1 | tail -20 || true + +# Catch anything left on PATH that wasn't apt-managed (hostedtoolcache symlinks, /usr/local, etc.) +for bin in node npm go; do + path="$(command -v "$bin" || true)" + [ -n "$path" ] && sudo rm -f "$path" +done +sudo rm -rf /usr/local/go /opt/hostedtoolcache/node /opt/hostedtoolcache/go + +hash -r +command -v node && exit 1 +command -v go && exit 1 +echo "node/go removed." diff --git a/.github/daily-integration-test/cleanup-macos.sh b/.github/daily-integration-test/cleanup-macos.sh new file mode 100755 index 00000000..1cebf164 --- /dev/null +++ b/.github/daily-integration-test/cleanup-macos.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -x + +brew uninstall --ignore-dependencies $(brew list | grep -E '^node(@|$)') 2>/dev/null || true +brew uninstall --ignore-dependencies $(brew list | grep -E '^go$') 2>/dev/null || true + +hash -r +command -v node && exit 1 +command -v go && exit 1 +echo "node/go removed." diff --git a/.github/daily-integration-test/linux.codify.jsonc b/.github/daily-integration-test/linux.codify.jsonc new file mode 100644 index 00000000..ccd84800 --- /dev/null +++ b/.github/daily-integration-test/linux.codify.jsonc @@ -0,0 +1,6 @@ +[ + { "type": "apt", "install": ["jq"], "update": true }, + { "type": "nvm", "nodeVersions": ["20.11.1"], "global": "20.11.1" }, + { "type": "pyenv", "pythonVersions": ["3.11.9"], "global": "3.11.9" }, + { "type": "goenv", "goVersions": ["1.22.5"], "global": "1.22.5" } +] diff --git a/.github/daily-integration-test/macos.codify.jsonc b/.github/daily-integration-test/macos.codify.jsonc new file mode 100644 index 00000000..6819fb11 --- /dev/null +++ b/.github/daily-integration-test/macos.codify.jsonc @@ -0,0 +1,6 @@ +[ + { "type": "homebrew", "formulae": ["jq"] }, + { "type": "nvm", "nodeVersions": ["20.11.1"], "global": "20.11.1" }, + { "type": "pyenv", "pythonVersions": ["3.11.9"], "global": "3.11.9" }, + { "type": "goenv", "goVersions": ["1.22.5"], "global": "1.22.5" } +] diff --git a/.github/daily-integration-test/verify-destroyed.sh b/.github/daily-integration-test/verify-destroyed.sh new file mode 100755 index 00000000..363c9c6c --- /dev/null +++ b/.github/daily-integration-test/verify-destroyed.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -euo pipefail + +if [ -d "$HOME/.nvm" ]; then + echo "FAIL: ~/.nvm still exists after destroy" >&2 + exit 1 +fi + +if [ -d "$HOME/.goenv" ] || command -v goenv >/dev/null 2>&1; then + echo "FAIL: goenv still present after destroy" >&2 + exit 1 +fi + +echo "nvm and goenv confirmed removed." diff --git a/.github/daily-integration-test/verify.sh b/.github/daily-integration-test/verify.sh new file mode 100755 index 00000000..272f1222 --- /dev/null +++ b/.github/daily-integration-test/verify.sh @@ -0,0 +1,32 @@ +#!/bin/bash +set -euo pipefail + +if command -v brew >/dev/null 2>&1; then + brew list jq + jq --version +fi + +if command -v apt-get >/dev/null 2>&1; then + dpkg -l jq + jq --version +fi + +export NVM_DIR="$HOME/.nvm" +. "$NVM_DIR/nvm.sh" +[ "$(nvm current)" = "v20.11.1" ] +node -v | grep -q "v20.11.1" + +export PYENV_ROOT="$HOME/.pyenv" +export PATH="$PYENV_ROOT/bin:$PATH" +eval "$(pyenv init -)" +pyenv doctor +[ "$(pyenv version-name)" = "3.11.9" ] +python --version | grep -q "3.11.9" + +export GOENV_ROOT="$HOME/.goenv" +export PATH="$GOENV_ROOT/bin:$GOENV_ROOT/shims:$PATH" +eval "$(goenv init -)" 2>/dev/null || true # macOS installs goenv via brew; init still needed +[ "$(goenv version-name)" = "1.22.5" ] +go version | grep -q "go1.22.5" + +echo "All resources verified." diff --git a/.github/workflows/daily-integration-test.yaml b/.github/workflows/daily-integration-test.yaml new file mode 100644 index 00000000..95916a50 --- /dev/null +++ b/.github/workflows/daily-integration-test.yaml @@ -0,0 +1,41 @@ +name: Daily Integration Test + +on: + workflow_dispatch: + schedule: + - cron: '0 6 * * *' # daily, off-peak UTC + +jobs: + integration-test: + runs-on: ${{ matrix.os }} + timeout-minutes: 35 + strategy: + fail-fast: false + matrix: + include: + - os: macos-latest + config: .github/daily-integration-test/macos.codify.jsonc + - os: ubuntu-latest + config: .github/daily-integration-test/linux.codify.jsonc + steps: + - uses: actions/checkout@v4 + + - name: Remove preinstalled Node/Python/Go + run: .github/daily-integration-test/cleanup-${{ runner.os == 'macOS' && 'macos' || 'linux' }}.sh + + - name: Install Codify via public installer + run: curl -fsSL https://releases.codifycli.com/install.sh | bash + + - run: codify --version + + - name: Apply daily test config + run: codify apply ${{ matrix.config }} -y --sudoPassword ci-runner --output plain + + - name: Verify installed resources + run: .github/daily-integration-test/verify.sh + + - name: Destroy nvm and goenv + run: codify destroy nvm goenv -y --sudoPassword ci-runner --output plain + + - name: Verify destroy removed nvm/goenv + run: .github/daily-integration-test/verify-destroyed.sh