Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement CI/CD workflows for Initia binary builds #227

Closed
wants to merge 75 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
a1c9de1
Implement CI/CD workflows for Initia binary builds
Jul 12, 2024
d185bd2
Update build-linux.yml
LizJeong Jul 12, 2024
4cb15ea
Update build-darwin.yml
LizJeong Jul 12, 2024
3abb338
Update build-linux.yml
LizJeong Jul 12, 2024
b28114b
Update build-and-upload.yml
LizJeong Jul 12, 2024
c4f6954
Update and rename build-linux.yml to build-linux-arm64.yml
LizJeong Jul 12, 2024
bcf1fe6
Create build-linux-amd64.yml
LizJeong Jul 12, 2024
8e1b339
Rename build-linux-arm64.yml to build-linux-arm-64.yml
LizJeong Jul 12, 2024
6a36128
Rename build-linux-amd64.yml to build-linux-amd-64.yml
LizJeong Jul 12, 2024
23e2a7c
Rename build-linux-amd-64.yml to build-linux-amd64.yml
LizJeong Jul 12, 2024
7931af2
Rename build-linux-arm-64.yml to build-linux-arm64.yml
LizJeong Jul 12, 2024
34f5d54
Update docker.yml
LizJeong Jul 12, 2024
c78c8e6
Update build-linux-arm64.yml
LizJeong Jul 12, 2024
31bd2fc
Update build-linux-arm64.yml
LizJeong Jul 12, 2024
3bbad33
Update build-linux-arm64.yml
LizJeong Jul 12, 2024
2a36ba6
Update build-and-upload.yml
LizJeong Jul 12, 2024
d053fb1
Update build-linux-arm64.yml
LizJeong Jul 12, 2024
0509a3a
Update build-linux-arm64.yml
LizJeong Jul 12, 2024
3315081
Update build-linux-arm64.yml
LizJeong Jul 12, 2024
b47993c
Update build-linux-arm64.yml
LizJeong Jul 12, 2024
dc9b12e
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
f7cd13f
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
2096b29
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
7eeba43
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
3dc938d
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
7b53f19
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
ac5eac9
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
46acd57
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
ff6dc71
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
6162104
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
72a123b
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
c16aec5
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
db08398
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
8e57ed8
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
02ce40a
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
bec476e
Create Dockerfile
LizJeong Jul 15, 2024
1693f7f
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
47cbcbc
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
1e44dfa
Update Dockerfile
LizJeong Jul 15, 2024
b2fa6d2
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
7167234
Update Dockerfile
LizJeong Jul 15, 2024
1882737
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
66bf2b0
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
e90d15b
Rename Dockerfile to Dockerfile.linux
LizJeong Jul 15, 2024
b5003da
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
5140778
Update build-linux-arm64.yml
LizJeong Jul 15, 2024
393cd25
Update build-and-upload.yml
LizJeong Jul 15, 2024
474c39d
Update build-darwin.yml
LizJeong Jul 15, 2024
92b1320
Update build-darwin.yml
LizJeong Jul 15, 2024
fd0c2b8
Update and rename Dockerfile.linux to Dockerfile
LizJeong Jul 15, 2024
ea329ae
Update build-darwin.yml
LizJeong Jul 15, 2024
6dbd54d
Update Dockerfile
LizJeong Jul 15, 2024
d8dadf2
Update Dockerfile
LizJeong Jul 15, 2024
5fdb302
Update build-darwin.yml
LizJeong Jul 15, 2024
164fe81
Update Dockerfile
LizJeong Jul 15, 2024
04459f3
Update build-darwin.yml
LizJeong Jul 15, 2024
e3f3edb
Update build-darwin.yml
LizJeong Jul 15, 2024
0714965
Update build-darwin.yml
LizJeong Jul 15, 2024
454fd4a
Update Dockerfile
LizJeong Jul 15, 2024
795ede9
Update build-darwin.yml
LizJeong Jul 15, 2024
c0f3b81
Update and rename Dockerfile to Dockerfile.linux.amd64
LizJeong Jul 15, 2024
b891f1e
Update build-darwin.yml
LizJeong Jul 15, 2024
5aac094
Update Dockerfile.linux.amd64
LizJeong Jul 15, 2024
fff013a
Update Dockerfile.linux.amd64
LizJeong Jul 15, 2024
fa7c2af
Update Dockerfile.linux.amd64
LizJeong Jul 15, 2024
22faf0c
Update Dockerfile.linux.amd64
LizJeong Jul 15, 2024
9ffd42d
Update and rename build-darwin.yml to linux-amd64.yml
LizJeong Jul 15, 2024
f0face0
Update Dockerfile.linux.amd64
LizJeong Jul 15, 2024
f3198c0
Update build-linux-amd64.yml
LizJeong Jul 15, 2024
75c5148
Update Dockerfile.linux.amd64
LizJeong Jul 15, 2024
22f7720
Update build-linux-amd64.yml
LizJeong Jul 15, 2024
6616743
Update Dockerfile.linux.amd64
LizJeong Jul 15, 2024
48e9cdd
Update build-linux-amd64.yml
LizJeong Jul 15, 2024
10e7d21
Create build-darwin-amd64.yml
LizJeong Jul 15, 2024
3923cd9
Update build-and-upload.yml
LizJeong Jul 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/build-and-upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Build and Upload to GCS

