-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a release build for the linux/arm64, darwin/amd64, and darwin/arm…
…64 platform (#130) * add build target linux/amd64 * add release builds for darwin/amd64 and darwin/arm64 The approach of cross-compiling for each platform on Linux was difficult for cases like LBM that required native compilation of C/C++. For this reason, I use compilers suitable for each OS to perform release builds. Along with this, the docker image for cross-compiling run from `make reproducible` and the shell script used for it are no longer required. * add a dependent library to the artifact instead of a single binary * change to run on self-hosted runner * add changelog * revert RELEASE_CHANGELOG.md and add it to CHANGELOG.md This reverts commit 9c5929d. * update changelog * typo Co-authored-by: Sujong Lee <[email protected]> * chore: apply detached x/wasmd (#129) * chore: apply detached x/wasmd Signed-off-by: zemyblue <[email protected]> * chore: add changelog Signed-off-by: zemyblue <[email protected]> Signed-off-by: zemyblue <[email protected]> --------- Signed-off-by: zemyblue <[email protected]> Co-authored-by: Sujong Lee <[email protected]> Co-authored-by: zemyblue <[email protected]>
- Loading branch information
1 parent
cac3677
commit efd5757
Showing
7 changed files
with
248 additions
and
231 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 |
---|---|---|
|
@@ -7,96 +7,252 @@ on: | |
- "v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+" | ||
|
||
jobs: | ||
build: | ||
create_tarball: | ||
name: "Create Tarball" | ||
runs-on: self-hosted | ||
steps: | ||
- name: "Set tag as version" | ||
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV # set env.VERSION=v0.0.0 | ||
- name: "Checkout code" | ||
uses: actions/[email protected] | ||
- name: "Create compressed repository source" | ||
run: | | ||
git archive --format=tar --prefix "lbm-${{ env.VERSION }}/" HEAD | gzip -9n > lbm-${{ env.VERSION }}.tgz | ||
md5sum lbm-${{ env.VERSION }}.tgz > lbm-${{ env.VERSION }}.tgz.md5 | ||
sha256sum lbm-${{ env.VERSION }}.tgz > lbm-${{ env.VERSION }}.tgz.sha256 | ||
- name: "Store compressed source" | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: release-${{ env.VERSION }} | ||
path: | | ||
lbm-${{ env.VERSION }}.tgz | ||
lbm-${{ env.VERSION }}.tgz.md5 | ||
lbm-${{ env.VERSION }}.tgz.sha256 | ||
build_for_linux: | ||
name: "Release Build for Linux" | ||
needs: create_tarball | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
arch: [ amd64, arm64 ] | ||
include: | ||
- arch: amd64 | ||
cc: x86_64-linux-gnu-gcc | ||
cxx: x86_64-linux-gnu-g++ | ||
libwasmvm: libwasmvm.x86_64.so | ||
test: 1 | ||
- arch: arm64 | ||
cc: aarch64-linux-gnu-gcc | ||
cxx: aarch64-linux-gnu-g++ | ||
libwasmvm: libwasmvm.aarch64.so | ||
test: 0 | ||
steps: | ||
- name: "Set tag as version" | ||
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV # set env.VERSION=v0.0.0 | ||
- name: "Update runtime" | ||
run: | | ||
sudo apt update | ||
sudo apt upgrade -y | ||
sudo apt install -y build-essential g++-x86-64-linux-gnu g++-aarch64-linux-gnu wget | ||
- name: "Install go" | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.18' | ||
check-latest: true | ||
- name: "Print go environment for debugging" | ||
run: go env | ||
- name: "Download compressed repository source" | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: release-${{ env.VERSION }} | ||
- name: "Extract compressed repository source" | ||
run: tar zxf lbm-${{ env.VERSION }}.tgz --strip-components=1 | ||
|
||
- name: "Set ID=${{ env.VERSION }}-linux-${{ matrix.arch }}" | ||
run: echo "ID=${{ env.VERSION }}-linux-${{ matrix.arch }}" >> $GITHUB_ENV | ||
- name: "Build artifact: linux-${{ matrix.arch }}" | ||
run: | | ||
make clean build GOARCH=${{ matrix.arch }} CC=${{ matrix.cc }} CXX=${{ matrix.cxx }} | ||
- name: "Archive artifact: linux-${{ matrix.arch }}" | ||
run: | | ||
mkdir -p ./artifacts/lbm-${{ env.ID }} | ||
mv ./build/lbm ./artifacts/lbm-${{ env.ID }}/lbm-${{ env.ID }} | ||
cd ./artifacts | ||
LIBWASMVM=`find ~ -name ${{ matrix.libwasmvm }} -type f` | ||
if [ ! -f "$LIBWASMVM" ]; then echo "ERROR: ${{ matrix.libwasmvm }} not found: $LIBWASMVM"; exit 1; fi | ||
cp "$LIBWASMVM" ./lbm-${{ env.ID }}/${{ matrix.libwasmvm }} | ||
ls -laF ./lbm-${{ env.ID }} | ||
echo "MD5: `md5sum ./lbm-${{ env.ID }}/lbm-${{ env.ID }}`" | ||
if [ ${{ matrix.test }} -eq 1 ]; then echo "Binary launch version: `LD_LIBRARY_PATH=./lbm-${{ env.ID }} ./lbm-${{ env.ID }}/lbm-${{ env.ID }} version`" 2>&1; fi | ||
tar zcvf ./lbm-${{ env.ID }}.tgz lbm-${{ env.ID }}/ | ||
md5sum lbm-${{ env.ID }}.tgz > ./lbm-${{ env.ID }}.md5 | ||
sha256sum lbm-${{ env.ID }}.tgz > ./lbm-${{ env.ID }}.sha256 | ||
- name: "Store artifact: linux-${{ matrix.arch }}" | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: release-${{ env.VERSION }} | ||
path: | | ||
./artifacts/lbm-${{ env.ID }}.tgz | ||
./artifacts/lbm-${{ env.ID }}.md5 | ||
./artifacts/lbm-${{ env.ID }}.sha256 | ||
# build_for_darwin: | ||
# name: "Release Build for macOS" | ||
# needs: create_tarball | ||
# runs-on: macOS-latest | ||
# strategy: | ||
# matrix: | ||
# arch: [ "amd64", "arm64" ] | ||
# include: | ||
# - arch: amd64 | ||
# libwasmvm: libwasmvm.dylib | ||
# test: 1 | ||
# - arch: arm64 | ||
# libwasmvm: libwasmvm.dylib | ||
# test: 0 | ||
# steps: | ||
# - name: "Set tag as version" | ||
# run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV # set env.VERSION=v0.0.0 | ||
# - name: "Setup Xcode" | ||
# run: sudo xcode-select --switch /Applications/Xcode.app | ||
# - name: "Install md5sum" | ||
# run: | | ||
# brew update | ||
# brew install md5sha1sum | ||
# - name: "Install go" | ||
# uses: actions/setup-go@v3 | ||
# with: | ||
# go-version: '1.18' | ||
# check-latest: true | ||
# - name: "Print go environment" | ||
# run: go env | ||
# - name: "Download compressed repository source" | ||
# uses: actions/download-artifact@v3 | ||
# with: | ||
# name: release-${{ env.VERSION }} | ||
# - name: "Extract compressed repository source" | ||
# run: tar zxf lbm-${{ env.VERSION }}.tgz --strip-components=1 | ||
# | ||
# - name: "Set ID=${{ env.VERSION }}-darwin-${{ matrix.arch }}" | ||
# run: echo "ID=${{ env.VERSION }}-darwin-${{ matrix.arch }}" >> $GITHUB_ENV | ||
# - name: "Build artifact: darwin-${{ matrix.arch }}" | ||
# run: | | ||
# make clean build GOARCH=${{ matrix.arch }} | ||
# - name: "Archive artifact: darwin-${{ matrix.arch }}" | ||
# run: | | ||
# mkdir -p ./artifacts/lbm-${{ env.ID }} | ||
# mv ./build/lbm ./artifacts/lbm-${{ env.ID }}/lbm-${{ env.ID }} | ||
# cd ./artifacts | ||
# LIBWASMVM=`find ~ -name ${{ matrix.libwasmvm }} -type f` | ||
# if [ ! -f "$LIBWASMVM" ]; then echo "ERROR: ${{ matrix.libwasmvm }} not found: $LIBWASMVM"; exit 1; fi | ||
# cp "$LIBWASMVM" ./lbm-${{ env.ID }}/${{ matrix.libwasmvm }} | ||
# ls -laF ./lbm-${{ env.ID }} | ||
# echo "MD5: `md5sum ./lbm-${{ env.ID }}/lbm-${{ env.ID }}`" | ||
# if [ ${{ matrix.test }} -eq 1 ]; then echo "Binary launch version: `LD_LIBRARY_PATH=./lbm-${{ env.ID }} ./lbm-${{ env.ID }}/lbm-${{ env.ID }} version`" 2>&1; fi | ||
# tar zcvf ./lbm-${{ env.ID }}.tgz lbm-${{ env.ID }}/ | ||
# md5sum lbm-${{ env.ID }}.tgz > ./lbm-${{ env.ID }}.md5 | ||
# shasum -a 256 lbm-${{ env.ID }}.tgz > ./lbm-${{ env.ID }}.sha256 | ||
# - name: "Store artifact: darwin-${{ matrix.arch }}" | ||
# uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: release-${{ env.VERSION }} | ||
# path: | | ||
# ./artifacts/lbm-${{ env.ID }}.tgz | ||
# ./artifacts/lbm-${{ env.ID }}.md5 | ||
# ./artifacts/lbm-${{ env.ID }}.sha256 | ||
|
||
create_release: | ||
name: "Create Release" | ||
needs: [ build_for_linux ] | ||
# needs: [ build_for_linux, build_for_darwin ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: "Checkout code" | ||
uses: actions/[email protected] | ||
- name: set tag env | ||
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
- name: install go | ||
uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.18' | ||
check-latest: true | ||
- name: "Build lbm/build-artifacts Docker image" | ||
run: cd builders/build-artifacts && docker build -t lbm/build-artifacts . | ||
- name: "Build artifacts" | ||
run: make distclean build-reproducible | ||
- name: "Generate release note" | ||
run: cat ./RELEASE_NOTE.md <(echo) <(echo '```') ./artifacts/build_report <(echo '```') > ./releasenote | ||
- name: "Create release" | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
body_path: ./releasenote | ||
draft: true | ||
prerelease: false | ||
- name: "Upload build_report" | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/build_report | ||
asset_name: build_report | ||
asset_content_type: application/file | ||
# - name: "Upload darwin-amd64 artifact" | ||
# uses: actions/upload-release-asset@v1 | ||
# env: | ||
# GITHUB_TOKEN: ${{ github.token }} | ||
# with: | ||
# upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
# asset_path: ./artifacts/lbm-${{ env.VERSION }}-darwin-amd64 | ||
# asset_name: lbm-${{ env.VERSION }}-darwin-amd64 | ||
# asset_content_type: application/binary | ||
# - name: "Upload darwin-arm64 artifact" | ||
# uses: actions/upload-release-asset@v1 | ||
# env: | ||
# GITHUB_TOKEN: ${{ github.token }} | ||
# with: | ||
# upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
# asset_path: ./artifacts/lbm-${{ env.VERSION }}-darwin-arm64 | ||
# asset_name: lbm-${{ env.VERSION }}-darwin-arm64 | ||
# asset_content_type: application/binary | ||
- name: "Upload linux-amd64 artifact" | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/lbm-${{ env.VERSION }}-linux-amd64 | ||
asset_name: lbm-${{ env.VERSION }}-linux-amd64 | ||
asset_content_type: application/binary | ||
# - name: "Upload linux-arm64 artifact" | ||
# uses: actions/upload-release-asset@v1 | ||
# env: | ||
# GITHUB_TOKEN: ${{ github.token }} | ||
# with: | ||
# upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
# asset_path: ./artifacts/lbm-${{ env.VERSION }}-linux-arm64 | ||
# asset_name: lbm-${{ env.VERSION }}-linux-arm64 | ||
# asset_content_type: application/binary | ||
# - name: "Upload windows-amd64 artifact" | ||
# uses: actions/upload-release-asset@v1 | ||
# env: | ||
# GITHUB_TOKEN: ${{ github.token }} | ||
# with: | ||
# upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
# asset_path: ./artifacts/lbm-${{ env.VERSION }}-windows-amd64.exe | ||
# asset_name: lbm-${{ env.VERSION }}-windows-amd64.exe | ||
# asset_content_type: application/binary | ||
- name: "Upload compressed repository" | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts/lbm-${{ env.VERSION }}.tgz | ||
asset_name: lbm-${{ env.VERSION }}.tgz | ||
asset_content_type: application/gzip | ||
- name: "Set tag as version" | ||
run: echo "VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV # set env.VERSION=v0.0.0 | ||
|
||
- name: "Download artifacts" | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: release-${{ env.VERSION }} | ||
- name: "Extract compressed repository source" | ||
run: tar zxf lbm-${{ env.VERSION }}.tgz --strip-components=1 lbm-${{ env.VERSION }}/RELEASE_NOTE.md | ||
- name: "List artifact files for debugging" | ||
run: "ls -laF" | ||
- name: "Create build report" | ||
run: | | ||
echo "App: lbm" > build_report.txt | ||
echo "Version: ${{ env.VERSION }}" >> build_report.txt | ||
echo "Commit: ${{ github.sha }}" >> build_report.txt | ||
echo "Checksums MD5:" >> build_report.txt | ||
echo " `cat lbm-${{ env.VERSION }}-linux-amd64.md5`" >> build_report.txt | ||
echo " `cat lbm-${{ env.VERSION }}-linux-arm64.md5`" >> build_report.txt | ||
echo " `cat lbm-${{ env.VERSION }}.tgz.md5`" >> build_report.txt | ||
echo "Checksums SHA256:" >> build_report.txt | ||
echo " `cat lbm-${{ env.VERSION }}-linux-amd64.sha256`" >> build_report.txt | ||
echo " `cat lbm-${{ env.VERSION }}-linux-arm64.sha256`" >> build_report.txt | ||
echo " `cat lbm-${{ env.VERSION }}.tgz.sha256`" >> build_report.txt | ||
- name: "Create release note" | ||
run: | | ||
cat ./RELEASE_NOTE.md > release_note.txt | ||
echo '' >> release_note.txt | ||
echo '```text' >> release_note.txt | ||
cat ./build_report.txt >> release_note.txt | ||
echo '```' >> build_report.txt | ||
- name: "Create release" | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
body_path: ./release_note.txt | ||
draft: true | ||
prerelease: false | ||
|
||
- name: "Upload artifact: lbm-${{ env.VERSION }}-linux-amd64" | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: lbm-${{ env.VERSION }}-linux-amd64.tgz | ||
asset_name: lbm-${{ env.VERSION }}-linux-amd64.tgz | ||
asset_content_type: application/octet-stream | ||
- name: "Upload artifact: lbm-${{ env.VERSION }}-linux-arm64" | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: lbm-${{ env.VERSION }}-linux-arm64.tgz | ||
asset_name: lbm-${{ env.VERSION }}-linux-arm64.tgz | ||
asset_content_type: application/octet-stream | ||
# - name: "Upload artifact: lbm-${{ env.VERSION }}-dawrin-amd64" | ||
# uses: actions/upload-release-asset@v1 | ||
# env: | ||
# GITHUB_TOKEN: ${{ github.token }} | ||
# with: | ||
# upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
# asset_path: lbm-${{ env.VERSION }}-darwin-amd64.tgz | ||
# asset_name: lbm-${{ env.VERSION }}-darwin-amd64.tgz | ||
# asset_content_type: application/octet-stream | ||
# - name: "Upload artifact: lbm-${{ env.VERSION }}-dawrin-arm64" | ||
# uses: actions/upload-release-asset@v1 | ||
# env: | ||
# GITHUB_TOKEN: ${{ github.token }} | ||
# with: | ||
# upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
# asset_path: lbm-${{ env.VERSION }}-darwin-arm64.tgz | ||
# asset_name: lbm-${{ env.VERSION }}-darwin-arm64.tgz | ||
# asset_content_type: application/octet-stream | ||
- name: "Upload artifact: compressed repository source" | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ github.token }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: lbm-${{ env.VERSION }}.tgz | ||
asset_name: lbm-${{ env.VERSION }}.tgz | ||
asset_content_type: application/gzip |
Oops, something went wrong.