Add CI
This commit is contained in:
102
.github/workflows/release.yml
vendored
Normal file
102
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
name: Release
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- '**.md'
|
||||||
|
- 'docs/**'
|
||||||
|
- '.github/ISSUE_TEMPLATE/**'
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
permissions: write-all
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
job:
|
||||||
|
- { os: "ubuntu-latest", target: "android" }
|
||||||
|
- { os: "ubuntu-latest", target: "windows-amd64", aarch: "x64" }
|
||||||
|
- { os: "ubuntu-latest", target: "linux-amd64", aarch: "x64" }
|
||||||
|
runs-on: ${{ matrix.job.os }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Go
|
||||||
|
uses: actions/setup-go@v4
|
||||||
|
with:
|
||||||
|
go-version-file: 'go.mod'
|
||||||
|
check-latest: false
|
||||||
|
|
||||||
|
- name: Setup Java
|
||||||
|
if: startsWith(matrix.job.target,'android')
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
distribution: 'zulu'
|
||||||
|
java-version: '17'
|
||||||
|
|
||||||
|
- name: Setup NDK
|
||||||
|
if: startsWith(matrix.job.target,'android')
|
||||||
|
uses: nttld/setup-ndk@v1
|
||||||
|
id: setup-ndk
|
||||||
|
with:
|
||||||
|
ndk-version: r25b
|
||||||
|
add-to-path: true
|
||||||
|
local-cache: true
|
||||||
|
|
||||||
|
# - name: Setup Android SDK
|
||||||
|
# uses: amyu/setup-android@v2
|
||||||
|
# with:
|
||||||
|
# cache-disabled: true
|
||||||
|
# sdk-version: '33'
|
||||||
|
# ndk-version: '25.2.9519653'
|
||||||
|
|
||||||
|
- name: Setup GoMobile
|
||||||
|
if: startsWith(matrix.job.target,'android')
|
||||||
|
run: make lib_install
|
||||||
|
|
||||||
|
- name: Setup MinGW
|
||||||
|
if: startsWith(matrix.job.target,'windows')
|
||||||
|
uses: egor-tensin/setup-mingw@v2
|
||||||
|
with:
|
||||||
|
platform: ${{ matrix.job.aarch }}
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: make -j$(($(nproc) + 1)) ${{ matrix.job.target }}
|
||||||
|
|
||||||
|
- name: zip
|
||||||
|
run: |
|
||||||
|
tree
|
||||||
|
rm -f ./bin/*.h
|
||||||
|
gzip -r -S ".gz" ./bin/hiddify-libcore*
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
if: ${{ success() }}
|
||||||
|
with:
|
||||||
|
name: artifact
|
||||||
|
path: bin/
|
||||||
|
|
||||||
|
upload-prerelease:
|
||||||
|
permissions: write-all
|
||||||
|
needs: [build]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v3
|
||||||
|
with:
|
||||||
|
name: artifact
|
||||||
|
path: bin/
|
||||||
|
|
||||||
|
- name: Create or Update Draft Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
files: ./bin/*
|
||||||
|
name: "draft"
|
||||||
|
tag_name: "draft"
|
||||||
|
prerelease: true
|
||||||
|
overwrite: true
|
||||||
|
|
||||||
|
|
||||||
7
Makefile
7
Makefile
@@ -5,15 +5,20 @@ TAGS=with_gvisor,with_quic,with_wireguard,with_utls,with_clash_api
|
|||||||
GOBUILD=CGO_ENABLED=1 go build -trimpath -tags $(TAGS) -ldflags="-w -s" -buildmode=c-shared
|
GOBUILD=CGO_ENABLED=1 go build -trimpath -tags $(TAGS) -ldflags="-w -s" -buildmode=c-shared
|
||||||
|
|
||||||
lib_install:
|
lib_install:
|
||||||
go get -v -d
|
|
||||||
go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.0.0-20230728014906-3de089147f59
|
go install -v github.com/sagernet/gomobile/cmd/gomobile@v0.0.0-20230728014906-3de089147f59
|
||||||
go install -v github.com/sagernet/gomobile/cmd/gobind@v0.0.0-20230728014906-3de089147f59
|
go install -v github.com/sagernet/gomobile/cmd/gobind@v0.0.0-20230728014906-3de089147f59
|
||||||
|
|
||||||
|
headers:
|
||||||
|
go build -buildmode=c-archive -o $(BINDIR)/$(NAME)-$@.h ./custom
|
||||||
|
|
||||||
android:
|
android:
|
||||||
gomobile bind -v -androidapi=21 -javapkg=io.nekohasekai -libname=box -tags=$(TAGS) -trimpath -ldflags="-w -s" -target=android -o $(BINDIR)/$(NAME)-$@.aar github.com/sagernet/sing-box/experimental/libbox ./mobile
|
gomobile bind -v -androidapi=21 -javapkg=io.nekohasekai -libname=box -tags=$(TAGS) -trimpath -ldflags="-w -s" -target=android -o $(BINDIR)/$(NAME)-$@.aar github.com/sagernet/sing-box/experimental/libbox ./mobile
|
||||||
|
|
||||||
windows-amd64:
|
windows-amd64:
|
||||||
env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.dll ./custom
|
env GOOS=windows GOARCH=amd64 CC=x86_64-w64-mingw32-gcc $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.dll ./custom
|
||||||
|
|
||||||
|
linux-amd64:
|
||||||
|
env GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINDIR)/$(NAME)-$@.so ./custom
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm $(BINDIR)/*
|
rm $(BINDIR)/*
|
||||||
Reference in New Issue
Block a user