From 0f846f34aabf0680d7d7556b4df52bcd9604074c Mon Sep 17 00:00:00 2001 From: IQuant Date: Tue, 26 Nov 2024 15:50:33 +0300 Subject: [PATCH] CI test --- .github/workflows/release.yml | 39 +++++++++++++++++++++++++++++++++++ scripts/ci_make_archives.py | 21 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 scripts/ci_make_archives.py diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..df5277c1 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: release + +on: [push] + +# on: +# push: +# tags: +# - v** + +jobs: + build-and-release: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + with: + targets: i686-pc-windows-gnu, x86_64-pc-windows-gnu + + - name: Build ewext + run: cargo build --release --target i686-pc-windows-gnu + working-directory: ./ewext + - name: Copy ewext + run: cp ewext/target/i686-pc-windows-gnu/release/ewext.dll quant.ew/ewext0.dll + + - name: Build Linux proxy release + run: cargo build --release + working-directory: ./noita_proxy + - name: Build Windows proxy release + run: cargo build --release --target x86_64-pc-windows-gnu + working-directory: ./noita_proxy + + - name: Create archives + run: python scripts/ci_make_archives.py + + - uses: actions/upload-artifact@v4 + with: + name: release + path: target/* + diff --git a/scripts/ci_make_archives.py b/scripts/ci_make_archives.py new file mode 100644 index 00000000..2717dff5 --- /dev/null +++ b/scripts/ci_make_archives.py @@ -0,0 +1,21 @@ +cargo_manifest = tomllib.load(open("noita-proxy/Cargo.toml", "rb")) +version = cargo_manifest["package"]["version"] + +os.makedirs("target", exist_ok=True) + +with ZipFile("target/noita-proxy-win.zip", "w") as release: + release.write("noita-proxy/target/x86_64-pc-windows-gnu/release/noita-proxy.exe", arcname="noita_proxy.exe", compress_type=COMPRESS_TYPE, compresslevel=COMPRESS_LEVEL) + release.write("redist/steam_api64.dll", arcname="steam_api64.dll", compress_type=COMPRESS_TYPE, compresslevel=COMPRESS_LEVEL) + +print("Writing linux release...") + +with ZipFile("target/noita-proxy-linux.zip", "w") as release: + release.write("noita-proxy/target/release/noita-proxy", arcname="noita_proxy.x86_64", compress_type=COMPRESS_TYPE, compresslevel=COMPRESS_LEVEL) + release.write("redist/libsteam_api.so", arcname="libsteam_api.so", compress_type=COMPRESS_TYPE, compresslevel=COMPRESS_LEVEL) + +print("Writing mod release...") + +shutil.make_archive("target/quant.ew", "zip", "quant.ew") + +with ZipFile("target/quant.ew.zip", "a") as release: + release.writestr("files/version.lua", f'return "{version}"')