|
| 1 | +name: compatibility-tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '*' |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + test-compatibility: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + steps: |
| 13 | + - name: Maximize build space |
| 14 | + uses: AdityaGarg8/[email protected] |
| 15 | + with: |
| 16 | + remove-android: 'true' |
| 17 | + remove-haskell: 'true' |
| 18 | + remove-codeql: 'true' |
| 19 | + remove-dotnet: 'true' |
| 20 | + remove-swapfile: 'true' |
| 21 | + |
| 22 | + - name: checkout |
| 23 | + uses: actions/checkout@v4 |
| 24 | + with: |
| 25 | + fetch-depth: 0 # we need to know about previous tags |
| 26 | + |
| 27 | + - name: print the latest version without "v" |
| 28 | + id: latest-no-v |
| 29 | + uses: miniscruff/changie-action@v2 |
| 30 | + with: |
| 31 | + version: latest |
| 32 | + args: latest --remove-prefix |
| 33 | + |
| 34 | + - name: determine-versions |
| 35 | + run: | |
| 36 | + NEW_VERSION=${{ steps.latest-no-v.outputs.output }} |
| 37 | +
|
| 38 | + # Extract the major and minor parts of the version |
| 39 | + MAJOR=$(echo $NEW_VERSION | cut -d. -f1) |
| 40 | + MINOR=$(echo $NEW_VERSION | cut -d. -f2) |
| 41 | + PREV_MINOR=$((MINOR - 1)) |
| 42 | +
|
| 43 | + # Find the previous version tag in the format "<MAJOR>.<MINOR-1>.<LATEST_PATCH>" |
| 44 | + PREVIOUS_VERSION=$(git tag -l "${MAJOR}.${PREV_MINOR}.*" | sort --version-sort | tail -1) |
| 45 | +
|
| 46 | + # If no previous version is found, fallback to a default or handle the error somehow |
| 47 | + if [ -z "$PREVIOUS_VERSION" ]; then |
| 48 | + echo "No previous version found, ensure your repository has proper tags." |
| 49 | + exit 1 |
| 50 | + fi |
| 51 | +
|
| 52 | + # remove after creating 0.6.0 tag. |
| 53 | + # Basically, we are incompatible with 0.4, and while there is no 0.6 (and prev minor being 0.5), |
| 54 | + # we will run compat tests from previous patch version |
| 55 | + if [ "$PREVIOUS_VERSION" = "0.4.42" ]; then |
| 56 | + PREVIOUS_VERSION="0.5.30" |
| 57 | + fi |
| 58 | +
|
| 59 | + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV |
| 60 | + echo "PREVIOUS_VERSION=$PREVIOUS_VERSION" >> $GITHUB_ENV |
| 61 | +
|
| 62 | + - name: Setup Go |
| 63 | + uses: actions/setup-go@v3 |
| 64 | + with: |
| 65 | + go-version: '1.22' |
| 66 | + |
| 67 | + - name: Install dependencies |
| 68 | + run: | |
| 69 | + sudo apt-get update |
| 70 | + sudo apt-get install -y build-essential |
| 71 | +
|
| 72 | + curl -LO https://dl.k8s.io/release/v1.25.3/bin/linux/amd64/kubectl |
| 73 | + chmod +x ./kubectl && sudo mv ./kubectl /usr/local/bin |
| 74 | +
|
| 75 | + HELM_VERSION="v3.10.3" |
| 76 | + curl -sSL https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz | tar -zxvf - --strip-components=1 linux-amd64/helm |
| 77 | + chmod +x ./helm && sudo mv ./helm /usr/local/bin |
| 78 | +
|
| 79 | + go install sigs.k8s.io/[email protected] |
| 80 | +
|
| 81 | + curl -sSL https://storage.yandexcloud.net/yandexcloud-ydb/install.sh | bash |
| 82 | +
|
| 83 | + echo "$(pwd)" >> $GITHUB_PATH |
| 84 | + echo "$HOME/ydb/bin" >> $GITHUB_PATH |
| 85 | + echo "$HOME/go/bin" >> $GITHUB_PATH |
| 86 | +
|
| 87 | + - name: Check dependencies |
| 88 | + run: | |
| 89 | + gcc --version |
| 90 | + go version |
| 91 | + kind version |
| 92 | + kubectl version --client=true |
| 93 | + helm version |
| 94 | + ydb version |
| 95 | +
|
| 96 | + - name: Setup k8s cluster |
| 97 | + run: | |
| 98 | + kind create cluster \ |
| 99 | + --image=kindest/node:v1.31.2@sha256:18fbefc20a7113353c7b75b5c869d7145a6abd6269154825872dc59c1329912e \ |
| 100 | + --config=./tests/cfg/kind-cluster-config.yaml |
| 101 | +
|
| 102 | + kubectl wait --timeout=5m --for=condition=ready node -l worker=true |
| 103 | +
|
| 104 | + - name: Run compatibility tests |
| 105 | + env: |
| 106 | + NEW_VERSION: ${{ env.NEW_VERSION }} |
| 107 | + PREVIOUS_VERSION: ${{ env.PREVIOUS_VERSION }} |
| 108 | + run: | |
| 109 | + go install gotest.tools/[email protected] |
| 110 | + gotestsum --format pkgname --jsonfile log.json -- -v -timeout 3600s -p 1 ./tests/compatibility/... -ginkgo.vv -coverprofile cover.out |
| 111 | +
|
| 112 | + - name: convert-to-human-readable |
| 113 | + run: jq -r '.Output| gsub("[\\n]"; "")' log.json 2>/dev/null 1>log.txt || true |
| 114 | + |
| 115 | + - name: artifact-upload-step |
| 116 | + uses: actions/upload-artifact@v4 |
| 117 | + id: artifact-upload-step |
| 118 | + if: always() |
| 119 | + with: |
| 120 | + name: compat-tests-log |
| 121 | + path: log.txt |
| 122 | + if-no-files-found: error |
| 123 | + |
| 124 | + - name: echo-tests-log-url |
| 125 | + run: echo 'Unit tests log URL is ${{ steps.artifact-upload-step.outputs.artifact-url }}' |
| 126 | + |
| 127 | + - name: Teardown k8s cluster |
| 128 | + run: | |
| 129 | + kind delete cluster |
0 commit comments