Skip to content

Commit

Permalink
added binaries as release artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
ice-ares committed May 20, 2024
1 parent 21c952f commit 81835de
Show file tree
Hide file tree
Showing 5 changed files with 279 additions and 263 deletions.
62 changes: 37 additions & 25 deletions .github/workflows/CICD.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find latest Go Version
Expand All @@ -24,7 +24,7 @@ jobs:
LATEST_GO_VERSION=$(make latestGoVersion)
echo "::set-output name=latestGoVersion::$LATEST_GO_VERSION"
- name: Setup GO
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ steps.findLatestGoVersion.outputs.latestGoVersion }}
- name: Check License
Expand All @@ -47,7 +47,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find latest Go Version
Expand All @@ -56,7 +56,7 @@ jobs:
LATEST_GO_VERSION=$(make latestGoVersion)
echo "::set-output name=latestGoVersion::$LATEST_GO_VERSION"
- name: Setup GO
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ steps.findLatestGoVersion.outputs.latestGoVersion }}
- name: Check If We're Up to Date with Everything
Expand All @@ -79,7 +79,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find latest Go Version
Expand All @@ -88,7 +88,7 @@ jobs:
LATEST_GO_VERSION=$(make latestGoVersion)
echo "::set-output name=latestGoVersion::$LATEST_GO_VERSION"
- name: Setup GO
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ steps.findLatestGoVersion.outputs.latestGoVersion }}
- name: Check Auto Generated Files
Expand All @@ -111,7 +111,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find latest Go Version
Expand All @@ -120,7 +120,7 @@ jobs:
LATEST_GO_VERSION=$(make latestGoVersion)
echo "::set-output name=latestGoVersion::$LATEST_GO_VERSION"
- name: Setup GO
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ steps.findLatestGoVersion.outputs.latestGoVersion }}
- name: golangci-lint
Expand All @@ -145,7 +145,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find latest Go Version
Expand All @@ -154,7 +154,7 @@ jobs:
LATEST_GO_VERSION=$(make latestGoVersion)
echo "::set-output name=latestGoVersion::$LATEST_GO_VERSION"
- name: Setup GO
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ steps.findLatestGoVersion.outputs.latestGoVersion }}
- name: Build all
Expand All @@ -181,7 +181,7 @@ jobs:
# runs-on: self-hosted-ubuntu-latest-x64
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find latest Go Version
Expand All @@ -190,7 +190,7 @@ jobs:
LATEST_GO_VERSION=$(make latestGoVersion)
echo "::set-output name=latestGoVersion::$LATEST_GO_VERSION"
- name: Setup GO
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ steps.findLatestGoVersion.outputs.latestGoVersion }}
- name: Test ${{ matrix.package }}
Expand Down Expand Up @@ -232,7 +232,7 @@ jobs:
# runs-on: self-hosted-ubuntu-latest-x64
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find latest Go Version
Expand All @@ -241,7 +241,7 @@ jobs:
LATEST_GO_VERSION=$(make latestGoVersion)
echo "::set-output name=latestGoVersion::$LATEST_GO_VERSION"
- name: Setup GO
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ steps.findLatestGoVersion.outputs.latestGoVersion }}
- name: Benchmark ${{ matrix.package }}
Expand Down Expand Up @@ -286,7 +286,7 @@ jobs:
# runs-on: self-hosted-ubuntu-latest-x64
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find latest Go Version
Expand All @@ -295,7 +295,7 @@ jobs:
LATEST_GO_VERSION=$(make latestGoVersion)
echo "::set-output name=latestGoVersion::$LATEST_GO_VERSION"
- name: Setup GO
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ steps.findLatestGoVersion.outputs.latestGoVersion }}
- name: Set up QEMU
Expand Down Expand Up @@ -373,9 +373,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find latest Go Version
id: findLatestGoVersion
run: |
LATEST_GO_VERSION=$(make latestGoVersion)
echo "::set-output name=latestGoVersion::$LATEST_GO_VERSION"
- name: Setup GO
uses: actions/setup-go@v5
with:
go-version: ${{ steps.findLatestGoVersion.outputs.latestGoVersion }}
- name: Build Artefacts
run: env GOOS=linux env GOARCH=amd64 make buildAllBinaries
- name: Compute new Tag version
id: compute_tag
uses: craig-day/compute-tag@v14
Expand All @@ -396,15 +407,16 @@ jobs:
NEW_TAG_VERSION: ${{ steps.compute_tag.outputs.next_tag }}
- name: Create Release
id: create_release
#TODO This needs to be replaced ASAP! https://github.com/actions/create-release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.check_tag.outputs.next_tag }}
release_name: ${{ steps.check_tag.outputs.next_tag }}
draft: false
prerelease: false
fail_on_unmatched_files: true
make_latest: true
files: |
husky.linux.amd64.bin
husky-pack.linux.amd64.bin
- name: Slack Notification For Failure/Cancellation
if: ${{ github.event_name == 'push' && (failure() || cancelled()) }}
uses: rtCamp/action-slack-notify@v2
Expand Down Expand Up @@ -434,7 +446,7 @@ jobs:
# runs-on: self-hosted-ubuntu-latest-x64
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Find latest Go Version
Expand All @@ -443,7 +455,7 @@ jobs:
LATEST_GO_VERSION=$(make latestGoVersion)
echo "::set-output name=latestGoVersion::$LATEST_GO_VERSION"
- name: Setup GO
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ${{ steps.findLatestGoVersion.outputs.latestGoVersion }}
- name: Set up QEMU
Expand Down Expand Up @@ -503,7 +515,7 @@ jobs:
run: |
echo "APP_TAG=${{needs.push_docker.outputs.nextTag}}" >> $GITHUB_ENV
- name: Checkout the target `master` branch of `secret-infrastructure`
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: ice-blockchain/secret-infrastructure
ref: master
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
*.exe
*.BIN
*.bin
*.exe~
*.dll
*.so
Expand Down
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ build: build-all@ci/cd

