-
Notifications
You must be signed in to change notification settings - Fork 1
130 lines (128 loc) · 7.33 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
130
name: build
on:
workflow_dispatch:
push:
pull_request:
types: [opened]
env:
CARGO_BUILD_TARGET: i686-win7-windows-msvc
PROFILE: release
RUSTFLAGS: "-Clink-arg=/BREPRO -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:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise"
TOOLSET_VER: "14.40.33807"
jobs:
build:
name: build
runs-on: windows-2022
steps:
- name: Install MSVC toolchain reproducibly
run: |
# A dirty workaround to avoid the linker from using newer libraries and break the reproducibility of builds.
mv "C:\\Program Files\\Microsoft Visual Studio\\" "C:\\Program Files\\Microsoft Visual Studio - bak"
git clone https://github.com/mstorsjo/msvc-wine.git
# This script is fast, and enough for us.
python ./msvc-wine/vsdownload.py --accept-license --skip-recommended --dest "${{ env.VS_PATH }}" `
--manifest ${{ env.MSVC_MANIFEST }} `
Microsoft.VisualStudio.Component.VC.Tools.x86.x64
$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: actions/checkout@v4
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly-2024-06-18
components: rust-src
- name: Build giuroll.dll
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
- name: Generate some other attachments to be included in packs
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
- name: Upload giuroll
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
- name: Build the injector
run: |
cd injector
$Env:RUSTFLAGS = "${Env:RUSTFLAGS} -Ctarget-feature=+crt-static"
# 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
- name: Upload giuroll with injector
uses: actions/upload-artifact@v4
with:
name: giuroll-${{ env.VERSION }}_loaded-by-loader-exe
path: |
${{ env.PACK_DIR }}/loader
- name: Upload pdb file
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
- name: Build giuroll with `fillfree` feature enabled
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 }}/
- name: Upload giuroll with `fillfree` feature enabled
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