name: CI on: pull_request: branches: [master] permissions: contents: read concurrency: group: ci-${{ github.ref }} cancel-in-progress: true env: GO_VERSION: "1.26.9" GOLANGCI_VERSION: v2.12.2 GOVULN_VERSION: v1.6.0 GORELEASER_VERSION: v2.17.1 GOMOBILE_VERSION: v0.0.0-20260821190718-4776eadac327 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 ./... install-sh: name: install.sh (bats) runs-on: ubuntu-latest steps: - uses: actions/checkout@v6.0.2 - name: Install bats run: sudo apt-get update -qq && sudo apt-get install -y -qq bats - name: Run tests run: bats scripts/tests 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