Skip to content

Workflow file for this run

name: Build silta cli binary on release creation
on:
release:
types: [created]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
tests-matrix:
name: Tests
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, darwin, windows]
goarch: [amd64, arm64]
steps:
- uses: actions/checkout@v3
- uses: azure/setup-helm@v3
with:
version: 'v3.6.3'
name: Install Helm
- name: Add wunderio Helm repo
run: helm repo add wunderio https://storage.googleapis.com/charts.wdr.io
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19.1
- name: Run tests
run: go test -v ./tests
releases-matrix:
name: Cross compile and release Go Binaries
runs-on: ubuntu-latest
needs: tests-matrix
strategy:
matrix:
goos: [linux, windows]
goarch: [amd64, arm64]
steps:
- uses: actions/checkout@v3
- name: Set output
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- uses: wangyoucao577/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
goversion: "https://go.dev/dl/go1.19.1.linux-amd64.tar.gz"
binary_name: "silta"
ldflags: "-X github.com/wunderio/silta-cli/internal/common.Version=${{ steps.vars.outputs.tag }}"
circleci-k8s-test-build:
name: Test released CLI
runs-on: ubuntu-latest
needs: releases-matrix
strategy:
matrix:
project: [
{repo: "drupal-project-k8s", jobs: "4"},
{repo: "frontend-project-k8s", jobs: "4"},
{repo: "simple-project-k8s", jobs: "3"}
]
steps:
- uses: actions/checkout@v3
- name: Validate released cli with ${{ matrix.project.REPO_NAME }}
run: |
REPO_NAME="${{ matrix.project.repo }}"
JOB_COUNT="${{ matrix.project.jobs }}"
CIRCLECI_DEV_API_TOKEN="${{ secrets.CIRCLECI_DEV_API_TOKEN }}"
if [ -z "${REPO_NAME}" ] || [ -z "${CIRCLECI_DEV_API_TOKEN}" ] || [ -z "${JOB_COUNT}" ]; then
echo "Missing CIRCLECI_DEV_API_TOKEN secret"
exit 1
fi
echo "Running ${REPO_NAME} build on CircleCI"
echo "Project link: https://circleci.com/gh/wunderio/workflows/${REPO_NAME}"
base_api_url="https://circleci.com/api/v1.1/project/github/wunderio/${REPO_NAME}"
# Trigger a new deployment.
curl -s -X POST $base_api_url/build?circle-token=${CIRCLECI_DEV_API_TOKEN}
sleep 10
# Wait for deployment to be complete
while curl -s "$base_api_url?circle-token=${CIRCLECI_DEV_API_TOKEN}&limit=${JOB_COUNT}" | jq -e 'any(.[]; (.status == "running") or (.status == "queued"))' > /dev/null
do
echo "still running"
sleep 10
done
# Test that the build was successful
curl -s "$base_api_url?circle-token=${CIRCLECI_DEV_API_TOKEN}&limit=${JOB_COUNT}" | jq '.[] | { job_name: .workflows.job_name, status: .status }'
curl -s "$base_api_url?circle-token=${CIRCLECI_DEV_API_TOKEN}&limit=${JOB_COUNT}" | jq -e 'all(.[]; .status == "success")' > /dev/null