Skip to content

Commit

Permalink
release: Test workflow build
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Dec 4, 2024
1 parent 044482b commit 6eece6f
Show file tree
Hide file tree
Showing 4 changed files with 120 additions and 221 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Build

on:
workflow_dispatch:
push:
branches:
- dev-next

jobs:
build:
name: Debug build
runs-on: ubuntu-latest
strategy:
matrix:
include:
# - name: linux_386
# goos: linux
# goarch: 386
- name: linux_amd64
goos: linux
goarch: amd64
# - name: linux_arm64
# goos: linux
# goarch: arm64
# - name: linux_arm
# goos: linux
# goarch: arm
# - name: linux_s390x
# goos: linux
# goarch: s390x
# - name: linux_riscv64
# goos: linux
# goarch: riscv64
# - name: linux_mips64le
# goos: linux
# goarch: mips64le
# - name: windows_amd64
# goos: windows
# goarch: amd64
# - name: windows_386
# goos: windows
# goarch: 386
# - name: windows_arm64
# goos: windows
# goarch: arm64
# - name: darwin_amd64
# goos: darwin
# goarch: amd64
- name: android_arm64
goos: android
goarch: arm64
# - name: android_arm
# goos: android
# goarch: arm
# - name: android_amd64
# goos: android
# goarch: amd64
# - name: android_386
# goos: android
# goarch: 386
steps:
- name: Checkout
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: ^1.23
- name: Cache legacy Go
id: cache-legacy-go
uses: actions/cache@v4
with:
path: |
~/go/go1.20.14
key: go120
- name: Setup legacy Go
if: steps.cache-legacy-go.outputs.cache-hit != 'true'
run: |-
wget https://dl.google.com/go/go1.20.14.linux-amd64.tar.gz
tar -xzf go1.20.14.linux-amd64.tar.gz
mv go $HOME/go/go1.20.14
- name: Setup Android NDK
uses: nttld/setup-ndk@v1
with:
ndk-version: r26b
local-cache: true
- name: Setup Goreleaser
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser-pro
version: latest
install-only: true
- name: Setup OpenJDK
run: |-
sudo apt update && sudo apt install -y openjdk-17-jdk-headless
- name: Build
run: |-
go run -v ./cmd/internal/build goreleaser release --clean --split
env:
JAVA_HOME: /usr/lib/jvm/jdk-17
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.name }}
path: 'dist/*'
219 changes: 0 additions & 219 deletions .github/workflows/debug.yml

This file was deleted.

4 changes: 3 additions & 1 deletion .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,6 @@ release:
ids:
- archive
- package
skip_upload: true
skip_upload: true
partial:
by: target
10 changes: 9 additions & 1 deletion cmd/internal/build_shared/sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,15 @@ func FindSDK() {
log.Fatal("android NDK not found")
}

javaVersion, err := shell.Exec("java", "--version").ReadOutput()
var javaPath string
javaHome := os.Getenv("JAVA_HOME")
if javaHome == "" {
javaPath = "java"
} else {
javaPath = filepath.Join(javaHome, "bin", "java")
}

javaVersion, err := shell.Exec(javaPath, "--version").ReadOutput()
if err != nil {
log.Fatal(E.Cause(err, "check java version"))
}
Expand Down

0 comments on commit 6eece6f

Please sign in to comment.