Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 11 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
name: Build
name: Build and Release AndroidLibXrayLite

on:
workflow_dispatch:
inputs:
release_tag:
required: false
type: string
pull_request:
branches:
- main
release:
types: [published]
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,19 +47,19 @@ jobs:
gomobile init
go mod tidy
gomobile bind -v -androidapi 21 -trimpath -ldflags='-s -w -buildid=' ./

- name: Upload build artifacts
if: github.event.inputs.release_tag == ''
uses: actions/upload-artifact@v4.6.2
with:
name: libv2ray
path: |
${{ github.workspace }}/libv2ray*r

- name: Upload AndroidLibXrayLite to release
if: github.event.inputs.release_tag != ''
if: github.event_name == 'release' && github.event.action == 'published'
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./libv2ray*r
tag: ${{ github.event.inputs.release_tag }}
file_glob: true
tag: ${{ github.ref }}
file_glob: true
55 changes: 55 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Test

on:
push:
pull_request:
types: [opened, synchronize, reopened]

jobs:
test:
permissions:
contents: read
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
steps:
- name: Checkout codebase
uses: actions/checkout@v4.2.2

- name: Set up Go
uses: actions/setup-go@v5.4.0
with:
go-version-file: go.mod
cache: true
check-latest: true

- name: Cleanup old coverage files
shell: bash
run: |
rm -f coverage.txt || true # For all operating systems

- name: Install dependencies
shell: bash
run: go mod tidy

- name: Run Tests
shell: bash
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./...

- name: Upload Coverage
uses: codecov/codecov-action@v5.4.2
if: success()

security:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.2.2
- run: |
go install github.com/securego/gosec/v2/cmd/gosec@latest
export PATH="$PATH:$(go env GOPATH)/bin"
gosec ./...
- name: Test
run: go test -timeout 1h -v ./...
Loading