From a57d6374890b4934db8287195277bcadacbdfe4d Mon Sep 17 00:00:00 2001 From: PinkD <443657547@qq.com> Date: Sun, 1 Dec 2024 21:15:48 +0800 Subject: [PATCH] test release windows --- .github/workflows/test.yml | 32 ++++++++++++++++++++++++++++++++ libwg/build.ps1 | 11 +++++++++++ libwg/version.go | 3 +++ pack/PKGBUILD | 11 ++++------- 4 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/test.yml create mode 100755 libwg/build.ps1 create mode 100644 libwg/version.go diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..730ef8e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,32 @@ +name: test + +on: + push: + branches: + - test + +jobs: + build-windows: + name: build-windows + runs-on: windows-latest + steps: + - name: checkout code + uses: actions/checkout@v4 + - name: setup go + uses: actions/setup-go@v5 + with: + go-version: '>=1.22.0' + - name: build libwg + run: cd libwg && ./build.ps1 + - name: rust install gnu toolchain + run: rustup toolchain install stable-gnu + - name: rust use gnu toolchain + run: rustup default stable-x86_64-pc-windows-gnu + - name: build package + run: cargo build --release + - name: build check result + run: | + cd target + cp release/corplink-rs . + Compress-Archive -Path corplink-rs,config.json -Destination corplink-rs-${{ github.ref_name }}-windows.zip + ls diff --git a/libwg/build.ps1 b/libwg/build.ps1 new file mode 100755 index 0000000..d05d583 --- /dev/null +++ b/libwg/build.ps1 @@ -0,0 +1,11 @@ +# 初始化并更新所有子模块 +git submodule update --init --recursive + +# 切换到 wireguard-go 目录 +Set-Location wireguard-go + +# 编译 libwg +make libwg + +# 将生成的 libwg 文件移动到上级目录 +Move-Item -Path "libwg.*" -Destination ".." diff --git a/libwg/version.go b/libwg/version.go new file mode 100644 index 0000000..2036c23 --- /dev/null +++ b/libwg/version.go @@ -0,0 +1,3 @@ +package main + +const Version = "windows-version" diff --git a/pack/PKGBUILD b/pack/PKGBUILD index 20e4253..cfdc501 100644 --- a/pack/PKGBUILD +++ b/pack/PKGBUILD @@ -7,24 +7,21 @@ pkgrel=1 pkgdesc='Corplink client written in Rust' arch=('i686' 'x86_64') url='https://github.com/PinkD/corplink-rs' -license=('GPL2') +license=('GPL-2.0-only') makedepends=('cargo' 'go' 'clang') source=( "$pkgname.$pkgver.tar.gz"::"https://github.com/PinkD/corplink-rs/archive/$pkgver.tar.gz" - "wireguard-go"::"git+https://github.com/PinkD/wireguard-go" ) -# use SKIP to avoid update PKGBUILD everytime sha256sums=( 'SKIP' - 'SKIP' ) backup=(etc/corplink/config.json) build() { # build libwg - cd "$srcdir/wireguard-go" - make libwg - cp libwg.* "$srcdir/$_pkgbase-$pkgver/libwg/" + cd "$srcdir/$_pkgbase-$pkgver/libwg" + ./build.sh + cp libwg.* ../q # build corplink-rs cd "$srcdir/$_pkgbase-$pkgver"