-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(CI): split build workflows into auto-build and tag-build categories
This commit restructures the CI configuration by splitting the build workflows into two categories: auto-build and tag-build. The auto-build workflows are triggered by pushes to the 'v3' branch and pull requests, while the tag-build workflows are triggered by pushes to any tag. Additionally, the related macOS and Windows build workflows have been updated to reflect these changes.
- Loading branch information
Showing
6 changed files
with
274 additions
and
2 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,87 @@ | ||
name: Build Linux | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
env: | ||
UPLOAD_BIN_FILE: true | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
strategy: | ||
matrix: | ||
go-version: [1.22.x] | ||
platform: [ubuntu-latest] | ||
arch: [386, amd64] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: v3 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Build ${{ matrix.platform }} ${{ matrix.arch }} with Go | ||
if: (matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest') && matrix.arch == 'amd64' && env.UPLOAD_BIN_FILE | ||
id: build_linux_amd64 | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" | ||
run: | | ||
go mod tidy | ||
export GOARCH=${{ matrix.arch }} | ||
echo "FATENAME=fate_$(go env GOOS)_$(go env GOARCH)" >> $GITHUB_ENV | ||
echo "$(go env GOOS) $(go env GOARCH)" | ||
echo "building" | ||
go build -o fate_$(go env GOOS)_$(go env GOARCH) -v ./cmd/console | ||
echo "compress" | ||
tar -zcvf fate_$(go env GOOS)_$(go env GOARCH).tar.gz ./fate_$(go env GOOS)_$(go env GOARCH) | ||
- name: Build ${{ matrix.platform }} ${{ matrix.arch }} with Go | ||
if: matrix.platform == 'ubuntu-latest' && matrix.arch == '386' && env.UPLOAD_BIN_FILE | ||
id: build_linux_386 | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" | ||
run: | | ||
go mod tidy | ||
export GOARCH=${{ matrix.arch }} | ||
echo "FATENAME=fate_$(go env GOOS)_$(go env GOARCH)" >> $GITHUB_ENV | ||
echo "$(go env GOOS) $(go env GOARCH)" | ||
echo "building" | ||
go build -o fate_$(go env GOOS)_$(go env GOARCH) -v ./cmd/console | ||
echo "compress" | ||
tar -zcvf fate_$(go env GOOS)_$(go env GOARCH).tar.gz ./fate_$(go env GOOS)_$(go env GOARCH) | ||
- name: Upload Linux | ||
uses: actions/upload-artifact@master | ||
if: (matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest') && env.UPLOAD_BIN_FILE | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" | ||
with: | ||
name: ${{ env.FATENAME }}.tar.gz | ||
path: ${{ env.FATENAME }}.tar.gz | ||
|
||
- name: Create Release | ||
id: create_release_linux | ||
if: (matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest') && env.UPLOAD_BIN_FILE | ||
uses: ncipollo/release-action@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" | ||
with: | ||
artifacts: "${{ env.FATENAME }}.tar.gz" | ||
allowUpdates: true | ||
commit: v3 | ||
body: | | ||
This is only a latest build from master | ||
** Version: https://github.com/babyname/fate/commit/${{ github.sha }} ** | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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,87 @@ | ||
name: Build Macos | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
env: | ||
UPLOAD_BIN_FILE: true | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
strategy: | ||
matrix: | ||
go-version: [1.22.x] | ||
platform: [macos-latest] | ||
arch: [386, amd64] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: v3 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Build ${{ matrix.platform }} ${{ matrix.arch }} with Go | ||
if: (matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest') && matrix.arch == 'amd64' && env.UPLOAD_BIN_FILE | ||
id: build_linux_amd64 | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" | ||
run: | | ||
go mod tidy | ||
export GOARCH=${{ matrix.arch }} | ||
echo "FATENAME=fate_$(go env GOOS)_$(go env GOARCH)" >> $GITHUB_ENV | ||
echo "$(go env GOOS) $(go env GOARCH)" | ||
echo "building" | ||
go build -o fate_$(go env GOOS)_$(go env GOARCH) -v ./cmd/console | ||
echo "compress" | ||
tar -zcvf fate_$(go env GOOS)_$(go env GOARCH).tar.gz ./fate_$(go env GOOS)_$(go env GOARCH) | ||
- name: Build ${{ matrix.platform }} ${{ matrix.arch }} with Go | ||
if: matrix.platform == 'ubuntu-latest' && matrix.arch == '386' && env.UPLOAD_BIN_FILE | ||
id: build_linux_386 | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" | ||
run: | | ||
go mod tidy | ||
export GOARCH=${{ matrix.arch }} | ||
echo "FATENAME=fate_$(go env GOOS)_$(go env GOARCH)" >> $GITHUB_ENV | ||
echo "$(go env GOOS) $(go env GOARCH)" | ||
echo "building" | ||
go build -o fate_$(go env GOOS)_$(go env GOARCH) -v ./cmd/console | ||
echo "compress" | ||
tar -zcvf fate_$(go env GOOS)_$(go env GOARCH).tar.gz ./fate_$(go env GOOS)_$(go env GOARCH) | ||
- name: Upload Linux | ||
uses: actions/upload-artifact@master | ||
if: (matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest') && env.UPLOAD_BIN_FILE | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" | ||
with: | ||
name: ${{ env.FATENAME }}.tar.gz | ||
path: ${{ env.FATENAME }}.tar.gz | ||
|
||
- name: Create Release | ||
id: create_release_linux | ||
if: (matrix.platform == 'ubuntu-latest' || matrix.platform == 'macos-latest') && env.UPLOAD_BIN_FILE | ||
uses: ncipollo/release-action@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" | ||
with: | ||
artifacts: "${{ env.FATENAME }}.tar.gz" | ||
allowUpdates: true | ||
commit: v3 | ||
body: | | ||
This is only a latest build from master | ||
** Version: https://github.com/babyname/fate/commit/${{ github.sha }} ** | ||
token: ${{ secrets.GITHUB_TOKEN }} |
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,92 @@ | ||
name: Build Windows | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
env: | ||
UPLOAD_BIN_FILE: true | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
strategy: | ||
matrix: | ||
go-version: [1.22.x] | ||
platform: [windows-latest] | ||
arch: [386, amd64] | ||
runs-on: ${{ matrix.platform }} | ||
steps: | ||
- name: Cleanup pre-installed tools | ||
if: matrix.platform != 'windows-latest' | ||
run: | | ||
# This is a fix for https://github.com/actions/virtual-environments/issues/1918 | ||
sudo rm -rf /usr/share/dotnet | ||
sudo rm -rf /opt/ghc | ||
sudo rm -rf "/usr/local/share/boost" | ||
sudo rm -rf "$AGENT_TOOLSDIRECTORY" | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: v3 | ||
|
||
- name: Install Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
- name: Build ${{ matrix.platform }} ${{ matrix.arch }} with Go | ||
if: matrix.platform == 'windows-latest' && matrix.arch == 'amd64' && env.UPLOAD_BIN_FILE | ||
id: build_windows_amd64 | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" | ||
run: | | ||
go mod tidy | ||
set GOARCH=${{ matrix.arch }} | ||
echo "FATENAME=fate_windows_amd64" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | ||
echo "building" | ||
go build -o fate_windows_amd64.exe -v ./cmd/console | ||
echo "compress" | ||
Compress-Archive -Path fate_windows_amd64.exe -DestinationPath fate_windows_amd64.zip | ||
- name: Build ${{ matrix.platform }} ${{ matrix.arch }} with Go | ||
if: matrix.platform == 'windows-latest' && matrix.arch == '386' && env.UPLOAD_BIN_FILE | ||
id: build_windows_386 | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" | ||
run: | | ||
go mod tidy | ||
set GOARCH=${{ matrix.arch }} | ||
echo "FATENAME=fate_windows_386" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | ||
echo "building" | ||
go build -o fate_windows_386.exe -v ./cmd/console | ||
echo "compress" | ||
Compress-Archive -Path fate_windows_386.exe -DestinationPath fate_windows_386.zip | ||
- name: Upload Windows | ||
uses: actions/upload-artifact@master | ||
if: matrix.platform == 'windows-latest' && env.UPLOAD_BIN_FILE | ||
env: | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" | ||
with: | ||
name: ${{ env.FATENAME }}.zip | ||
path: ${{ env.FATENAME }}.zip | ||
|
||
- name: Create Release | ||
id: create_release_windows | ||
if: matrix.platform == 'windows-latest' && env.UPLOAD_BIN_FILE | ||
uses: ncipollo/release-action@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
ACTIONS_ALLOW_UNSECURE_COMMANDS: "true" | ||
with: | ||
artifacts: "${{ env.FATENAME }}.zip" | ||
allowUpdates: true | ||
commit: v3 | ||
body: | | ||
This is only a latest build from master | ||
** Version: https://github.com/babyname/fate/commit/${{ github.sha }} ** | ||
token: ${{ secrets.GITHUB_TOKEN }} |