-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split and retool build workflow into CI and Release workflows
- Loading branch information
Showing
3 changed files
with
123 additions
and
40 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Copyright 2024 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# This workflow creates a release and builds adifmt binaries for several | ||
# platforms whenever a new version tag (v1.2.3) is pushed. | ||
name: Create Release | ||
|
||
env: | ||
ACTIONS_RUNNER_DEBUG: true | ||
ACTIONS_STEP_LOG: true | ||
|
||
on: | ||
push: | ||
tags: | ||
- v[0-9]+.* | ||
|
||
# Builds with the latest Go, regardless of version declared by go.mod, so we | ||
# pick up compiler improvements. CI builds with specified version to avoid API | ||
# usage regressions. | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '>=1.18' | ||
cache: true | ||
- name: Test | ||
run: go test ./... | ||
|
||
build: | ||
needs: test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
goos: [linux, windows, darwin] | ||
goarch: ['386', amd64, arm64] | ||
exclude: | ||
- goarch: '386' | ||
goos: darwin | ||
include: | ||
- goarch: arm | ||
goos: linux | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '>=1.18' | ||
cache: true | ||
- name: Build ${{ matrix.goos }} ${{ matrix.goarch }} | ||
run: | | ||
go build -v -trimpath \ | ||
-o build/adifmt-${{ matrix.goos }}-${{ matrix.goarch }}/ \ | ||
-ldflags "-X 'main.version=${{ github.ref_name }}'" \ | ||
./adifmt | ||
env: | ||
GOOS: ${{ matrix.goos }} | ||
GOARCH: ${{ matrix.goarch }} | ||
- uses: actions/upload-artifact@v4 | ||
with: | ||
name: adifmt-builds | ||
path: build/** | ||
|
||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/download-artifact@v4 | ||
with: | ||
name: adifmt-builds | ||
- name: Create release ${{ github.ref_name }} | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: adifmt-builds/* | ||
fail_on_unmatched_files: true | ||
generate_release_notes: true |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,9 @@ | |
*.so | ||
*.dylib | ||
|
||
# Build output directory | ||
build/ | ||
|
||
# Test binary, built with `go test -c` | ||
*.test | ||
|
||
|