Files
v2rayA/.github/workflows/pull_request.yml
2023-11-25 13:30:56 +08:00

142 lines
4.4 KiB
YAML

name: Pull Request Check
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- "**/*.go"
- "service/**"
- "gui/**"
- ".github/workflows/*.yml"
jobs:
Build_v2rayA_Web:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: lts/*
cache: 'yarn'
cache-dependency-path: gui/yarn.lock
- name: Install Dependencies
run: |
sudo apt-get update -y && sudo apt-get install -y gzip
- name: Build GUI
run: |
yarn --cwd gui --check-files
yarn --cwd gui build
echo "Use tar to generate web.tar.gz..."
tar -zcvf web.tar.gz web/
- name: Upload Zip File to Artifacts
uses: actions/upload-artifact@v3
with:
path: web/*
name: web
Build_on_Linux:
runs-on: ubuntu-22.04
needs: Build_v2rayA_Web
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: web
path: service/server/router/web
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.21
- 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"
os="linux"
cd "$CurrentDir"/service
for arch in amd64 arm64; do
GOARCH="$arch" CGO_ENABLED=0 go build -tags "with_gvisor" -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CurrentDir"/v2raya_bin/v2raya_pr_build_"$os"_"$arch"_"$version"
done
- name: Upload Zip File to Artifacts
uses: nanoufo/action-upload-artifacts-and-release-assets@v1.8
with:
path: v2raya_bin/*
Build_on_Windows:
runs-on: windows-latest
needs: Build_v2rayA_Web
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: web
path: service/server/router/web
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.21
- 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"
os="windows"
cd "$CurrentDir"/service
for arch in amd64 arm64; do
GOARCH="$arch" CGO_ENABLED=0 go build -tags "with_gvisor" -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CurrentDir"/v2raya_bin/v2raya_pr_build_"$os"_"$arch"_"$version".exe
done
- name: Upload Zip File to Artifacts
uses: nanoufo/action-upload-artifacts-and-release-assets@v1.8
with:
path: v2raya_bin/*
Build_on_macOS:
runs-on: macos-latest
needs: Build_v2rayA_Web
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: web
path: service/server/router/web
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.21
- 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"
os="darwin"
cd "$CurrentDir"/service
for arch in amd64 arm64; do
GOARCH="$arch" CGO_ENABLED=0 go build -tags "with_gvisor" -ldflags "-X github.com/v2rayA/v2rayA/conf.Version=$version -s -w" -o "$CurrentDir"/v2raya_bin/v2raya_pr_build_"$os"_"$arch"_"$version"
done
- name: Upload Zip File to Artifacts
uses: nanoufo/action-upload-artifacts-and-release-assets@v1.8
with:
path: v2raya_bin/*