diff --git a/.github/workflows/irso-functional.yml b/.github/workflows/irso-functional.yml new file mode 100644 index 0000000..f085a6b --- /dev/null +++ b/.github/workflows/irso-functional.yml @@ -0,0 +1,50 @@ +name: IrSO Functional Tests + +on: + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + +jobs: + test: + runs-on: ubuntu-latest + env: + LOGDIR: /tmp/logs + steps: + - name: Update repositories + run: sudo apt-get update + - name: Install podman + run: sudo apt-get install -y podman + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + path: mariadb-image + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + repository: metal3-io/ironic-standalone-operator + path: ironic-standalone-operator + - name: Calculate go version + id: vars + run: echo "go_version=$(make -sC ironic-standalone-operator go-version)" >> $GITHUB_OUTPUT + - name: Set up Go + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 + with: + go-version: ${{ steps.vars.outputs.go_version }} + - name: Create a Kind cluster + uses: helm/kind-action@a1b0e391336a6ee6713a0583f8c6240d70863de3 # v1.12.0 + with: + cluster_name: kind + config: ironic-standalone-operator/test/kind.yaml + - name: Prepare tests + run: cd ironic-standalone-operator && ./test/prepare.sh + - name: Run tests + run: mariadb-image/hack/ci-e2e.sh + env: + IRSO_PATH: "${{ github.workspace }}/ironic-standalone-operator" + - name: Collect logs + run: ironic-standalone-operator/test/collect-logs.sh + if: always() + - name: Upload logs artifacts + uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 + with: + name: functional + path: /tmp/logs/* + if: always() diff --git a/hack/ci-e2e.sh b/hack/ci-e2e.sh new file mode 100755 index 0000000..62d2b00 --- /dev/null +++ b/hack/ci-e2e.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -eux -o pipefail + +REPO_ROOT=$(realpath "$(dirname "${BASH_SOURCE[0]}")/..") +cd "${REPO_ROOT}" || exit 1 + +IRSO_REPO="${IRSO_REPO:-https://github.com/metal3-io/ironic-standalone-operator}" +IRSO_BRANCH="${IRSO_BRANCH:-main}" +if [[ -z "${IRSO_PATH:-}" ]]; then + IRSO_PATH="$(mktemp -td irso-XXXXXXXX)" + git clone "${IRSO_REPO}" -b "${IRSO_BRANCH}" "${IRSO_PATH}" +fi +export MARIADB_CUSTOM_IMAGE=localhost/mariadb:test + +podman build -t "${MARIADB_CUSTOM_IMAGE}" . + +archive="$(mktemp --suffix=.tar)" +podman save "${MARIADB_CUSTOM_IMAGE}" > "${archive}" +kind load image-archive -v 2 "${archive}" +rm -f "${archive}" + +cd "${IRSO_PATH}/test" +# shellcheck disable=SC1091 +. testing.env + +exec go test -timeout 60m