Skip to content

Upload to build server in publish workflow for nym-vpn-core #19

Upload to build server in publish workflow for nym-vpn-core

Upload to build server in publish workflow for nym-vpn-core #19

name: build-nym-vpn-core-windows
on:
workflow_dispatch:
pull_request:
paths:
- ".github/workflows/build-nym-vpn-core-windows.yml"
workflow_call:
outputs:
RUST_VERSION:
value: ${{ jobs.build-linux.outputs.RUST_VERSION }}
UPLOAD_DIR_WINDOWS:
value: ${{ jobs.build-windows.outputs.UPLOAD_DIR_WINDOWS }}
env:
CARGO_TERM_COLOR: always
CARGO_TARGET: release
LIBS_PATH: '${{ github.workspace }}/build/lib/x86_64-pc-windows-msvc'
WG_GO_LIB_NAME: wireguard-go_x86_64-pc-windows-msvc
MULLVAD_LIB_NAME: winfw
UPLOAD_DIR_WINDOWS: windows_artifacts
jobs:
build-wireguard-go-windows:
uses: ./.github/workflows/build-wireguard-go-windows.yml
# TODO restore it when winfw build is fixed
# build-mullvad-windows:
# uses: ./.github/workflows/build-mullvad-windows.yml
build-windows:
# needs: [build-wireguard-go-windows, build-mullvad-windows]
needs: [build-wireguard-go-windows]
runs-on: custom-windows-11
outputs:
UPLOAD_DIR_WINDOWS: ${{ env.UPLOAD_DIR_WINDOWS }}
RUST_VERSION: ${{ steps.rust-version.outputs.rustc }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
- name: Install rust toolchain
uses: dtolnay/rust-toolchain@master
with:
# TODO let's pin to 1.82.0 as in 1.83.0 the "build winfw.dll from mullvad" step fails
toolchain: 1.82.0
components: rustfmt, clippy
- name: Install Go toolchain
uses: actions/setup-go@v5
with:
go-version: "stable"
- name: Get workspace version
id: workspace-version
uses: nicolaiunrein/cargo-get@master
with:
subcommand: workspace.package.version --entry nym-vpn-core
- name: Install cargo-edit
run: cargo install --locked cargo-edit
- name: Append timestamp if it's a dev version
shell: bash
run: ./scripts/append-timestamp-to-version.sh nym-vpn-core/Cargo.toml ${{ steps.workspace-version.outputs.output }}
- name: Download wireguard-go-windows artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.WG_GO_LIB_NAME }}
path: ${{ env.LIBS_PATH }}/
# TODO restore it when winfw build is fixed
# - name: Download mullvad lib artifact (winfw.lib)
# uses: actions/download-artifact@v4
# with:
# name: ${{ env.MULLVAD_LIB_NAME }}.lib
# path: ${{ env.LIBS_PATH }}/
#
# - name: Download mullvad lib artifact (winfw.dll)
# uses: actions/download-artifact@v4
# with:
# name: ${{ env.MULLVAD_LIB_NAME }}.dll
# path: ${{ env.LIBS_PATH }}/
- name: Download/Unzip/Move wintun.zip, winpcap.zip also move libwg and winfw lib
shell: bash
run: |
curl --output ${GITHUB_WORKSPACE}/wintun.zip https://www.wintun.net/builds/wintun-0.14.1.zip
unzip ${GITHUB_WORKSPACE}/wintun.zip
mv ${GITHUB_WORKSPACE}/wintun/bin/amd64/wintun.dll nym-vpn-core/
mv '${{ env.LIBS_PATH }}/libwg.dll' nym-vpn-core/
mv '${{ env.LIBS_PATH }}/libwg.lib' nym-vpn-core/
# # TODO restore it when winfw build is fixed
# mv '${{ env.LIBS_PATH }}/winfw.dll' nym-vpn-core/
# mv '${{ env.LIBS_PATH }}/winfw.lib' nym-vpn-core/
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build nym-vpn-core
working-directory: nym-vpn-core
run: |
cargo build --${{ env.CARGO_TARGET }}
- name: Get rust version used for build
id: rust-version
run: |
echo "rustc=$(rustc -V)" >> $GITHUB_OUTPUT
- name: Move things around to prepare for upload
shell: bash
env:
SRC_BINARY: nym-vpn-core/target/${{ env.CARGO_TARGET }}/
run: |
echo "moving binaries into ${{ env.UPLOAD_DIR_WINDOWS }}"
rm -rf ${{ env.UPLOAD_DIR_WINDOWS }} || true
mkdir ${{ env.UPLOAD_DIR_WINDOWS }}
#cp -vpr ${{ env.SRC_BINARY }}/nym-gateway-probe.exe ${{ env.UPLOAD_DIR_WINDOWS }}
cp -vpr ${{ env.SRC_BINARY }}/nym-vpnc.exe ${{ env.UPLOAD_DIR_WINDOWS }}
cp -vpr ${{ env.SRC_BINARY }}/nym-vpnd.exe ${{ env.UPLOAD_DIR_WINDOWS }}
cp -vpr nym-vpn-core/libwg.dll ${{ env.UPLOAD_DIR_WINDOWS }}
cp -vpr nym-vpn-core/wintun.dll ${{ env.UPLOAD_DIR_WINDOWS }}
# # TODO restore it when winfw build is fixed
# cp -vpr nym-vpn-core/winfw.dll ${{ env.UPLOAD_DIR_WINDOWS }}
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.UPLOAD_DIR_WINDOWS }}
path: ${{ env.UPLOAD_DIR_WINDOWS }}
retention-days: 1