diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..4e9aa87 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,35 @@ +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: | + ls target + ls target/release + ls config + Move-Item -Path "target/release/corplink-rs.exe" -Destination "." + Move-Item -Path "config/config.json" -Destination "." + Compress-Archive -Path corplink-rs.exe,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"