-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
241 additions
and
68 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# This workflow will build a golang project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | ||
|
||
name: Check | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master", "pre-master" ] | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Check spelling of files | ||
uses: crate-ci/typos@master | ||
continue-on-error: false | ||
with: | ||
files: ./ | ||
|
||
- name: Set up Go1.17 | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.17' | ||
|
||
- name: Check Binary Install | ||
continue-on-error: false | ||
run: | | ||
curl -fsSL https://github.com/xhd2015/xgo/raw/master/script/install/install.sh | env INSTALL_TO_BIN=true bash -x | ||
xgo revision | ||
- name: Build | ||
run: go build -o /dev/null -v ./cmd/xgo | ||
|
||
- name: Set up Go1.18 | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.18' | ||
|
||
# use go1.18 because -trimpath requires it | ||
- name: Build Release | ||
run: go run ./script/build-release --include-install-src --include-local | ||
|
||
- name: Check Revesion | ||
run: ~/.xgo/bin/xgo revision | ||
|
||
- name: Check Go Version | ||
run: ~/.xgo/bin/xgo exec go version |
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,63 @@ | ||
# This workflow will build a golang project | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | ||
|
||
# This workflow run pre-commit and amend version and commit info | ||
# Before merging into master | ||
|
||
name: Pre Master | ||
|
||
on: | ||
push: | ||
branches: [ "pre-master" ] | ||
|
||
jobs: | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: '1.20' | ||
cache: false | ||
|
||
- name: Ensure HEAD~1 Same With Master | ||
run: | | ||
set -x | ||
cur_branch=$(git branch --show-current) | ||
if [[ $cur_branch != pre-master ]];then | ||
echo "expect branch on pre-master, actual: $cur_branch" >&2 | ||
exit 1 | ||
fi | ||
git fetch origin master | ||
master_commit=$(git rev-parse origin/master) | ||
head_parent_commit=$(git rev-parse HEAD~1) | ||
if [[ $master_commit != $head_parent_commit ]];then | ||
echo "HEAD~1 differs with origin/master" >&2 | ||
exit 1 | ||
fi | ||
- name: Run Git Hooks | ||
run: | | ||
set -x | ||
echo 'before' | ||
cat cmd/xgo/version.go | ||
go run ./script/git-hooks pre-commit --amend --no-commit | ||
git status | ||
echo 'after' | ||
cat cmd/xgo/version.go | ||
- name: Push Changes To Master | ||
run: | | ||
git add -A | ||
git config --local user.email "$(git log --format=%ae -n1 HEAD)" | ||
git config --local user.name "$(git log --format=%an -n1 HEAD)" | ||
git commit --amend --no-edit --no-verify | ||
git status | ||
git push origin HEAD:master -f |
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
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
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
Oops, something went wrong.