mirror of
https://github.com/spice2x/spice2x.github.io.git
synced 2026-08-01 22:30:42 -07:00
Add CI and improve build system (#293)
## Link to GitHub Issue, if one exists Fixes #292 ## Description of change This PR adds CI with Github Actions. Runs on every push and pull request. If a new commit is pushed, any previous runs are cancelled for that branch. In total, these optimisations (on a 7800X3D with 32GB 6000MT/s RAM and an NVMe Gen4 SSD): * Reduces `spicetools/deps` image size by around 200 MB, and build time by almost 50% * Reduces compilation time by around 9% Changes: * Pull archlinux image from GHCR so that we don't run into pull limits from docker.io * Use `base-devel` archlinux image * Reduces image build time from 141 seconds to 109 seconds on my machine * Clean up unneeded packages * Small reduction in `spicetools/deps` image size (4.35 GB vs 4.14 GB) * Use precompiled `yay` binary * Reduces image build time from 163 seconds to 141 seconds on my machine * Use `nproc` to get the number of cores instead of parsing `/proc/cpuinfo` with `awk` * Use `ninja` to compile * Speeds up compile times a little, around 13 seconds on my machine * Don't run `docker run` in interactive TTY in `build_docker.sh` * Github Actions disallows interactive TTYs * Still allowed for the batch script * `time` the compilation process * Enable BuildKit in the bash script * Required for build contexts * Don't use `USER` instruction * Breaks Github Actions, doesn't seem to affect build? * More info: https://docs.github.com/en/actions/sharing-automations/creating-actions/dockerfile-support-for-github-actions#user * `USER` also seems to cause issues on a mounted ReFS image * Add executable bits to bash scripts Future ideas: * Combine `external/Dockerfile` and `./Dockerfile` into one to deduplicate images and save disk space * Fix the weird `/src/src` directory structure in the Dockerfile and build scripts * Investigate CMake and ninja optimisations? ## Compiling Check CI status on my fork. ## Testing Tested with docker on Windows. Also play tested a bit to make sure the Github Actions artifact works.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
on: [push, pull_request]
|
||||
name: Continuous Integration
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
fw-ci:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./src/spice2x
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Compile
|
||||
run: ./build_docker.sh
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: spice2x
|
||||
path: src/spice2x/bin
|
||||
if-no-files-found: error
|
||||
Reference in New Issue
Block a user