Merge pull request #2715 from kelvie/develop

Add Github Actions build of win64 artifacts, and update compile instructions.
develop
Myk 2023-01-24 21:53:04 -08:00 committed by GitHub
commit c21fb0d9ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 24 deletions

@ -125,6 +125,37 @@ jobs:
run: | run: |
rm -rf "$DF_FOLDER" rm -rf "$DF_FOLDER"
build-cross-win64:
name: Build MSVC win64
runs-on: ubuntu-22.04
steps:
- name: Clone DFHack
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Fetch ccache
uses: actions/cache@v3
with:
path: build/win64-cross/ccache
key: ccache-win64-cross-msvc-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
ccache-win64-cross-msvc-${{ github.ref_name }}
ccache-win64-cross-msvc
- name: Cross-compile win64 artifacts
run: |
cd build
bash -x build-win64-from-linux.sh
- name: Format artifact name
id: artifactname
run: |
echo name=$(date +%Y%m%d)-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT
- name: Upload win64 artifacts
uses: actions/upload-artifact@v3
with:
name: dfhack-win64-build-${{ steps.artifactname.outputs.name }}
path: build/win64-cross/output/*
docs: docs:
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
steps: steps:

@ -13,6 +13,7 @@ builder_uid=$(id -u)
mkdir -p win64-cross mkdir -p win64-cross
mkdir -p win64-cross/output mkdir -p win64-cross/output
mkdir -p win64-cross/ccache
# Check for sudo; we want to use the real user # Check for sudo; we want to use the real user
if [[ $(id -u) -eq 0 ]]; then if [[ $(id -u) -eq 0 ]]; then
@ -37,10 +38,12 @@ fi
# #
# NOTE: win64-cross is mounted in /src/build due to the hardcoded `cmake ..` in # NOTE: win64-cross is mounted in /src/build due to the hardcoded `cmake ..` in
# the Dockerfile # the Dockerfile
if ! docker run --rm -it -v "$srcdir":/src -v "$srcdir/build/win64-cross/":/src/build \ if ! docker run --rm -i -v "$srcdir":/src -v "$srcdir/build/win64-cross/":/src/build \
-e BUILDER_UID=$builder_uid \ -e BUILDER_UID=$builder_uid \
-e CCACHE_DIR=/src/build/ccache \
--name dfhack-win \ --name dfhack-win \
dfhack-build-msvc bash -c "cd /src/build && dfhack-configure windows 64 Release -DCMAKE_INSTALL_PREFIX=/src/build/output cmake .. -DBUILD_DOCS=1 && dfhack-make -j$jobs install" \ ghcr.io/dfhack/build-env:msvc \
bash -c "cd /src/build && dfhack-configure windows 64 Release -DCMAKE_INSTALL_PREFIX=/src/build/output cmake .. -DBUILD_DOCS=1 && dfhack-make -j$jobs install" \
; then ; then
echo echo
echo "Build failed" echo "Build failed"

@ -296,18 +296,13 @@ on a Linux host system.
:local: :local:
:depth: 1 :depth: 1
Step 1: prepare a docker image Step 1: prepare a build container
------------------------------ ---------------------------------
On your Linux host, install and run the docker daemon and then run these commands:: On your Linux host, install and run the docker daemon and then run these commands::
xhost +local:root xhost +local:root
git clone https://github.com/BenLubar/build-env.git docker run -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume=/tmp/.X11-unix:/tmp/.X11-unix --user buildmaster --name dfhack-win ghcr.io/dfhack/build-env:msvc
cd build-env/msvc
docker build .
docker image ls
IMAGE_ID=<your image id>
docker run -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" --volume=/tmp/.X11-unix:/tmp/.X11-unix --user buildmaster --name dfhack-win $IMAGE_ID
The ``xhost`` command and ``--env`` parameters are there so you can eventually The ``xhost`` command and ``--env`` parameters are there so you can eventually
run Dwarf Fortress from the container and have it display on your host. run Dwarf Fortress from the container and have it display on your host.
@ -380,19 +375,7 @@ existing Steam installation on Linux.
:local: :local:
:depth: 1 :depth: 1
Step 1: Build the MSVC builder image Step 1: Get dfhack, and run the build script
------------------------------------
It'll be called ``dfhack-build-msvc:latest`` after it's done building::
git clone https://github.com/BenLubar/build-env.git
cd build-env/msvc
docker build -t dfhack-build-msvc .
The docker build takes a while, but only needs to be done once, unless the build
environment changes.
Step 2: Get dfhack, and run the build script
-------------------------------------------- --------------------------------------------
Check out ``dfhack`` into another directory, and run the build script:: Check out ``dfhack`` into another directory, and run the build script::
@ -412,7 +395,7 @@ rather than directly::
sudo ./build-win64-from-linux.sh sudo ./build-win64-from-linux.sh
Step 3: install dfhack to your Steam DF install Step 2: install dfhack to your Steam DF install
----------------------------------------------- -----------------------------------------------
As the script will tell you, you can then copy the files into your DF folder:: As the script will tell you, you can then copy the files into your DF folder::