build #95
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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:\\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-04-15 | |
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 | |
# 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 |