Usable version

This commit is contained in:
𐲓𐳛𐳪𐳂𐳐 𐲀𐳢𐳦𐳫𐳢 𐲥𐳔𐳛𐳪𐳌𐳑𐳖𐳇 2024-12-22 22:00:57 +08:00 committed by GitHub
parent c5f7fb68b5
commit ef3e8d639d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -14,21 +14,49 @@ on:
branches: branches:
- main - main
paths: paths:
- "**/*.go" # - "**/*.go"
- "go.mod" - "go.mod"
- "go.sum" - "go.sum"
- ".github/workflows/release-win7.yml" - ".github/workflows/release-win7.yml"
pull_request: pull_request:
types: [opened, synchronize, reopened] types: [opened, synchronize, reopened]
paths: paths:
- "**/*.go" # - "**/*.go"
- "go.mod" - "go.mod"
- "go.sum" - "go.sum"
- ".github/workflows/release-win7.yml" - ".github/workflows/release-win7.yml"
jobs: jobs:
prepare: prepare:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Set up Go compiler
uses: actions/setup-go@v5
with:
go-version: 'stable'
check-latest: true
- name: Download patched Go
uses: actions/checkout@v4
with:
# To change the repository of toolchail, change it here
repository: 'MetaCubeX/go'
ref: 'release-branch.go1.23'
- name: Build patched Go
run: |
cd ./src
. ./all.bash
cd ../
mkdir -p patched-go
rsync -a --exclude 'patched-go' ./ 'patched-go'
- name: Save patched builder
uses: actions/cache/save@v4
with:
path: patched-go
key: xray-patched-go-${{ github.sha }}-${{ github.run_number }}
- name: Restore Cache - name: Restore Cache
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4
with: with:
@ -75,71 +103,55 @@ jobs:
contents: write contents: write
strategy: strategy:
matrix: matrix:
goos: [""]
goarch: [""]
gotoolchain-ref: [""]
gotoolchain-branch: [""]
assetname: [""]
include: include:
# BEGIN Windows 7 # BEGIN Windows 7
- goos: windows - goos: windows
goarch: amd64 goarch: amd64
gotoolchain-ref: 'MetaCubeX/go'
gotoolchain-branch: release-branch.go1.23
assetname: win7-64 assetname: win7-64
- goos: windows - goos: windows
goarch: 386 goarch: 386
gotoolchain-ref: 'MetaCubeX/go'
gotoolchain-branch: release-branch.go1.23
assetname: win7-32 assetname: win7-32
# END Windows 7 # END Windows 7
fail-fast: false fail-fast: false
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
GOOS: ${{ matrix.goos }} GOOS: ${{ matrix.goos}}
GOARCH: ${{ matrix.goarch }} GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: 0 CGO_ENABLED: 0
steps: steps:
- name: Show workflow information - name: Show workflow information
run: | run: |
_NAME=${{ matrix.assetname }} _NAME=${{ matrix.assetname }}
echo "GOOS: $GOOS, GOARCH: $GOARCH, RELEASE_NAME: $_NAME" echo "GOOS: ${{ matrix.goos }}, GOARCH: ${{ matrix.goarch }}, RELEASE_NAME: $_NAME"
echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV echo "ASSET_NAME=$_NAME" >> $GITHUB_ENV
- name: Set up Go compiler
uses: actions/setup-go@v5
with:
go-version: 'latest'
- name: Prepare patched Go source directory
run: |
mkdir patched-go
cd patched-go
- name: Download patched Go
uses: actions/checkout@v4
with:
repository: ${{ matrix.gotoolchain-ref }}
ref: ${{ matrix.gotoolchain-branch }}
- name: Build patched Go
run: |
cd src
./all.bash
cd ../..
- name: Checkout codebase - name: Checkout codebase
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Restore Go builder
uses: actions/cache/restore@v4
with:
path: patched-go
key: xray-patched-go-${{ github.sha }}-${{ github.run_number }}
- name: Get project dependencies - name: Download dependencies and build Xray
run: go mod download
- name: Build Xray
run: | run: |
echo "Setup environment..."
export PATH=$PATH:$PWD/patched-go/bin
./patched-go/bin/go version
./patched-go/bin/go env -w GOPATH=$PWD
./patched-go/bin/go env -w GOROOT=$PWD/patched-go
echo "Download dependencies..."
./patched-go/bin/go mod download
echo "Build Xray..."
mkdir -p build_assets mkdir -p build_assets
make ./patched-go/bin/go clean -v -i $PWD
find . -maxdepth 1 -type f -regex './\(wxray\|xray\|xray_softfloat\)\(\|.exe\)' -exec mv {} ./build_assets/ \; rm -f xray xray.exe wxray.exe xray_softfloat
./patched-go/bin/go build -o xray.exe -trimpath -ldflags "-s -w -buildid=" -v ./main
./patched-go/bin/go build -o wxray.exe -trimpath -ldflags "-H windowsgui -s -w -buildid=" -v ./main
echo "Build completed."
find . -maxdepth 1 -type f -regex './\(wxray\|xray\).exe' -exec mv {} ./build_assets/ \;
- name: Restore Cache - name: Restore Cache
uses: actions/cache/restore@v4 uses: actions/cache/restore@v4