Merge pull request #281 from gocardless/rnaveiras-add-dependabot #50
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: build-integration | |
on: | |
pull_request: | |
branches: | |
- master | |
types: | |
- opened | |
- reopened | |
- synchronize | |
- ready_for_review | |
push: | |
branches: | |
- master | |
tags: | |
- v* | |
workflow_dispatch: | |
jobs: | |
check-generated-resources: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.1.0 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: 1.19.3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 10 | |
- name: Install prettier | |
run: | | |
sudo apt install -y nodejs npm | |
npm install -g prettier | |
- name: Ensure generated CRDs and manifests are up to date | |
run: make manifests && git diff --exit-code config/ | |
vet: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.1.0 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: 1.19.3 | |
- name: Ensure no go vet errors | |
run: | | |
go vet ./cmd/rbac-manager/... | |
go vet ./cmd/theatre-consoles/... | |
go vet ./cmd/theatre-secrets/... | |
go vet ./cmd/vault-manager/... | |
go vet ./cmd/workloads-manager/... | |
unit-integration: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.1.0 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: 1.19.3 | |
- name: Install ginkgo test runner | |
run: go install github.com/onsi/ginkgo/ginkgo@v1.16.5 | |
- name: Install Kubebuilder test helpers | |
run: | | |
sudo mkdir /usr/local/kubebuilder | |
curl -fsL https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.1/kubebuilder_2.3.1_linux_amd64.tar.gz \ | |
| sudo tar -xvz --strip=1 -C /usr/local/kubebuilder | |
- name: Run tests | |
run: ginkgo -race -randomizeSuites -randomizeAllSpecs -r -v ./... | |
acceptance: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3.1.0 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: 1.19.3 | |
- name: Build test binaries | |
run: make bin/acceptance.linux_amd64 | |
- name: Install tooling | |
run: |- | |
sudo bash <<EOF | |
curl -fsL -o /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/v0.19.0/kind-linux-amd64 | |
curl -fsL https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.4.1/kustomize_v4.4.1_linux_amd64.tar.gz \ | |
| tar xfz - | |
mv -v kustomize /usr/local/bin/kustomize | |
curl -fsL -o /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/v1.24.11/bin/linux/amd64/kubectl | |
chmod a+x /usr/local/bin/kustomize /usr/local/bin/kubectl /usr/local/bin/kind | |
EOF | |
- name: Prepare the cluster | |
run: bin/acceptance.linux_amd64 prepare --verbose && sleep 10 | |
- name: Run acceptance tests | |
run: bin/acceptance.linux_amd64 run --verbose | |
- name: Show all pods | |
run: kubectl get pods -A -o wide | |
if: failure() | |
- name: Show events | |
run: kubectl get events | |
if: failure() | |
- name: Show workloads logs | |
run: kubectl -n theatre-system logs theatre-workloads-manager-0 | |
if: failure() | |
- name: Show rbac logs | |
run: kubectl -n theatre-system logs theatre-rbac-manager-0 | |
if: failure() | |
- name: Show vault manager logs | |
run: kubectl -n theatre-system logs theatre-vault-manager-0 | |
if: failure() | |
release: | |
if: contains('refs/heads/master', github.ref) | |
runs-on: ubuntu-latest | |
needs: | |
- acceptance | |
steps: | |
- uses: actions/checkout@v3.1.0 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: 1.19.3 | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
known_hosts: ${{ secrets.KNOWN_HOSTS_GITHUB_KEY }} | |
key: ${{ secrets.ROBOT_READONLY_SSH_KEY }} | |
- name: Release | |
run: |- | |
CURRENT_VERSION="v$(cat VERSION)" | |
if [[ $(git tag -l "${CURRENT_VERSION}") == "${CURRENT_VERSION}" ]]; then | |
echo "Version ${CURRENT_VERSION} is already released" | |
exit 0 | |
fi | |
curl -L -o /tmp/goreleaser_Linux_x86_64.tar.gz https://github.com/goreleaser/goreleaser/releases/download/v0.133.0/goreleaser_Linux_x86_64.tar.gz | |
tar zxf /tmp/goreleaser_Linux_x86_64.tar.gz -C /tmp | |
git log --pretty=oneline --abbrev-commit --no-decorate --no-color "$(git describe --tags --abbrev=0)..HEAD" -- pkg cmd vendor internal > /tmp/release-notes | |
git tag "${CURRENT_VERSION}" | |
git push --tags | |
/tmp/goreleaser --rm-dist --release-notes /tmp/release-notes |