binary-specific-service:
set -xe; \
echo "$@: $(SERVICE_NAME) / $(GOARCH)" ; \
echo "$@: $(SERVICE_NAME) / $(GOOS) / $(GOARCH)" ; \
go build -tags=go_json -a -v -o ./cmd/$${SERVICE_NAME}/bin ./cmd/$${SERVICE_NAME}; \
cp ./cmd/$${SERVICE_NAME}/bin ./$${SERVICE_NAME}.$${GOOS}.$${GOARCH}.bin; \

test:
set -xe; \
Expand Down Expand Up @@ -163,6 +164,7 @@ clean:
@test -d cmd && find ./cmd -mindepth 2 -maxdepth 2 -type f -name bin -exec rm -f {} \; || true;
@test -d cmd && find ./cmd -mindepth 2 -maxdepth 2 -type d -name bins -exec rm -Rf {} \; || true;
@find . -name ".tmp-*" -exec rm -Rf {} \; || true;
@find . -maxdepth 1 -name "*.bin" -exec rm -Rf {} \; || true;
@find . -mindepth 1 -maxdepth 3 -type f -name $(COVERAGE_FILE) -exec rm -Rf {} \; || true;
@find . -mindepth 1 -maxdepth 3 -type f -name tmp$(COVERAGE_FILE) -exec rm -Rf {} \; || true;

Expand Down Expand Up @@ -199,6 +201,12 @@ else
done; false;
endif

buildAllBinaries:
set -xe; \
find ./cmd -mindepth 1 -maxdepth 1 -type d -print | grep -v 'fixture' | grep -v 'scripts' | while read service; do \
env SERVICE_NAME=$${service##*/} env GOOS=$(GOOS) env GOARCH=$(GOARCH) $(MAKE) dockerfile; \
done;

# note: it requires make-4.3+ to run that
buildMultiPlatformDockerImage:
set -xe; \
Expand Down
Loading

0 comments on commit 81835de

Please sign in to comment.