name: Pull Request Check on: pull_request: types: [opened, synchronize, reopened] paths: - "**/*.go" - "service/**" - "core/**" - "gui/**" - ".github/workflows/*.yml" jobs: Build_v2rayA_Web: uses: ./.github/workflows/_build_web.yml Build_v2rayA: # Replaces the default " ()", which would spell # out CC and EXTRA_LDFLAGS in the run's job list. name: ${{ matrix.label }} runs-on: ${{ matrix.os }} strategy: matrix: include: - { os: ubuntu-latest, label: linux-amd64, goarch: amd64, CGO_ENABLED: 0 } - { os: ubuntu-latest, label: linux-arm64, goarch: arm64, CGO_ENABLED: 0 } - { os: ubuntu-latest, label: linux-riscv64, goarch: riscv64, CGO_ENABLED: 0 } - { os: ubuntu-latest, label: linux-loong64, goarch: loong64, CGO_ENABLED: 1, CC: "zig cc -target loongarch64-linux-musl", EXTRA_LDFLAGS: "-linkmode=external -extldflags '-static -Wl,--strip-debug'" } - { os: windows-latest, label: windows-amd64, goarch: amd64, CGO_ENABLED: 0 } - { os: windows-latest, label: windows-arm64, goarch: arm64, CGO_ENABLED: 0 } - { os: macos-latest, label: darwin-amd64, goarch: amd64, CGO_ENABLED: 0 } - { os: macos-latest, label: darwin-arm64, goarch: arm64, CGO_ENABLED: 0 } needs: Build_v2rayA_Web steps: - uses: actions/checkout@v7 with: fetch-depth: 0 - name: Install Zig if: matrix.CGO_ENABLED == 1 uses: ./.github/actions/install-zig - name: Download Artifact uses: actions/download-artifact@v8 with: name: web path: service/server/router/web - name: Set up Go uses: actions/setup-go@v6 with: cache-dependency-path: | service/go.mod service/go.sum go-version: "1.27" - name: Build v2rayA shell: bash run: | mkdir v2raya_bin CurrentDir="$(pwd)" date=$(git -C "$CurrentDir" log -1 --format="%cd" --date=short | sed s/-//g) count=$(git -C "$CurrentDir" rev-list --count HEAD) commit=$(git -C "$CurrentDir" rev-parse --short HEAD) version="unstable-$date.r${count}.$commit" case "${{ matrix.os }}" in windows-latest) os="windows"; ext=".exe" ;; macos-latest) os="darwin"; ext="" ;; ubuntu-latest) os="linux"; ext="" ;; esac cd "$CurrentDir"/service GOARCH="${{ matrix.goarch }}" CGO_ENABLED="${{ matrix.CGO_ENABLED }}" CC="${{ matrix.CC }}" go build -trimpath \ -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w ${{ matrix.EXTRA_LDFLAGS }}" \ -o "$CurrentDir/v2raya_bin/v2raya${ext}" cd "$CurrentDir"/core GOARCH="${{ matrix.goarch }}" CGO_ENABLED="${{ matrix.CGO_ENABLED }}" CC="${{ matrix.CC }}" go build -trimpath \ -ldflags "-X main.Version=$version -s -w ${{ matrix.EXTRA_LDFLAGS }}" \ -o "$CurrentDir/v2raya_bin/v2raya_core${ext}" ./main - name: Upload v2rayA Binary uses: actions/upload-artifact@v7 with: name: v2raya_pr_build_${{ matrix.os }}_${{ matrix.goarch }} path: v2raya_bin/v2raya*