chore: GHA to smoke test against last released exemplar #12
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
merge_group: | |
name: SmokeTest | |
concurrency: | |
group: ${{ github.ref }}-smoketest | |
cancel-in-progress: true | |
jobs: | |
smoke-test-upgrade-path: | |
name: Smoke Test Upgrade Path | |
# if: github.event_name != 'pull_request' || github.event.action == 'enqueued' || contains( github.event.pull_request.labels.*.name, 'run-all') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the repository with full history | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
fetch-tags: true | |
- name: Get last tagged release | |
run: | | |
latest_release=$(git tag --sort=-v:refname | grep -v v1 | head -n 1) | |
echo "Latest release: $latest_release" | |
echo "LATEST_VERSION=${latest_release#v}" >> "$GITHUB_ENV" | |
- name: Check out the last tagged release | |
uses: actions/checkout@v4 | |
with: | |
ref: v${{ env.LATEST_VERSION }} | |
fetch-depth: 1 | |
fetch-tags: true | |
# The following grabs the current smoke test and deployment Justfile from the HEAD. This | |
# is to solve the chicken-and-egg. Once it's in the tagged release, skip this. | |
- name: Check out the current smoke test | |
uses: actions/checkout@v4 | |
with: | |
clean: false | |
repository: TBD54566975/ftl.git | |
path: tmpsmoketest | |
ref: ${{ github.head_ref }} | |
fetch-depth: 0 | |
sparse-checkout: | | |
smoketest | |
deployment | |
sparse-checkout-cone-mode: false | |
# When we remove the above step to fetch the current smoke tests and deployment Justfile | |
# into tmpsmoketest, remove the overwrite step as well. | |
- name: Replace the tagged release smoketest with the current smoketest | |
run: | | |
set -euo pipefail | |
echo "Replacing tagged release smoketest with current smoketest" | |
rm -r ./smoketest && mv ./tmpsmoketest/smoketest ./smoketest | |
echo "Replacing deployment Justfile with current Justfile" | |
cp ./tmpsmoketest/deployment/Justfile ./deployment/Justfile | |
echo "Removing tmpsmoketest" | |
rm -r ./tmpsmoketest | |
- name: Init Hermit | |
uses: cashapp/activate-hermit@v1 | |
with: | |
cache: true | |
- name: Build Cache | |
uses: ./.github/actions/build-cache | |
- name: Docker Compose | |
run: docker compose up -d --wait | |
- name: Create DB | |
run: just init-db | |
- name: Download Go Modules | |
run: go mod download | |
- name: Set up a kube cluster with the tagged release dockerhub image | |
run: | | |
set -euo pipefail | |
echo "Deploying the tagged release to the cluster" | |
cd deployment && just deploy-version v${{ env.LATEST_VERSION }} && just wait-for-kube && cd .. | |
# - name: Smoke test the tagged release to bring up the cluster | |
# run: | | |
# set -euo pipefail | |
# echo "Running current smoke test on the tagged release" | |
# go test -v -tags integration -run '^Test' ./smoketest | |
# - name: Download the last tagged release asset | |
# run: | | |
# set -euo pipefail | |
# release_url="https://github.com/TBD54566975/ftl/releases/download/v${{ env.LATEST_VERSION }}/ftl-${{ env.LATEST_VERSION }}.linux-amd64.tar.gz" | |
# echo "Fetching latest release asset from: $release_url" | |
# curl -L "$release_url" --output last-release.linux-amd64.tar.gz | |
# - name: Replace deployment with release images | |
# run: | | |
# set -euo pipefail | |
# ls -al . | |
# mkdir -p last-release | |
# tar -xzf last-release.linux-amd64.tar.gz -C last-release | |
# if [ ! -f last-release/ftl ]; then | |
# echo "Error: 'ftl' binary not found in the extracted files." | |
# exit 1 | |
# fi | |
# cp last-release/ftl ./build/devel/ftl | |
# cp last-release/ftl ./build/release/ftl | |
- name: Smoke test the tagged release images | |
run: | | |
set -euo pipefail | |
echo "Running smoke test on the tagged release images" | |
echo "SKIP_KUBE_FULL_DEPLOY=true" >> "$GITHUB_ENV" | |
go test -v -tags integration -run '^Test' ./smoketest | |
# Next step is to build the FTL from HEAD, deploy it to the cluster, and run the smoke test | |
- name: Archive Report | |
uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: kube-report-smoke-test-upgrade | |
path: /tmp/ftl-kube-report/ | |
# Plan: | |
# 1. checkout the latest tagged rlease | |
# 2. update ./overlay/smoketest/kustomization.yml to use the same tagged docker hub images | |
# 3. deployment Justfile to full-deploy a cluster | |
# 4. run the smoke tests on the cluster | |
# 5. checkout HEAD of the current branch | |
# 6. update ./overlay/smoketest/kustomization.yml to use latest image | |
# 7. deployments/Justfile to build and apply the latest image to the cluster | |
# 8. run the smoke tests on the cluster |