on:
push:
tags:
- 'v*'

jobs:
build-linux-amd64:
uses: ./.github/workflows/build-linux.yml
with:
arch: amd64
secrets: inherit

build-linux-arm64:
uses: ./.github/workflows/build-linux.yml
with:
arch: arm64
secrets: inherit

build-darwin-amd64:
uses: ./.github/workflows/build-darwin.yml
with:
arch: amd64
secrets: inherit

build-darwin-arm64:
uses: ./.github/workflows/build-darwin.yml
with:
arch: arm64
secrets: inherit
56 changes: 56 additions & 0 deletions .github/workflows/build-darwin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build Darwin

on:
workflow_call:
inputs:
arch:
required: true
type: string

jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22.4'

- name: Build for Darwin
run: |
make build
cd ./build
mkdir -p initia_${GITHUB_REF#refs/tags/}
cp ~/go/pkg/mod/github.com/initia-labs/movevm@*/api/libmovevm.dylib initia_${GITHUB_REF#refs/tags/}/libmovevm.${{ inputs.arch }}.dylib
cp ~/go/pkg/mod/github.com/initia-labs/movevm@*/api/libcompiler.dylib initia_${GITHUB_REF#refs/tags/}/libcompiler.${{ inputs.arch }}.dylib
mv initiad initia_${GITHUB_REF#refs/tags/}/
tar -czvf initia_${GITHUB_REF#refs/tags/}_Darwin_${{ inputs.arch }}.tar.gz initia_${GITHUB_REF#refs/tags/}

- name: Google Auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'

- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v2'

- name: Upload to GCS
env:
GCS_BUCKET: ${{ secrets.GCS_BUCKET }}
run: |
gsutil cp ./build/initia_${GITHUB_REF#refs/tags/}_Darwin_${{ inputs.arch }}.tar.gz gs://${GCS_BUCKET}/initia/${GITHUB_REF#refs/tags/}/

- name: Verify upload and Generate public URL
env:
GCS_BUCKET: ${{ secrets.GCS_BUCKET }}
run: |
if gsutil stat gs://${GCS_BUCKET}/initia/${GITHUB_REF#refs/tags/}/initia_${GITHUB_REF#refs/tags/}_Darwin_${{ inputs.arch }}.tar.gz; then
echo "File successfully uploaded"
echo "Public URL: https://storage.googleapis.com/${GCS_BUCKET}/initia/${GITHUB_REF#refs/tags/}/initia_${GITHUB_REF#refs/tags/}_Darwin_${{ inputs.arch }}.tar.gz" >> $GITHUB_STEP_SUMMARY
else
echo "File upload failed"
exit 1
fi
56 changes: 56 additions & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Build Linux

on:
workflow_call:
inputs:
arch:
required: true
type: string

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22.4'

- name: Build for Linux
run: |
make build-linux-with-shared-library
cd ./build
mkdir -p initia_${GITHUB_REF#refs/tags/}
mv libmovevm.so initia_${GITHUB_REF#refs/tags/}/libmovevm.${{ inputs.arch }}.so
mv libcompiler.so initia_${GITHUB_REF#refs/tags/}/libcompiler.${{ inputs.arch }}.so
mv initiad initia_${GITHUB_REF#refs/tags/}/
tar -czvf initia_${GITHUB_REF#refs/tags/}_Linux_${{ inputs.arch }}.tar.gz initia_${GITHUB_REF#refs/tags/}

- name: Google Auth
uses: 'google-github-actions/auth@v2'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'

- name: Set up Cloud SDK
uses: 'google-github-actions/setup-gcloud@v2'

- name: Upload to GCS
env:
GCS_BUCKET: ${{ secrets.GCS_BUCKET }}
run: |
gsutil cp ./build/initia_${GITHUB_REF#refs/tags/}_Linux_${{ inputs.arch }}.tar.gz gs://${GCS_BUCKET}/initia/${GITHUB_REF#refs/tags/}/

- name: Verify upload and Generate public URL
env:
GCS_BUCKET: ${{ secrets.GCS_BUCKET }}
run: |
if gsutil stat gs://${GCS_BUCKET}/initia/${GITHUB_REF#refs/tags/}/initia_${GITHUB_REF#refs/tags/}_Linux_${{ inputs.arch }}.tar.gz; then
echo "File successfully uploaded"
echo "Public URL: https://storage.googleapis.com/${GCS_BUCKET}/initia/${GITHUB_REF#refs/tags/}/initia_${GITHUB_REF#refs/tags/}_Linux_${{ inputs.arch }}.tar.gz" >> $GITHUB_STEP_SUMMARY
else
echo "File upload failed"
exit 1
fi