Files
free-turn-proxy/.github/workflows/ci.yml
T
samosvalishe c3fc9396d4 fix: ci
2026-08-18 15:59:07 +03:00

181 lines
4.4 KiB
YAML

name: CI
on:
pull_request:
branches: [master]
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
GO_VERSION: "1.26.6"
GOLANGCI_VERSION: v2.12.2
GOVULN_VERSION: v1.6.0
GORELEASER_VERSION: v2.17.1
GOMOBILE_VERSION: latest
TASK_VERSION: 3.52.0
jobs:
lint:
name: Lint & format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-go@v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- uses: arduino/setup-task@v2.0.0
with:
version: ${{ env.TASK_VERSION }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Format check
run: task fmt:check
- name: Vet
run: task vet
- uses: golangci/golangci-lint-action@v9.2.1
with:
version: ${{ env.GOLANGCI_VERSION }}
args: --timeout=5m ./...
test:
name: Test (race)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-go@v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- uses: arduino/setup-task@v2.0.0
with:
version: ${{ env.TASK_VERSION }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: task test
vuln:
name: govulncheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-go@v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Install govulncheck
run: go install golang.org/x/vuln/cmd/govulncheck@${{ env.GOVULN_VERSION }}
- run: govulncheck ./...
build-snapshot:
name: Snapshot build (all targets)
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
- uses: actions/setup-go@v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
# checksum.extra_files глобит mobile-dist, а снапшот идёт без mobile-джоб
- name: Stub mobile artifacts
run: mkdir -p mobile-dist && touch mobile-dist/freeturn.aar mobile-dist/freeturn-sources.jar mobile-dist/Mobile.xcframework.zip
- uses: goreleaser/goreleaser-action@v7.2.2
with:
distribution: goreleaser
version: ${{ env.GORELEASER_VERSION }}
args: release --snapshot --clean --skip=publish,sign,docker,announce,sbom
- uses: actions/upload-artifact@v7.0.1
with:
name: snapshot-dist
path: dist/
retention-days: 7
build-ios:
name: Build iOS XCFramework
runs-on: macos-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-go@v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- uses: arduino/setup-task@v2.0.0
with:
version: ${{ env.TASK_VERSION }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install gomobile
run: |
go install golang.org/x/mobile/cmd/gomobile@${{ env.GOMOBILE_VERSION }}
gomobile init
- name: Build XCFramework
run: task build:ios
- uses: actions/upload-artifact@v7.0.1
with:
name: ios-xcframework
path: dist/Mobile.xcframework
retention-days: 7
build-android:
name: Build Android AAR
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v6.0.2
- uses: actions/setup-go@v6.4.0
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- uses: arduino/setup-task@v2.0.0
with:
version: ${{ env.TASK_VERSION }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Android NDK
run: |
NDK_DIR=$(ls -d $ANDROID_SDK_ROOT/ndk/*/ 2>/dev/null | sort -V | tail -n1)
echo "ANDROID_NDK_HOME=${NDK_DIR%/}" >> $GITHUB_ENV
- name: Install gomobile
run: |
go install golang.org/x/mobile/cmd/gomobile@${{ env.GOMOBILE_VERSION }}
gomobile init
- name: Build AAR
run: task build:android
- uses: actions/upload-artifact@v7.0.1
with:
name: android-aar
path: dist/mobile.aar
retention-days: 7