Skip to content

RT Struct

RT Struct #67

Workflow file for this run

name: Build LRT
on:
push:
permissions: write-all
jobs:
getver:
name: Get version
runs-on: ubuntu-22.04
outputs:
version: ${{ steps.release_data.outputs.result }}
id: ${{ steps.release.outputs.id }}
upload_url: ${{ steps.release.outputs.upload_url }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version
shell: pwsh
run: ./version.ps1
- name: Get Version
id: release_data
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const { readFileSync } = require("fs");
const version = readFileSync("./.version").toString();
return version;
- name: Get Tag
id: tag
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const { readFileSync } = require("fs");
const tag = readFileSync("./.tag").toString();
return tag;
- name: Create Release
uses: softprops/action-gh-release@v2
id: release
with:
tag_name: ${{ steps.tag.outputs.result }}
name: LRT ${{ steps.tag.outputs.result }}
generate_release_notes: true
body_path: ./RELEASE.md
append_body: true
files: |
./.build
draft: true
build-gui:
name: Build with GUI (Dialog)
needs: [getver]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
# windows-latest + -pc-windows-msvc
- os: windows-latest
arch: x86_64
suffix: "-pc-windows-msvc"
- os: windows-latest
arch: i686
suffix: "-pc-windows-msvc"
- os: windows-latest
arch: aarch64
suffix: "-pc-windows-msvc"
# macos-latest
- os: macos-latest
arch: x86_64
suffix: "-apple-darwin"
- os: macos-latest
arch: aarch64
suffix: "-apple-darwin"
# ubuntu-22.04 (x86_64)
- os: ubuntu-22.04
arch: x86_64
suffix: "-unknown-linux-gnu"
# ubuntu-22.04-arm (aarch64)
- os: ubuntu-22.04-arm
arch: aarch64
suffix: "-unknown-linux-gnu"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get Build target
id: target
shell: pwsh
run: |
echo "target=${{ matrix.arch }}${{ matrix.suffix }}" >> $env:GITHUB_OUTPUT
- name: Prerequisites
shell: pwsh
run: |
rustup default nightly
rustup toolchain install nightly
rustup target add --toolchain nightly ${{ steps.target.outputs.target }}
"${{ needs.getver.outputs.version }}" > .version
- name: Run package script
shell: pwsh
env:
RELEASE: "true"
BUILD_TARGET: ${{ steps.target.outputs.target }}
run: |
./package.ps1
- name: Upload binary
uses: AButler/upload-release-assets@v3.0
with:
files: |
${{ steps.target.outputs.target }}.zip
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-id: ${{ needs.getver.outputs.id }}
- name: Upload as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.target.outputs.target }}.zip
path: ${{ steps.target.outputs.target }}.zip
build-nogui:
name: Build without GUI
needs: [getver]
runs-on: ${{ matrix.os }}
strategy:
# To test which targets fail
fail-fast: false
matrix:
include:
# Cursed Linux Targets
- os: ubuntu-22.04
arch: i686
suffix: "-unknown-linux-gnu"
cross: "true"
- os: ubuntu-22.04
arch: arm
suffix: "-unknown-linux-gnueabi"
cross: "true"
- os: ubuntu-22.04
arch: arm
suffix: "-unknown-linux-gnueabihf"
cross: "true"
- os: ubuntu-22.04
arch: armv7
suffix: "-unknown-linux-gnueabi"
cross: "true"
- os: ubuntu-22.04
arch: armv7
suffix: "-unknown-linux-gnueabihf"
cross: "true"
- os: ubuntu-22.04
arch: armv5te
suffix: -unknown-linux-gnueabi
cross: "true"
# Even more cursed (obscure) Linux Targets
- os: ubuntu-22.04
arch: loongarch64
suffix: "-unknown-linux-gnu"
cross: "true"
- os: ubuntu-22.04
arch: loongarch64
suffix: "-unknown-linux-musl"
cross: "true"
# PowerPC
- os: ubuntu-22.04
arch: powerpc
suffix: "-unknown-linux-gnu"
cross: "true"
- os: ubuntu-22.04
arch: powerpc64le
suffix: "-unknown-linux-gnu"
cross: "true"
- os: ubuntu-22.04
arch: powerpc64
suffix: "-unknown-linux-gnu"
cross: "true"
# RISC
- os: ubuntu-22.04
arch: riscv64gc
suffix: "-unknown-linux-gnu"
cross: "true"
# MIPS
- os: ubuntu-22.04
arch: mips
suffix: -unknown-linux-gnu
cross: "true"
- os: ubuntu-22.04
arch: mipsel
suffix: -unknown-linux-gnu
cross: "true"
- os: ubuntu-22.04
arch: mips64
suffix: -unknown-linux-gnuabi64
cross: "true"
- os: ubuntu-22.04
arch: mips64el
suffix: -unknown-linux-gnuabi64
cross: "true"
# BSD
- os: ubuntu-22.04
arch: x86_64
suffix: "-unknown-freebsd"
cross: "true"
- os: ubuntu-22.04
arch: i686
suffix: "-unknown-freebsd"
cross: "true"
- os: ubuntu-22.04
arch: x86_64
suffix: "-unknown-dragonfly"
cross: "true"
- os: ubuntu-22.04
arch: x86_64
suffix: "-unknown-netbsd"
cross: "true"
- os: ubuntu-22.04
arch: x86_64
suffix: "-unknown-illumos"
cross: "true"
# Android (via NDK)
- os: ubuntu-22.04
arch: aarch64
suffix: "-linux-android"
cross: "true"
- os: ubuntu-22.04
arch: armv7
suffix: "-linux-androideabi"
cross: "true"
- os: ubuntu-22.04
arch: x86_64
suffix: "-linux-android"
cross: "true"
- os: ubuntu-22.04
arch: i686
suffix: "-linux-android"
cross: "true"
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.arch }}${{ matrix.suffix }}-cache
workspaces: |
smelt -> target
lrt -> target
- name: Get Build target
id: target
shell: pwsh
run: |
echo "target=${{ matrix.arch }}${{ matrix.suffix }}" >> $env:GITHUB_OUTPUT
- name: Prerequisites
shell: pwsh
run: |
rustup default nightly
rustup toolchain install nightly
rustup component add rust-src
"${{ needs.getver.outputs.version }}" > .version
- name: Install cross
if: matrix.cross == 'true'
run: |
sudo apt-get update
sudo apt-get -y install podman
cargo install cross --git https://github.com/cross-rs/cross
- name: Run package script
shell: pwsh
env:
RELEASE: "true"
BUILD_TARGET: ${{ steps.target.outputs.target }}
GUI: "false"
USE_CROSS: ${{ matrix.cross }}
CROSS_CONFIG: ${{ github.workspace }}/Cross.toml
run: |
./package.ps1
- name: Upload binary
uses: AButler/upload-release-assets@v3.0
with:
files: |
${{ steps.target.outputs.target }}.zip
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-id: ${{ needs.getver.outputs.id }}
- name: Upload as Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.target.outputs.target }}.zip
path: ${{ steps.target.outputs.target }}.zip
win-installers:
name: Build Windows Installers
runs-on: windows-latest
# Needs all the targets to be built
needs: [getver, build-gui]
strategy:
matrix:
include:
- target: x86_64-pc-windows-msvc
arch: X64
- target: i686-pc-windows-msvc
arch: X86
- target: aarch64-pc-windows-msvc
arch: Arm64
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET 9.x
uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.x"
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.target }}.zip
- name: Build installer
shell: pwsh
env:
ARCH: ${{ matrix.arch }}
TARGET: ${{ matrix.target }}
run: ./buildInstaller.ps1
- name: Upload binary
uses: AButler/upload-release-assets@v3.0
with:
files: |
lrtexec_${{ matrix.target }}_installer.msi
repo-token: ${{ secrets.GITHUB_TOKEN }}
release-id: ${{ needs.getver.outputs.id }}
handle:
name: Handle artifacts
needs: [getver, build-gui, build-nogui, win-installers]
runs-on: ubuntu-22.04
if: always() && needs.getver.result == 'success'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Delete Release if failure
if: needs.build-gui.result != 'success' || needs.build-nogui.result != 'success' || needs.win-installers.result != 'success'
uses: actions/github-script@v7
with:
script: |
await github.rest.repos.deleteRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ needs.getver.outputs.id }}
});
- name: Undraft release if success
if: needs.build-gui.result == 'success' && needs.build-nogui.result == 'success' && needs.win-installers.result == 'success'
uses: actions/github-script@v7
with:
script: |
await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ needs.getver.outputs.id }},
draft: false
});