update CI #33
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 and Release - macOS | |
on: | |
push: | |
branches: [ main ] | |
tags: [ v*.*.* ] # Trigger on tag pushes for releases | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build-macos: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.23' | |
- name: Install dependencies | |
run: make deps | |
- name: Run go fmt | |
run: make fmt | |
- name: Run go vet | |
run: make vet | |
- name: Run staticcheck | |
run: | | |
go install honnef.co/go/tools/cmd/staticcheck@latest | |
staticcheck ./... | |
- name: Run tests | |
run: make test | |
- name: Build binaries | |
run: make build | |
- name: Collect light client artifacts | |
run: | | |
mkdir -p das-macos | |
cp bin/light-client das-macos/ | |
cp scripts/macos/* das-macos/ | |
cp test/data/trusted_setup.txt das-macos/ | |
- name: Install Google Cloud SDK | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
run: brew install --cask google-cloud-sdk | |
- name: Authenticate with Google Cloud | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
env: | |
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GCP_SA_KEY }} | |
run: | | |
cat <<EOF > gcp-key.json | |
${{ secrets.GCP_SA_KEY }} | |
EOF | |
gcloud auth activate-service-account --key-file=gcp-key.json | |
- name: Update `install.sh` with version number | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
run: | | |
VERSION=${GITHUB_REF##*/} | |
sed -i.bak "s/{{VERSION}}/${VERSION}/g" scripts/macos/install.sh | |
- name: Upload to Google Cloud Storage | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
run: | | |
VERSION=${GITHUB_REF##*/} | |
GCS_BUCKET_PATH_BIN="gs://ewm-release-artefacts/${VERSION}/macos/light-client" | |
GCS_BUCKET_PATH_SETUP="gs://ewm-release-artefacts/${VERSION}/macos/trusted_setup.txt" | |
GCS_BUCKET_PATH_INSTALL="gs://ewm-release-artefacts/${VERSION}/macos/install.sh" | |
gsutil cp -a public-read bin/light-client $GCS_BUCKET_PATH_BIN | |
gsutil cp -a public-read test/data/trusted_setup.txt $GCS_BUCKET_PATH_SETUP | |
gsutil cp -a public-read scripts/macos/install.sh $GCS_BUCKET_PATH_INSTALL |