rust.ymlannotatedrust.ymlsource219 lines · 6.8 KB · raw
1name: Rust
2
3on:
4  push:
5    branches: [ "master" ]
6  pull_request:
7    branches: [ "master" ]
8
9env:
10  CARGO_TERM_COLOR: always
11  JGENESIS_VERSION: 0.14.1
12
13jobs:
14  build:
15    runs-on: ubuntu-latest
16
17    steps:
18    - uses: actions/checkout@v6
19
20    - name: Install latest stable Rust toolchain
21      run: |
22        rustup update
23
24    - name: Install latest nightly Rust toolchain
25      run: |
26        rustup toolchain add nightly --component rustfmt --component rust-src

https://github.com/libsdl-org/SDL/blob/main/docs/README-linux.md#build-dependencies

29    - name: Install SDL3 system dependencies
30      run: |
31        sudo apt-get update && \
32        sudo apt-get -y install build-essential git make \
33        pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
34        libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev \
35        libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxtst-dev \
36        libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
37        libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev \
38        libpipewire-0.3-dev libwayland-dev libdecor-0-dev liburing-dev
40    - name: Check formatting
41      run: |
42        cargo +nightly fmt --check
43
44    - name: Build
45      run: |
46        cargo build --all
47
48    - name: Build with unstable cores enabled
49      run: |
50        cargo build --all --features unstable-cores
51
52    - name: Check Clippy warnings
53      run: |
54        cargo clippy --all -- -D warnings
55
56    - name: Run tests
57      run: |
58        cargo test --all
59
60    - name: Run tests with unstable cores enabled
61      run: |
62        cargo test --all --features unstable-cores
63  miri:
64    runs-on: ubuntu-latest
65
66    steps:
67    - uses: actions/checkout@v6
68
69    - name: Install latest stable Rust toolchain
70      run: |
71        rustup update
72
73    - name: Install latest nightly Rust toolchain
74      run: |
75        rustup toolchain add nightly --component rust-src --component miri
76
77    - name: Run miri tests
78      run: |
79        scripts/run-miri-tests.sh
80  build-web:
81    runs-on: ubuntu-latest
82
83    env:
84      JGENESIS_TOOLCHAIN: nightly
85
86    steps:
87      - uses: actions/checkout@v6
88
89      - name: Install latest stable Rust toolchain
90        run: |
91          rustup update
92
93      - name: Install latest nightly Rust toolchain
94        run: |
95          rustup toolchain add $JGENESIS_TOOLCHAIN --component rust-src --component clippy
96
97      - name: Install wasm-pack
98        run: |
99          cargo install wasm-pack
100
101      - name: Build web
102        run: |
103          cd frontend/jgenesis-web && ./build.sh --dev
104  linux-release-appimage:
105    runs-on: ubuntu-22.04
106
107    steps:
108      - uses: actions/checkout@v6
109
110      - name: Install latest stable Rust toolchain
111        run: |
112          rustup update
113
114      - name: Install latest nightly Rust toolchain
115        run: |
116          rustup toolchain add nightly --component rustfmt --component rust-src

https://github.com/libsdl-org/SDL/blob/main/docs/README-linux.md#build-dependencies

119      - name: Install SDL3 system dependencies
120        run: |
121          sudo apt-get update && \
122          sudo apt-get -y install build-essential git make \
123          pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev \
124          libaudio-dev libjack-dev libsndio-dev libx11-dev libxext-dev \
125          libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxtst-dev \
126          libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev \
127          libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev \
128          libpipewire-0.3-dev libwayland-dev libdecor-0-dev liburing-dev
130      - name: Get latest cargo-packager version
131        id: get-packager-version
132        run: |
133          cargo search cargo-packager | head -1 | cut -d' ' -f3 | sed -re 's/"(.*)"/version=\1/g' >> $GITHUB_OUTPUT
134
135      - name: Cache cargo-packager binary
136        id: packager-cache
137        uses: actions/cache@v6
138        with:
139          path: ~/.cargo/bin/cargo-packager
140          key: ${{ runner.os }}-${{ steps.get-packager-version.outputs.version }}
141
142      - name: Install cargo-packager
143        if: steps.packager-cache.outputs.cache-hit != 'true'
144        run: |
145          cargo install cargo-packager --version ${{ steps.get-packager-version.outputs.version }}
146
147      - name: Build AppImage packages
148        run: |
149          RUST_LOG=debug cargo packager --profile release-lto -f appimage
150
151      - name: Upload GUI AppImage
152        uses: actions/upload-artifact@v6
153        with:
154          name: linux-x86_64-appimage
155          path: target/release-lto/jgenesis_${{ env.JGENESIS_VERSION }}_x86_64.AppImage
156  windows-release:
157    runs-on: ubuntu-latest
158
159    env:
160      SDL_VERSION: 3.4.10
161      DXC_RELEASE_TAG: v1.9.2602.24
162      DXC_ZIP_FILE: dxc_2026_05_27.zip
163
164    steps:
165      - uses: actions/checkout@v6
166
167      - name: Install latest stable Rust toolchain
168        run: |
169          rustup update
170
171      - name: Install latest nightly Rust toolchain
172        run: |
173          rustup toolchain add nightly --component rustfmt --component rust-src
174
175      - name: Install mingw32
176        run: |
177          sudo apt-get update && sudo apt-get install -y mingw-w64
178
179      - name: Install Windows x64 Rust build target (stable)
180        run: |
181          rustup target add x86_64-pc-windows-gnu
182
183      - name: Install Windows x64 Rust build target (nightly)
184        run: |
185          rustup target add --toolchain nightly x86_64-pc-windows-gnu
186
187      - name: Download & extract Windows SDL3 libraries
188        run: |
189          wget https://github.com/libsdl-org/SDL/releases/download/release-$SDL_VERSION/SDL3-$SDL_VERSION-win32-x64.zip && \
190          unzip SDL3-$SDL_VERSION-win32-x64.zip -d sdl3
191
192      - name: Download & extract DirectX shader compiler
193        run: |
194          mkdir dxcompiler && \
195          cd dxcompiler && \
196          wget https://github.com/microsoft/DirectXShaderCompiler/releases/download/$DXC_RELEASE_TAG/$DXC_ZIP_FILE && \
197          unzip $DXC_ZIP_FILE
198
199      - name: Build GUI release
200        run: |
201          RUSTFLAGS="-C target-cpu=x86-64-v2 -Z tune-cpu=x86-64-v3" \
202          cargo +nightly build --profile release-lto --target x86_64-pc-windows-gnu
203
204      - name: Compress binaries
205        run: |
206          mv LICENSE LICENSE-jgenesis.txt && \
207          mv target/x86_64-pc-windows-gnu/release-lto/*.exe ./ && \
208          mv sdl3/SDL3.dll ./ && \
209          mv sdl3/README.md ./README-SDL3.md && \
210          mv sdl3/LICENSE.txt ./LICENSE-SDL3.txt && \
211          mv dxcompiler/bin/x64/dxcompiler.dll ./ && \
212          mv dxcompiler/LICENSE* ./ && \
213          zip -r jgenesis-${JGENESIS_VERSION}-windows-x86_64.zip LICENSE* README-SDL3.md *.dll jgenesis.exe
214
215      - name: Upload GUI binaries
216        uses: actions/upload-artifact@v6
217        with:
218          name: windows-x86_64-exe
219          path: jgenesis-${{ env.JGENESIS_VERSION }}-windows-x86_64.zip