-
Notifications
You must be signed in to change notification settings - Fork 1
129 lines (127 loc) · 7.79 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: build
on: workflow_dispatch
env:
CARGO_BUILD_TARGET: i686-win7-windows-msvc
PROFILE: release
RUSTFLAGS: "-Clink-arg=/BREPRO -Ctarget-feature=+crt-static -Zremap-cwd-prefix=. -Clink-arg=/PDBALTPATH:%_PDB%"
CARGO_PROFILE_RELEASE_SPLIT_DEBUGINFO: packed
CARGO_PROFILE_RELEASE_DEBUG: true
CARGO_PROFILE_RELEASE_STRIP: none
PACK_DIR: _pack
PACK_NAME: giuroll
SWRSTOYS_DOC_ID: 18hjFMGgzZMuKhelwY2JbpiefJuEyQh899-Bl-edyzxk
LOADER_DOC_ID: 1V_5Gs1fH8kJiQcnrPkn-Tylp97Zqi6oTGuVBHssMWMU
# Hardcode SOURCE_URL_BASE with "https://github.com/Hagb/giuroll-hagb" if you want to reproduce the build
# in https://github.com/Hagb/giuroll-hagb/actions bit-for-bit.
SOURCE_URL_BASE: ${{ github.server_url }}/${{ github.repository }}
MSVC_MANIFEST: "https://download.visualstudio.microsoft.com/download/pr/11917f82-1030-4dda-a768-f0da3c4623a9/f3cb4f83005ad314ec45dac55db831a160d1af42c14db43e44eb7486d73212cf/VisualStudio.vsman"
# VS_PATH: "C:\\msvc-14.40\\"
VS_PATH: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise"
TOOLSET_VER: "14.40.33807"
jobs:
build:
name: build
runs-on: windows-2022
steps:
- run: |
# git clone https://github.com/mstorsjo/msvc-wine.git
# python ./msvc-wine/vsdownload.py --accept-license --skip-recommended --dest ${{ env.VS_PATH }} `
# --manifest ${{ env.MSVC_MANIFEST }} `
# Microsoft.VisualStudio.Component.VC.Tools.x86.x64
# # echo "CARGO_TARGET_I686_PC_WINDOWS_MSVC_LINKER=C:/msvc-14.40/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x86/link.exe" >> $env:GITHUB_ENV
# # echo "CARGO_TARGET_I686_WIN7_WINDOWS_MSVC_LINKER=C:/msvc-14.40/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x86/link.exe" >> $env:GITHUB_ENV
$installer = Invoke-DownloadWithRetry "https://aka.ms/vs/17/release/vs_enterprise.exe"
# echo Uninstall
# cmd /c "$installer" uninstall --quiet --norestart --nocache --wait
echo Install
cmd /c "$installer" modify --quiet --norestart --nocache --wait --installPath "${{ env.VS_PATH }}" `
--channelId VisualStudio.17.Release --add Microsoft.VisualStudio.Component.VC.14.40.17.10.x86.x64 `
--installChannelUri https://raw.githubusercontent.com/roblabla/msvc-manifest-history/53d363e801b1f1be225c337c7fa052c2a3296eeb/raw_channel.json `
--channelUri https://raw.githubusercontent.com/roblabla/msvc-manifest-history/53d363e801b1f1be225c337c7fa052c2a3296eeb/raw_channel.json
$linker = "${{ env.VS_PATH }}\\VC\\Tools\\MSVC\\${{ env.TOOLSET_VER }}\\bin\\HostX64\\x86\\link.exe"
echo "CARGO_TARGET_I686_PC_WINDOWS_MSVC_LINKER=${linker}" >> $env:GITHUB_ENV
echo "CARGO_TARGET_I686_WIN7_WINDOWS_MSVC_LINKER=${linker}" >> $env:GITHUB_ENV
- uses: TheMrMilchmann/setup-msvc-dev@v3
with:
arch: amd64_x86
vs-path: ${{ env.VS_PATH }}
toolset: "${{ env.TOOLSET_VER }}"
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2024-04-15
components: rust-src
- run: |
$commit_id = git rev-parse --short HEAD
$Env:SOURCE_URL = "${{ env.SOURCE_URL_BASE }}/tree/${commit_id}"
echo SOURCE_URL=$Env:SOURCE_URL >> $env:GITHUB_ENV
cargo build --profile ${{env.PROFILE}} -Z build-std
- run: |
mkdir ${{ env.PACK_DIR }}/${{ env.PACK_NAME }}
cp giuroll.ini ${{ env.PACK_DIR }}/${{ env.PACK_NAME }}/
cp giuroll.ini ${{ env.PACK_DIR }}/${{ env.PACK_NAME }}/giuroll-default.ini
cp LICENSE ${{ env.PACK_DIR }}/${{ env.PACK_NAME }}/LICENSE-giuroll.txt
cp target/${{ env.CARGO_BUILD_TARGET }}/${{ env.PROFILE }}/giuroll.dll ${{ env.PACK_DIR }}/${{ env.PACK_NAME }}/
echo [InternetShortcut] > verifiable-source-code-and-build.url
# https://stackoverflow.com/a/70566764
echo URL=${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} >> verifiable-source-code-and-build.url
cp verifiable-source-code-and-build.url ${{ env.PACK_DIR }}/${{ env.PACK_NAME }}/
Invoke-WebRequest "https://docs.google.com/feeds/download/documents/export/Export?id=${{ env.SWRSTOYS_DOC_ID }}&exportFormat=html" `
-OutFile ${{ env.PACK_DIR }}/${{ env.PACK_NAME }}/Installation-and-Usages.html
cargo run --example print-mod-json --profile ${{env.PROFILE}} -Z build-std > ${{ env.PACK_DIR }}/${{ env.PACK_NAME }}/mod.json
$verstr = cargo run --example print-version --profile ${{env.PROFILE}} -Z build-std
$commit_id = git rev-parse --short HEAD
echo VERSION=${verstr}_${commit_id} >> $env:GITHUB_ENV
echo "A workround to avoid the zip pack being flattened" > ${{ env.PACK_DIR }}/.a-workaround-to-avoid-being-flattened
- uses: actions/upload-artifact@v4
with:
name: giuroll-${{ env.VERSION }}
path: |
${{ env.PACK_DIR }}/${{ env.PACK_NAME }}
${{ env.PACK_DIR }}/.a-workaround-to-avoid-being-flattened
!${{ env.PACK_DIR }}/.a-workaround-to-avoid-being-flattened
- run: |
cd injector
# Workaround for the FUCKING anti-virus software, many of which even detect an exe which does nothing
# but is just written in rust and compiled by nightly toolchain with `-Ctarget-feature=+crt-static`!
# Even compiled with stable toolchain, such an exe is detected as virus by some anti-virus software.
rustup +nightly-2022-04-22 target add i686-pc-windows-msvc
cargo +nightly-2022-04-22 build --profile ${{env.PROFILE}} --target i686-pc-windows-msvc
cd ..
mkdir ${{ env.PACK_DIR }}/loader/
cp injector/target/i686-pc-windows-msvc/${{ env.PROFILE }}/giuroll_loader.exe ${{ env.PACK_DIR }}/loader/
cp injector/target/i686-pc-windows-msvc/${{ env.PROFILE }}/giuroll_loader_dll.dll ${{ env.PACK_DIR }}/loader/
cp target/${{ env.CARGO_BUILD_TARGET }}/${{ env.PROFILE }}/giuroll.dll ${{ env.PACK_DIR }}/loader/
cp giuroll.ini ${{ env.PACK_DIR }}/loader/
cp giuroll.ini ${{ env.PACK_DIR }}/loader/giuroll-default.ini
cp LICENSE ${{ env.PACK_DIR }}/loader/LICENSE-giuroll.txt
cp verifiable-source-code-and-build.url ${{ env.PACK_DIR }}/loader/
Invoke-WebRequest "https://docs.google.com/feeds/download/documents/export/Export?id=${{ env.LOADER_DOC_ID }}&exportFormat=html" `
-OutFile ${{ env.PACK_DIR }}/loader/Installation-and-Usages.html
cp injector/LICENSE-giuroll_loader ${{ env.PACK_DIR }}/loader//LICENSE-giuroll_loader.txt
cp injector/LICENSE-giuroll_loader_dll ${{ env.PACK_DIR }}/loader//LICENSE-giuroll_loader_dll.txt
- uses: actions/upload-artifact@v4
with:
name: giuroll-${{ env.VERSION }}_loaded-by-loader-exe
path: |
${{ env.PACK_DIR }}/loader
- uses: actions/upload-artifact@v4
with:
name: giuroll-pdb-${{ env.VERSION }}
path: |
target/${{ env.CARGO_BUILD_TARGET }}/${{ env.PROFILE }}/giuroll.pdb
LICENSE
source-code-and-the-build.url
- run: |
cargo build --profile ${{env.PROFILE}} -Z build-std --features fillfree
cp target/${{ env.CARGO_BUILD_TARGET }}/${{ env.PROFILE }}/giuroll.dll ${{ env.PACK_DIR }}/${{ env.PACK_NAME }}/
cp target/${{ env.CARGO_BUILD_TARGET }}/${{ env.PROFILE }}/giuroll.pdb ${{ env.PACK_DIR }}/${{ env.PACK_NAME }}/
- uses: actions/upload-artifact@v4
with:
name: giuroll-fillfree-${{ env.VERSION }}
path: |
${{ env.PACK_DIR }}/${{ env.PACK_NAME }}
${{ env.PACK_DIR }}/.a-workaround-to-avoid-being-flattened
!${{ env.PACK_DIR }}/.a-workaround-to-avoid-being-flattened