build #94
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:\\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 | |
mv "C:\\Program Files\\Microsoft Visual Studio\\" "C:\\Program Files\\Microsoft Visual Studio - bak" | |
python ./msvc-wine/vsdownload.py --accept-license --skip-recommended --dest "${{ env.VS_PATH }}" ` | |
--manifest ${{ env.MSVC_MANIFEST }} ` | |
Microsoft.VisualStudio.Component.VC.Tools.x86.x64 | |
# dirty hack | |
# # 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 |