From a6e1af91edb55c25a08fd9e5ff953c24e5d073db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Tue, 16 Apr 2024 13:26:48 +0900 Subject: [PATCH] feat: add workflows --- .github/workflows/release.yml | 60 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 43 +++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..126a4a6 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,60 @@ +name: release +on: + push: + tags: + - v* + - default + +env: + GITHUB_TOKEN: ${{ github.token }} + +jobs: + release: + name: Build on Push Tag ๐Ÿš€ + runs-on: ubuntu-latest + steps: + + - name: Checkout Code + id: checkout + uses: actions/checkout@v4 + + - name: Setup Build Tools + run: | + sudo apt-get update + sudo apt-get install -y gcc make + + - name: Setup NDK + uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: r26d + add-to-path: false + + - name: Setup Go Environment + uses: actions/setup-go@master + + - name: Download Go Modules + run: go mod tidy + + - name: Cache Downloaded Modules + uses: actions/cache@master + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ matrix.goos }}-${{ matrix.goarch }}-${{ hashFiles('**/go.sum') }} + + - name: Build Libraries + env: + NDK_TOOLCHAIN: ${{ steps.setup-ndk.outputs.ndk-path }} + BUILD_MACHINE: linux + run: make + + - name: Upload Binaries to Release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: build/*.gz + tag: ${{ github.ref }} + overwrite: true + file_glob: true diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..cfa6db6 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,43 @@ +name: test +on: [ push, pull_request ] + +jobs: + test_ubuntu: + name: Run Make Test on Ubuntu ๐Ÿงช + runs-on: ubuntu-latest + steps: + + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Setup Build Tools + run: | + sudo apt-get update + sudo apt-get install -y gcc make + + - name: Setup NDK + uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: r26d + add-to-path: false + + - name: Setup Go Environment + uses: actions/setup-go@master + + - name: Download Go Modules + run: go mod tidy + + - name: Cache Downloaded Modules + uses: actions/cache@master + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ matrix.goos }}-${{ matrix.goarch }}-${{ hashFiles('**/go.sum') }} + + - name: Build and Run Tests + env: + NDK_TOOLCHAIN: ${{ steps.setup-ndk.outputs.ndk-path }} + BUILD_MACHINE: linux + run: make runtest