Package-core #3
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
name: Package-core | |
on: | |
workflow_dispatch: | |
env: | |
GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
GO_VERSION: "1.19" | |
jobs: | |
ci-pass: | |
name: CI is green | |
runs-on: ubuntu-latest | |
needs: | |
- build_release_assets | |
steps: | |
- run: exit 0 | |
build_release_assets: | |
name: Build and upload assets | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- target: ios | |
host: macos-latest | |
- target: android | |
host: ubuntu-latest | |
runs-on: ${{ matrix.config.host }} | |
env: | |
TARGET: ${{ matrix.config.target }} | |
steps: | |
- name: Setup golang | |
uses: actions/setup-go@v2 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Cache go modules (Linux) | |
if: matrix.config.host == 'ubuntu-latest' | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ matrix.config.host }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ matrix.config.host }}-go- | |
- name: Cache go modules (macOS) | |
if: matrix.config.host == 'macos-latest' | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/Library/Caches/go-build | |
~/go/pkg/mod | |
key: ${{ matrix.config.host }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ matrix.config.host }}-go- | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ env.BRANCH }} | |
- name: Checkout core | |
uses: actions/checkout@v3 | |
with: | |
repository: 'niuhuan/pikapika-go-core' | |
token: ${{ secrets.GH_TOKEN }} | |
path: 'go' | |
- name: Install go mobile (mobile) | |
run: | | |
go install golang.org/x/mobile/cmd/gomobile@latest | |
- name: Build (ios) | |
if: matrix.config.target == 'ios' | |
run: | | |
sh scripts/bind-ios.sh | |
- name: Setup java (Android) | |
if: matrix.config.target == 'android' | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Setup android tools (Android) | |
if: matrix.config.target == 'android' | |
uses: android-actions/setup-android@v3 | |
with: | |
cmdline-tools-version: 8512546 | |
packages: 'platform-tools platforms;android-32 build-tools;30.0.2 ndk;23.1.7779620' | |
- name: Build (android) | |
if: matrix.config.target == 'android' | |
run: | | |
sh scripts/bind-android-debug.sh | |
- name: Upload Asset (All) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.config.target }}-${{ github.run_number }} | |
path: 'go/mobile/lib' | |
retention-days: 3 | |