Release v1.9.2 #2524
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
name: Run unit/integration tests and build image | |
on: | |
push: | |
branches: | |
- main | |
- 'release/**' | |
pull_request: | |
branches: | |
- main | |
- 'release/**' | |
paths-ignore: | |
- 'docs/**' | |
- 'CHANGELOG/**' | |
jobs: | |
unit_integration_tests: | |
name: Run unit/integration tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
if: github.event_name == 'pull_request' | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: actions/checkout@v3 | |
if: github.event_name != 'pull_request' | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version-file: 'go.mod' | |
cache: true | |
- name: Create temporary directory for yq install | |
run: | | |
mkdir ${{ runner.temp }}/yq | |
- name: Install yq | |
working-directory: ${{ runner.temp }}/yq | |
run: | | |
sudo rm /bin/yq | |
wget https://github.com/mikefarah/yq/releases/download/v4.11.2/yq_linux_amd64.tar.gz | |
tar -xzf yq_linux_amd64.tar.gz | |
sudo mv ./yq_linux_amd64 /usr/bin/yq | |
- name: Run unit and integration tests | |
run: | | |
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH | |
make envtest test | |
- name: Check that the build did not generate additional git changes | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
git status | |
exit 1 | |
fi | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
build_image: | |
name: Build and push image to Docker Hub | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v3 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: 'arm64,arm' | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Set git parsed values | |
id: vars | |
run: | | |
echo "sha_short=$(git rev-parse --short=8 ${{ github.sha }})" >> $GITHUB_OUTPUT | |
- name: Compute tags | |
id: compute_tags | |
run: | | |
echo "TAGS=k8ssandra/k8ssandra-operator:${{ steps.vars.outputs.sha_short }},k8ssandra/k8ssandra-operator:latest" >> $GITHUB_ENV | |
- name: Compute release tags | |
id: compute_release_tags | |
if: startsWith(github.ref, 'refs/heads/release/') | |
run: | | |
echo "head ref = ${{ github.head_ref }}" | |
branch_ref=${{ github.ref }} | |
release_prefix=${branch_ref:19} | |
echo "TAGS=k8ssandra/k8ssandra-operator:${{ steps.vars.outputs.sha_short }},k8ssandra/k8ssandra-operator:${release_prefix}-latest" >> $GITHUB_ENV | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v2 | |
with: | |
file: Dockerfile | |
context: . | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ env.TAGS }} | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache | |
helm_release: | |
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
name: Helm release | |
needs: unit_integration_tests | |
uses: ./.github/workflows/helm_release.yaml | |
with: | |
helm_repo: stable | |
prerelease: true | |
secrets: | |
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} | |
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }} | |
GCP_HELM_BUCKET_NAME: ${{ secrets.GCP_HELM_BUCKET_NAME }} |