From c797e5b2d21e7090f031b8998101f3d1614d1d8f Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sat, 29 Jul 2023 14:03:50 -0700 Subject: [PATCH 01/21] poke at a native windows build and see what happens --- .github/workflows/build.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cfa238862..c182296c5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -186,6 +186,31 @@ jobs: name: dfhack-linux64-build-${{ steps.artifactname.outputs.name }} path: build/output/* + package-win64: + name: Win64 package (native) + runs-on: windows-latest + steps: + - name: Clone DFHack + uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: 0 + - name: Configure DFHack + run: | + cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image + - name: Build DFHack + run: | + cmake --build build --config Release --target install + - name: Format artifact name + id: artifactname + run: | + echo name=$(date +%Y%m%d)-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: dfhack-win64-build-${{ steps.artifactname.outputs.name }} + path: build/image/* + build-cross-win64: name: Win64 package runs-on: ubuntu-22.04 From 37357da64b203d68922a974be9a4a69f1793ca24 Mon Sep 17 00:00:00 2001 From: Myk Date: Sun, 30 Jul 2023 00:08:58 -0700 Subject: [PATCH 02/21] add clcache --- .github/workflows/build.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c182296c5..146666955 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -190,17 +190,27 @@ jobs: name: Win64 package (native) runs-on: windows-latest steps: + - name: Fetch cache + uses: actions/cache@v3 + with: + path: "%HOME%/clcache" + key: clcache-win64-${{ github.sha }} + restore-keys: | + clcache-win64 - name: Clone DFHack uses: actions/checkout@v3 with: submodules: true fetch-depth: 0 + - name: Install dependencies + run: pip install clcache + - run: pip install 'sphinx<4.4.0' - name: Configure DFHack run: | - cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image + cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image -DCMAKE_C_COMPILER_LAUNCHER=clcache -DCMAKE_CXX_COMPILER_LAUNCHER=clcache -DBUILD_DOCS:BOOL=1 -DBUILD_STONESENSE:BOOL=1 - name: Build DFHack run: | - cmake --build build --config Release --target install + cmake --build build -j 2 --config Release --target install - name: Format artifact name id: artifactname run: | From 1d356bf35123050c8ad8c382b2cecd085965aece Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 30 Jul 2023 16:45:01 -0700 Subject: [PATCH 03/21] fix artifact name --- .github/workflows/build.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 146666955..8d565db94 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -202,23 +202,18 @@ jobs: with: submodules: true fetch-depth: 0 - - name: Install dependencies - run: pip install clcache + - run: pip install clcache - run: pip install 'sphinx<4.4.0' - name: Configure DFHack - run: | - cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image -DCMAKE_C_COMPILER_LAUNCHER=clcache -DCMAKE_CXX_COMPILER_LAUNCHER=clcache -DBUILD_DOCS:BOOL=1 -DBUILD_STONESENSE:BOOL=1 + run: cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image -DCMAKE_C_COMPILER_LAUNCHER=clcache -DCMAKE_CXX_COMPILER_LAUNCHER=clcache -DBUILD_DOCS:BOOL=1 -DBUILD_STONESENSE:BOOL=1 - name: Build DFHack - run: | - cmake --build build -j 2 --config Release --target install - - name: Format artifact name - id: artifactname - run: | - echo name=$(date +%Y%m%d)-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT + run: cmake --build build -j 2 --config Release --target install + - uses: benjlevesque/short-sha@v2.2 + id: short-sha - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: dfhack-win64-build-${{ steps.artifactname.outputs.name }} + name: dfhack-win64-build-${{ steps.short-sha.outputs.sha }} path: build/image/* build-cross-win64: From 7514dd2cba0b4303ade9486eb5cbdf6a24c93d6b Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 30 Jul 2023 16:58:27 -0700 Subject: [PATCH 04/21] name stage --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8d565db94..7875466b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -208,7 +208,8 @@ jobs: run: cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image -DCMAKE_C_COMPILER_LAUNCHER=clcache -DCMAKE_CXX_COMPILER_LAUNCHER=clcache -DBUILD_DOCS:BOOL=1 -DBUILD_STONESENSE:BOOL=1 - name: Build DFHack run: cmake --build build -j 2 --config Release --target install - - uses: benjlevesque/short-sha@v2.2 + - name: Format artifact name + uses: benjlevesque/short-sha@v2.2 id: short-sha - name: Upload artifact uses: actions/upload-artifact@v3 From 1faf156bfcaab233d1c16c6607e592bebd50e853 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 30 Jul 2023 19:36:12 -0700 Subject: [PATCH 05/21] first attempt at a reusable workflow --- .github/workflows/build-linux.yml | 110 ++++++++++++++ .github/workflows/build.yml | 236 ++++++++---------------------- 2 files changed, 167 insertions(+), 179 deletions(-) create mode 100644 .github/workflows/build-linux.yml diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml new file mode 100644 index 000000000..51c933ef1 --- /dev/null +++ b/.github/workflows/build-linux.yml @@ -0,0 +1,110 @@ +name: build-linux + +on: + workflow_call: + inputs: + artifact-name: + type: string + append-date-and-hash: + type: boolean + default: false + cache-id: + type: string + default: '' + platform-files: + type: boolean + default: true + common-files: + type: boolean + default: true + docs: + type: boolean + default: false + stonesense: + type: boolean + default: true + extras: + type: boolean + default: false + gcc-ver: + type: string + default: "11" + +jobs: + build-linux64: + name: Linux package + runs-on: ubuntu-22.04 + steps: + - name: Install basic build dependencies + run: | + sudo apt-get update + sudo apt-get install ninja-build + - name: Install binary build dependencies + if: inputs.platform-files + run: | + sudo apt-get install \ + ccache \ + gcc-${{ inputs.gcc-ver }} \ + g++-${{ inputs.gcc-ver }} \ + libxml-libxslt-perl + - name: Install stonesense dependencies + if: inputs.stonesense + run: sudo apt-get install libgl-dev + - name: Install doc dependencies + if: inputs.docs + run: pip install 'sphinx<4.4.0' + - name: Clone DFHack + uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: ${{ !inputs.platform-files && 1 || 0 }} + - name: Fetch ccache + if: inputs.platform-files + uses: actions/cache@v3 + with: + path: ~/.ccache + key: linux-gcc-${{ inputs.gcc-ver }}-${{ inputs.cache-id }}-${{ github.sha }} + restore-keys: | + linux-gcc-${{ inputs.gcc-ver }}-${{ inputs.cache-id }} + linux-gcc-${{ inputs.gcc-ver }} + - name: Configure DFHack + env: + CC: gcc-${{ inputs.gcc-ver }} + CXX: g++-${{ inputs.gcc-ver }} + run: | + cmake \ + -S . \ + -B build \ + -G Ninja \ + -DCMAKE_INSTALL_PREFIX=build/image \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_LIBRARY:BOOL=${{ inputs.platform-files }} \ + -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files }} \ + -DBUILD_STONESENSE:BOOL=${{ inputs.platform-files }} \ + -DBUILD_DEV_PLUGINS:BOOL=${{ inputs.extras }} \ + -DBUILD_SIZECHECK:BOOL=${{ inputs.extras }} \ + -DBUILD_SKELETON:BOOL=${{ inputs.extras }} \ + -DBUILD_DOCS:BOOL=${{ inputs.docs }} \ + -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} \ + -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} + - name: Build DFHack + run: ninja -C build install + - name: Run cpp tests + run: ninja -C build test + - name: Trim cache + if: inputs.platform-files + run: | + ccache --max-size 50M + ccache --cleanup + ccache --show-stats + - name: Format artifact name + if: ${{ inputs.append-date-and-hash }} + id: artifactname + run: | + echo name=${{ inputs.artifact-name }}-$(date +%Y%m%d)-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT + - name: Upload artifact + if: inputs.artifact-name + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.append-date-and-hash && inputs.artifact-name || steps.artifactname.outputs.name}} + path: build/image/* diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7875466b9..73038b649 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,98 +3,62 @@ name: Build on: [push, pull_request] jobs: - build-test: - runs-on: ${{ matrix.os }} + build-linux: + name: Build (Linux ${{ matrix.type }}, GCC ${{ matrix.gcc }}) + uses: ./.github/workflows/build-linux.yml + with: + artifact-name: ${{ matrix.artifact-name != 0 && matrix.artifact-name || format('{0}-gcc-{1}', matrix.type, matrix.gcc) }} + append-date-and-hash: ${{ matrix.append-date-and-hash }} + cache-id: ${{ matrix.type }} + stonesense: ${{ matrix.stonesense }} + docs: ${{ matrix.type == 'release' }} + extras: ${{ matrix.extras }} + gcc-ver: ${{ matrix.gcc }} + secrets: inherit + strategy: + fail-fast: false + matrix: + include: + - type: release + gcc: "10" + artifact-name: dfhack-linux64 + append-date-and-hash: true + stonesense: true + extras: false + - type: test + gcc: "10" + stonesense: false + extras: false + - type: test + gcc: "12" + stonesense: true + extras: true + + test-linux: name: Test (Linux, GCC ${{ matrix.gcc }}, ${{ matrix.plugins }} plugins) + needs: build-linux + runs-on: ubuntu-22.04 strategy: fail-fast: false matrix: - os: - - ubuntu-22.04 - gcc: - - 10 - plugins: - - default + gcc: [10] + plugins: [default] include: - - os: ubuntu-22.04 - gcc: 12 + - gcc: 12 plugins: all steps: - - name: Set up Python 3 - uses: actions/setup-python@v4 + - name: Download artifact + uses: actions/download-artifact@v3 with: - python-version: 3 - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install \ - ccache \ - libgl-dev \ - libxml-libxslt-perl \ - ninja-build - pip install 'sphinx<4.4.0' - - name: Install GCC - run: | - sudo apt-get install gcc-${{ matrix.gcc }} g++-${{ matrix.gcc }} - - name: Clone DFHack - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 - - name: Set up environment - id: env_setup - run: | - DF_VERSION="$(sh ci/get-df-version.sh)" - echo "df_version=${DF_VERSION}" >> $GITHUB_OUTPUT - echo "DF_VERSION=${DF_VERSION}" >> $GITHUB_ENV - echo "DF_FOLDER=${HOME}/DF/${DF_VERSION}/df_linux" >> $GITHUB_ENV - echo "CCACHE_DIR=${HOME}/.ccache" >> $GITHUB_ENV - - name: Fetch ccache - uses: actions/cache@v3 - with: - path: ~/.ccache - key: ccache-${{ matrix.os }}-gcc-${{ matrix.gcc }}-test-${{ github.sha }} - restore-keys: | - ccache-${{ matrix.os }}-gcc-${{ matrix.gcc }}-test - ccache-${{ matrix.os }}-gcc-${{ matrix.gcc }} + name: test-${{ matrix.gcc }} # - name: Fetch DF cache # uses: actions/cache@v3 # with: # path: ~/DF - # key: df-${{ steps.env_setup.outputs.df_version }}-${{ hashFiles('ci/download-df.sh') }} + # key: df-${{ hashFiles('ci/download-df.sh') }} # - name: Download DF # run: | # sh ci/download-df.sh - - name: Configure DFHack - env: - CC: gcc-${{ matrix.gcc }} - CXX: g++-${{ matrix.gcc }} - run: | - cmake \ - -S . \ - -B build-ci \ - -G Ninja \ - -DCMAKE_INSTALL_PREFIX="$DF_FOLDER" \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DDFHACK_BUILD_ARCH=64 \ - -DBUILD_DEV_PLUGINS:BOOL=${{ matrix.plugins == 'all' }} \ - -DBUILD_SIZECHECK:BOOL=${{ matrix.plugins == 'all' }} \ - -DBUILD_SKELETON:BOOL=${{ matrix.plugins == 'all' }} \ - -DBUILD_STONESENSE:BOOL=${{ matrix.plugins == 'all' }} \ - -DBUILD_TESTS:BOOL=ON - - name: Build DFHack - run: | - ninja -C build-ci install - ccache --max-size 50M - ccache --cleanup - ccache --show-stats - - name: Run cpp unit tests - id: run_tests_cpp - run: | - ninja -C build-ci test - exit $? # - name: Run lua tests # id: run_tests_lua # run: | @@ -119,81 +83,16 @@ jobs: # run: | # rm -rf "$DF_FOLDER" - build-linux64: - name: Linux package - runs-on: ubuntu-22.04 - steps: - - name: Set up Python 3 - uses: actions/setup-python@v4 - with: - python-version: 3 - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install \ - ccache \ - gcc-10 \ - g++-10 \ - libgl-dev \ - libxml-libxslt-perl \ - ninja-build - pip install 'sphinx<4.4.0' - - name: Clone DFHack - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 - - name: Fetch ccache - uses: actions/cache@v3 - with: - path: ~/.ccache - key: ccache-ubuntu-22.04-gcc-10-${{ github.sha }} - restore-keys: | - ccache-ubuntu-22.04-gcc-10 - - name: Set up environment - id: env_setup - run: | - echo "CCACHE_DIR=${HOME}/.ccache" >> $GITHUB_ENV - - name: Configure DFHack - env: - CC: gcc-10 - CXX: g++-10 - run: | - cmake \ - -S . \ - -B build \ - -G Ninja \ - -DCMAKE_INSTALL_PREFIX=build/output \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DDFHACK_BUILD_ARCH=64 \ - -DBUILD_DOCS:BOOL=1 \ - -DBUILD_STONESENSE:BOOL=1 - - name: Build DFHack - run: | - ninja -C build install - ccache --max-size 50M - ccache --cleanup - ccache --show-stats - - name: Format artifact name - id: artifactname - run: | - echo name=$(date +%Y%m%d)-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: dfhack-linux64-build-${{ steps.artifactname.outputs.name }} - path: build/output/* - package-win64: name: Win64 package (native) runs-on: windows-latest steps: + - run: pip install clcache + - run: pip install 'sphinx<4.4.0' - name: Fetch cache uses: actions/cache@v3 with: - path: "%HOME%/clcache" + path: ~/clcache key: clcache-win64-${{ github.sha }} restore-keys: | clcache-win64 @@ -202,8 +101,6 @@ jobs: with: submodules: true fetch-depth: 0 - - run: pip install clcache - - run: pip install 'sphinx<4.4.0' - name: Configure DFHack run: cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image -DCMAKE_C_COMPILER_LAUNCHER=clcache -DCMAKE_CXX_COMPILER_LAUNCHER=clcache -DBUILD_DOCS:BOOL=1 -DBUILD_STONESENSE:BOOL=1 - name: Build DFHack @@ -257,30 +154,16 @@ jobs: path: build/win64-cross/output/* docs: - runs-on: ubuntu-22.04 - steps: - - name: Set up Python 3 - uses: actions/setup-python@v4 - with: - python-version: 3 - - name: Install dependencies - run: | - pip install 'sphinx' - - name: Clone DFHack - uses: actions/checkout@v3 - with: - submodules: true - - name: Build docs - run: | - sphinx-build -W --keep-going -j auto --color . docs/html + uses: ./.github/workflows/build-linux.yml + with: + platform-files: false + common-files: false + docs: true + secrets: inherit lint: runs-on: ubuntu-22.04 steps: - - name: Set up Python 3 - uses: actions/setup-python@v4 - with: - python-version: 3 - name: Install Lua run: | sudo apt-get update @@ -289,22 +172,17 @@ jobs: uses: actions/checkout@v3 with: submodules: true - # don't need tags here - name: Check whitespace - run: | - python ci/lint.py --git-only --github-actions + run: python ci/lint.py --git-only --github-actions - name: Check Authors.rst - if: success() || failure() - run: | - python ci/authors-rst.py + if: always() + run: python ci/authors-rst.py - name: Check for missing documentation - if: success() || failure() - run: | - python ci/script-docs.py + if: always() + run: python ci/script-docs.py - name: Check Lua syntax - if: success() || failure() - run: | - python ci/script-syntax.py --ext=lua --cmd="luac5.3 -p" --github-actions + if: always() + run: python ci/script-syntax.py --ext=lua --cmd="luac5.3 -p" --github-actions check-pr: runs-on: ubuntu-latest From 0b2877a538db5572514a7f3fa4331098f32958dc Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 30 Jul 2023 19:53:46 -0700 Subject: [PATCH 06/21] fixups --- .github/workflows/build-linux.yml | 11 +++++++---- .github/workflows/build.yml | 4 ++-- CMakeLists.txt | 30 ++++++++++++++++-------------- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 51c933ef1..034cfc989 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -22,7 +22,7 @@ on: default: false stonesense: type: boolean - default: true + default: false extras: type: boolean default: false @@ -32,7 +32,7 @@ on: jobs: build-linux64: - name: Linux package + name: Build linux64 runs-on: ubuntu-22.04 steps: - name: Install basic build dependencies @@ -78,6 +78,8 @@ jobs: -G Ninja \ -DCMAKE_INSTALL_PREFIX=build/image \ -DCMAKE_BUILD_TYPE=Release \ + ${{ inputs.platform-files && '-DCMAKE_C_COMPILER_LAUNCHER=ccache' || '' }} \ + ${{ inputs.platform-files && '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache' || '' }} \ -DBUILD_LIBRARY:BOOL=${{ inputs.platform-files }} \ -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files }} \ -DBUILD_STONESENSE:BOOL=${{ inputs.platform-files }} \ @@ -90,6 +92,7 @@ jobs: - name: Build DFHack run: ninja -C build install - name: Run cpp tests + if: inputs.platform-files run: ninja -C build test - name: Trim cache if: inputs.platform-files @@ -98,7 +101,7 @@ jobs: ccache --cleanup ccache --show-stats - name: Format artifact name - if: ${{ inputs.append-date-and-hash }} + if: inputs.append-date-and-hash id: artifactname run: | echo name=${{ inputs.artifact-name }}-$(date +%Y%m%d)-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT @@ -106,5 +109,5 @@ jobs: if: inputs.artifact-name uses: actions/upload-artifact@v3 with: - name: ${{ inputs.append-date-and-hash && inputs.artifact-name || steps.artifactname.outputs.name}} + name: ${{ inputs.append-date-and-hash && steps.artifactname.outputs.name || inputs.artifact-name }} path: build/image/* diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 73038b649..a2567132a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,8 +7,8 @@ jobs: name: Build (Linux ${{ matrix.type }}, GCC ${{ matrix.gcc }}) uses: ./.github/workflows/build-linux.yml with: - artifact-name: ${{ matrix.artifact-name != 0 && matrix.artifact-name || format('{0}-gcc-{1}', matrix.type, matrix.gcc) }} - append-date-and-hash: ${{ matrix.append-date-and-hash }} + artifact-name: ${{ matrix.artifact-name || format('{0}-gcc-{1}', matrix.type, matrix.gcc) }} + append-date-and-hash: ${{ matrix.append-date-and-hash && true || false }} cache-id: ${{ matrix.type }} stonesense: ${{ matrix.stonesense }} docs: ${{ matrix.type == 'release' }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 2451b768a..b15cbf962 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -289,20 +289,22 @@ endif() find_package(ZLIB REQUIRED) include_directories(${ZLIB_INCLUDE_DIRS}) -# Download SDL release and extract into depends in the build dir -# all we need are the header files (including generated headers), so the same release package -# will work for all platforms -# (the above statement is untested for OSX) -set(SDL_VERSION 2.26.2) -set(SDL_ZIP_MD5 574daf26d48de753d0b1e19823c9d8bb) -set(SDL_ZIP_FILE SDL2-devel-${SDL_VERSION}-VC.zip) -set(SDL_ZIP_PATH ${dfhack_SOURCE_DIR}/depends/SDL2/) -download_file("https://github.com/libsdl-org/SDL/releases/download/release-${SDL_VERSION}/${SDL_ZIP_FILE}" - ${SDL_ZIP_PATH}${SDL_ZIP_FILE} - ${SDL_ZIP_MD5}) -file(ARCHIVE_EXTRACT INPUT ${SDL_ZIP_PATH}${SDL_ZIP_FILE} - DESTINATION ${SDL_ZIP_PATH}) -include_directories(${SDL_ZIP_PATH}/SDL2-${SDL_VERSION}/include) +if(BUILD_LIBRARY) + # Download SDL release and extract into depends in the build dir + # all we need are the header files (including generated headers), so the same release package + # will work for all platforms + # (the above statement is untested for OSX) + set(SDL_VERSION 2.26.2) + set(SDL_ZIP_MD5 574daf26d48de753d0b1e19823c9d8bb) + set(SDL_ZIP_FILE SDL2-devel-${SDL_VERSION}-VC.zip) + set(SDL_ZIP_PATH ${dfhack_SOURCE_DIR}/depends/SDL2/) + download_file("https://github.com/libsdl-org/SDL/releases/download/release-${SDL_VERSION}/${SDL_ZIP_FILE}" + ${SDL_ZIP_PATH}${SDL_ZIP_FILE} + ${SDL_ZIP_MD5}) + file(ARCHIVE_EXTRACT INPUT ${SDL_ZIP_PATH}${SDL_ZIP_FILE} + DESTINATION ${SDL_ZIP_PATH}) + include_directories(${SDL_ZIP_PATH}/SDL2-${SDL_VERSION}/include) +endif() if(APPLE) # libstdc++ (GCC 4.8.5 for OS X 10.6) From 872720740aaccebf01a8452d23cc606566341204 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 30 Jul 2023 20:47:59 -0700 Subject: [PATCH 07/21] attempt to get windows build reusable --- .github/workflows/build-linux.yml | 3 +- .github/workflows/build-windows.yml | 65 +++++++++++++++++++++++++++++ .github/workflows/build.yml | 2 +- 3 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build-windows.yml diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 034cfc989..4e070e9f0 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -71,6 +71,7 @@ jobs: env: CC: gcc-${{ inputs.gcc-ver }} CXX: g++-${{ inputs.gcc-ver }} + CCACHE_DIR: ${{ env.HOME }}/.ccache run: | cmake \ -S . \ @@ -82,7 +83,7 @@ jobs: ${{ inputs.platform-files && '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache' || '' }} \ -DBUILD_LIBRARY:BOOL=${{ inputs.platform-files }} \ -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files }} \ - -DBUILD_STONESENSE:BOOL=${{ inputs.platform-files }} \ + -DBUILD_STONESENSE:BOOL=${{ inputs.stonesense }} \ -DBUILD_DEV_PLUGINS:BOOL=${{ inputs.extras }} \ -DBUILD_SIZECHECK:BOOL=${{ inputs.extras }} \ -DBUILD_SKELETON:BOOL=${{ inputs.extras }} \ diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 000000000..d6a5371b0 --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,65 @@ +name: build-windows + +on: + workflow_call: + inputs: + artifact-name: + type: string + append-date-and-hash: + type: boolean + default: false + cache-id: + type: string + default: '' + platform-files: + type: boolean + default: true + common-files: + type: boolean + default: true + +jobs: + build-win64: + name: Build win64 + runs-on: windows-latest + steps: + - run: pip install clcache + if: inputs.platform-files + - run: pip install 'sphinx<4.4.0' + if: inputs.common-files + - name: Clone DFHack + uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: ${{ !inputs.platform-files && 1 || 0 }} + - name: Fetch clcache + if: inputs.platform-files + uses: actions/cache@v3 + with: + path: ${{ env.HOME }}/clcache + key: win-msvc-${{ inputs.cache-id }}-${{ github.sha }} + restore-keys: | + win-msvc-${{ inputs.cache-id }} + win-msvc + - name: Configure DFHack + env: + CLCACHE_DIR: ${{ env.HOME }}/clcache + run: cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image ${{ inputs.platform-files && '-DCMAKE_C_COMPILER_LAUNCHER=clcache' || '' }} ${{ inputs.platform-files && '-DCMAKE_CXX_COMPILER_LAUNCHER=clcache' || '' }} -DBUILD_LIBRARY:BOOL=${{ inputs.platform-files }} -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files }} -DBUILD_STONESENSE:BOOL=${{ inputs.platform-files }} -DBUILD_DOCS:BOOL=${{ inputs.common-files }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} + - name: Build DFHack + run: cmake --build build -j 2 --config Release --target install + - name: Trim cache + if: inputs.platform-files + run: | + clcache -M 52428800 + clcache -c + clcache -s + - name: Format artifact name + if: inputs.append-date-and-hash + id: artifactname + run: echo "name=${{ inputs.artifact-name }}-$(date +%Y%m%d)-$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" + - name: Upload artifact + if: inputs.artifact-name + uses: actions/upload-artifact@v3 + with: + name: ${{ inputs.append-date-and-hash && steps.artifactname.outputs.name || inputs.artifact-name }} + path: build/image/* diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a2567132a..1c9f4b13f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: build-linux: - name: Build (Linux ${{ matrix.type }}, GCC ${{ matrix.gcc }}) + name: Linux ${{ matrix.type }}, GCC ${{ matrix.gcc }} uses: ./.github/workflows/build-linux.yml with: artifact-name: ${{ matrix.artifact-name || format('{0}-gcc-{1}', matrix.type, matrix.gcc) }} From 2bb972ff7734817aef77b8d52ac285d91489a9d4 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 30 Jul 2023 20:52:07 -0700 Subject: [PATCH 08/21] fix home ref --- .github/workflows/build-linux.yml | 2 +- .github/workflows/build-windows.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 4e070e9f0..7d389f1e7 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -71,7 +71,7 @@ jobs: env: CC: gcc-${{ inputs.gcc-ver }} CXX: g++-${{ inputs.gcc-ver }} - CCACHE_DIR: ${{ env.HOME }}/.ccache + CCACHE_DIR: ${{ github.env.HOME }}/.ccache run: | cmake \ -S . \ diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index d6a5371b0..34268fc17 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -36,14 +36,14 @@ jobs: if: inputs.platform-files uses: actions/cache@v3 with: - path: ${{ env.HOME }}/clcache + path: ${{ github.env.HOME }}/clcache key: win-msvc-${{ inputs.cache-id }}-${{ github.sha }} restore-keys: | win-msvc-${{ inputs.cache-id }} win-msvc - name: Configure DFHack env: - CLCACHE_DIR: ${{ env.HOME }}/clcache + CLCACHE_DIR: ${{ github.env.HOME }}/clcache run: cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image ${{ inputs.platform-files && '-DCMAKE_C_COMPILER_LAUNCHER=clcache' || '' }} ${{ inputs.platform-files && '-DCMAKE_CXX_COMPILER_LAUNCHER=clcache' || '' }} -DBUILD_LIBRARY:BOOL=${{ inputs.platform-files }} -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files }} -DBUILD_STONESENSE:BOOL=${{ inputs.platform-files }} -DBUILD_DOCS:BOOL=${{ inputs.common-files }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} - name: Build DFHack run: cmake --build build -j 2 --config Release --target install From 0364557533c984b7c85785ca5d75fe5f16c1e182 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 30 Jul 2023 21:04:52 -0700 Subject: [PATCH 09/21] actually use the new windows workflow --- .github/workflows/build-linux.yml | 5 ++--- .github/workflows/build.yml | 34 ++++++------------------------- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 7d389f1e7..a32c4b474 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -62,7 +62,7 @@ jobs: if: inputs.platform-files uses: actions/cache@v3 with: - path: ~/.ccache + path: ~/.cache/ccache key: linux-gcc-${{ inputs.gcc-ver }}-${{ inputs.cache-id }}-${{ github.sha }} restore-keys: | linux-gcc-${{ inputs.gcc-ver }}-${{ inputs.cache-id }} @@ -71,7 +71,6 @@ jobs: env: CC: gcc-${{ inputs.gcc-ver }} CXX: g++-${{ inputs.gcc-ver }} - CCACHE_DIR: ${{ github.env.HOME }}/.ccache run: | cmake \ -S . \ @@ -100,7 +99,7 @@ jobs: run: | ccache --max-size 50M ccache --cleanup - ccache --show-stats + ccache --show-stats --verbose - name: Format artifact name if: inputs.append-date-and-hash id: artifactname diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1c9f4b13f..6bae140a5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -85,34 +85,12 @@ jobs: package-win64: name: Win64 package (native) - runs-on: windows-latest - steps: - - run: pip install clcache - - run: pip install 'sphinx<4.4.0' - - name: Fetch cache - uses: actions/cache@v3 - with: - path: ~/clcache - key: clcache-win64-${{ github.sha }} - restore-keys: | - clcache-win64 - - name: Clone DFHack - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 - - name: Configure DFHack - run: cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image -DCMAKE_C_COMPILER_LAUNCHER=clcache -DCMAKE_CXX_COMPILER_LAUNCHER=clcache -DBUILD_DOCS:BOOL=1 -DBUILD_STONESENSE:BOOL=1 - - name: Build DFHack - run: cmake --build build -j 2 --config Release --target install - - name: Format artifact name - uses: benjlevesque/short-sha@v2.2 - id: short-sha - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: dfhack-win64-build-${{ steps.short-sha.outputs.sha }} - path: build/image/* + uses: ./.github/workflows/build-windows.yml + with: + artifact-name: dfhack-win64 + append-date-and-hash: true + cache-id: msvc + secrets: inherit build-cross-win64: name: Win64 package From a0fae55c9031a1fe46a714d1358bf51f7e141575 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 30 Jul 2023 21:39:39 -0700 Subject: [PATCH 10/21] fix windows clcache path --- .github/workflows/build-windows.yml | 14 ++++++-------- .github/workflows/build.yml | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 34268fc17..281ca4f5f 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -27,23 +27,21 @@ jobs: if: inputs.platform-files - run: pip install 'sphinx<4.4.0' if: inputs.common-files - - name: Clone DFHack - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: ${{ !inputs.platform-files && 1 || 0 }} - name: Fetch clcache if: inputs.platform-files uses: actions/cache@v3 with: - path: ${{ github.env.HOME }}/clcache + path: clcache key: win-msvc-${{ inputs.cache-id }}-${{ github.sha }} restore-keys: | win-msvc-${{ inputs.cache-id }} win-msvc + - name: Clone DFHack + uses: actions/checkout@v3 + with: + submodules: true + fetch-depth: ${{ !inputs.platform-files && 1 || 0 }} - name: Configure DFHack - env: - CLCACHE_DIR: ${{ github.env.HOME }}/clcache run: cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image ${{ inputs.platform-files && '-DCMAKE_C_COMPILER_LAUNCHER=clcache' || '' }} ${{ inputs.platform-files && '-DCMAKE_CXX_COMPILER_LAUNCHER=clcache' || '' }} -DBUILD_LIBRARY:BOOL=${{ inputs.platform-files }} -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files }} -DBUILD_STONESENSE:BOOL=${{ inputs.platform-files }} -DBUILD_DOCS:BOOL=${{ inputs.common-files }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} - name: Build DFHack run: cmake --build build -j 2 --config Release --target install diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6bae140a5..e744ed190 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,7 +50,7 @@ jobs: - name: Download artifact uses: actions/download-artifact@v3 with: - name: test-${{ matrix.gcc }} + name: test-gcc-${{ matrix.gcc }} # - name: Fetch DF cache # uses: actions/cache@v3 # with: From b6ececed2d61d954f59ea1d222530fda35498ed0 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 30 Jul 2023 23:50:47 -0700 Subject: [PATCH 11/21] another clcache attempt --- .github/workflows/build-windows.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 281ca4f5f..27c5b28a0 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -11,9 +11,6 @@ on: cache-id: type: string default: '' - platform-files: - type: boolean - default: true common-files: type: boolean default: true @@ -24,11 +21,9 @@ jobs: runs-on: windows-latest steps: - run: pip install clcache - if: inputs.platform-files - run: pip install 'sphinx<4.4.0' if: inputs.common-files - name: Fetch clcache - if: inputs.platform-files uses: actions/cache@v3 with: path: clcache @@ -40,13 +35,15 @@ jobs: uses: actions/checkout@v3 with: submodules: true - fetch-depth: ${{ !inputs.platform-files && 1 || 0 }} + fetch-depth: 0 - name: Configure DFHack - run: cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image ${{ inputs.platform-files && '-DCMAKE_C_COMPILER_LAUNCHER=clcache' || '' }} ${{ inputs.platform-files && '-DCMAKE_CXX_COMPILER_LAUNCHER=clcache' || '' }} -DBUILD_LIBRARY:BOOL=${{ inputs.platform-files }} -DBUILD_PLUGINS:BOOL=${{ inputs.platform-files }} -DBUILD_STONESENSE:BOOL=${{ inputs.platform-files }} -DBUILD_DOCS:BOOL=${{ inputs.common-files }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} + env: + CC: clcache + CXX: clcache + run: cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image -DBUILD_STONESENSE:BOOL=1 -DBUILD_DOCS:BOOL=${{ inputs.common-files }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} - name: Build DFHack run: cmake --build build -j 2 --config Release --target install - name: Trim cache - if: inputs.platform-files run: | clcache -M 52428800 clcache -c From 1fad6d76f11aa1ca710fd724e285535d95e9cc88 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 31 Jul 2023 00:05:47 -0700 Subject: [PATCH 12/21] split linux package out to simplify matrix --- .github/workflows/build.yml | 52 ++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e744ed190..7ff1b08c2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,35 +4,23 @@ on: [push, pull_request] jobs: build-linux: - name: Linux ${{ matrix.type }}, GCC ${{ matrix.gcc }} + name: Linux gcc-${{ matrix.gcc }} uses: ./.github/workflows/build-linux.yml with: - artifact-name: ${{ matrix.artifact-name || format('{0}-gcc-{1}', matrix.type, matrix.gcc) }} - append-date-and-hash: ${{ matrix.append-date-and-hash && true || false }} - cache-id: ${{ matrix.type }} - stonesense: ${{ matrix.stonesense }} - docs: ${{ matrix.type == 'release' }} - extras: ${{ matrix.extras }} + artifact-name: test-gcc-${{ matrix.gcc }} + cache-id: test + stonesense: ${{ matrix.plugins == 'all' }} + extras: ${{ matrix.plugins == 'all' }} gcc-ver: ${{ matrix.gcc }} secrets: inherit strategy: fail-fast: false matrix: include: - - type: release - gcc: "10" - artifact-name: dfhack-linux64 - append-date-and-hash: true - stonesense: true - extras: false - - type: test - gcc: "10" - stonesense: false - extras: false - - type: test - gcc: "12" - stonesense: true - extras: true + - gcc: 10 + plugins: "default" + - gcc: 12 + plugins: "all" test-linux: name: Test (Linux, GCC ${{ matrix.gcc }}, ${{ matrix.plugins }} plugins) @@ -41,11 +29,11 @@ jobs: strategy: fail-fast: false matrix: - gcc: [10] - plugins: [default] include: - - gcc: 12 - plugins: all + - gcc: 10 + plugins: "default" + - gcc: 12 + plugins: "all" steps: - name: Download artifact uses: actions/download-artifact@v3 @@ -83,6 +71,18 @@ jobs: # run: | # rm -rf "$DF_FOLDER" + package-linux: + name: Linux package + uses: ./.github/workflows/build-linux.yml + with: + artifact-name: dfhack-linux64 + append-date-and-hash: true + cache-id: release + stonesense: true + docs: true + gcc-ver: "10" + secrets: inherit + package-win64: name: Win64 package (native) uses: ./.github/workflows/build-windows.yml @@ -140,7 +140,7 @@ jobs: secrets: inherit lint: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Install Lua run: | From 5c664fca1cd9712488e5be2b9cca5d79a0155dcb Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 31 Jul 2023 01:49:02 -0700 Subject: [PATCH 13/21] reuse workflows for steam --- .github/workflows/build-linux.yml | 4 + .github/workflows/build-windows.yml | 57 ++++++---- .github/workflows/build.yml | 45 +------- .github/workflows/steam.yml | 164 +++++++++------------------- 4 files changed, 94 insertions(+), 176 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index a32c4b474..77906bbd4 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -3,6 +3,9 @@ name: build-linux on: workflow_call: inputs: + ref: + type: string + default: '' artifact-name: type: string append-date-and-hash: @@ -56,6 +59,7 @@ jobs: - name: Clone DFHack uses: actions/checkout@v3 with: + ref: ${{ inputs.ref }} submodules: true fetch-depth: ${{ !inputs.platform-files && 1 || 0 }} - name: Fetch ccache diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 27c5b28a0..b5a96b12d 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -3,6 +3,9 @@ name: build-windows on: workflow_call: inputs: + ref: + type: string + default: '' artifact-name: type: string append-date-and-hash: @@ -14,40 +17,52 @@ on: common-files: type: boolean default: true + launchdf: + type: boolean + default: false jobs: build-win64: name: Build win64 - runs-on: windows-latest + runs-on: ubuntu-22.04 steps: - - run: pip install clcache - - run: pip install 'sphinx<4.4.0' - if: inputs.common-files - - name: Fetch clcache + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install ccache + - name: Clone DFHack + uses: actions/checkout@v3 + with: + ref: ${{ inputs.ref }} + submodules: true + fetch-depth: 0 + - name: Get 3rd party SDKs + if: inputs.launchdf + uses: actions/checkout@v3 + with: + repository: DFHack/3rdparty + ref: main + ssh-key: ${{ secrets.DFHACK_3RDPARTY_TOKEN }} + path: depends/steam + - name: Fetch ccache uses: actions/cache@v3 with: - path: clcache + path: build/win64-cross/ccache key: win-msvc-${{ inputs.cache-id }}-${{ github.sha }} restore-keys: | win-msvc-${{ inputs.cache-id }} win-msvc - - name: Clone DFHack - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 - - name: Configure DFHack + - name: Cross-compile env: - CC: clcache - CXX: clcache - run: cmake -S . -B build -G "Visual Studio 17 2022" -DCMAKE_INSTALL_PREFIX=build/image -DBUILD_STONESENSE:BOOL=1 -DBUILD_DOCS:BOOL=${{ inputs.common-files }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} - - name: Build DFHack - run: cmake --build build -j 2 --config Release --target install + CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1 -DBUILD_DOCS:BOOL=${{ inputs.common-files }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }}' + run: | + cd build + bash -x build-win64-from-linux.sh - name: Trim cache run: | - clcache -M 52428800 - clcache -c - clcache -s + ccache -d win64-cross/ccache --max-size 50M + ccache -d win64-cross/ccache --cleanup + ccache -d win64-cross/ccache --show-stats --verbose - name: Format artifact name if: inputs.append-date-and-hash id: artifactname @@ -57,4 +72,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: ${{ inputs.append-date-and-hash && steps.artifactname.outputs.name || inputs.artifact-name }} - path: build/image/* + path: build/win64-cross/output/* diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ff1b08c2..648fd3838 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,7 +75,7 @@ jobs: name: Linux package uses: ./.github/workflows/build-linux.yml with: - artifact-name: dfhack-linux64 + artifact-name: dfhack-linux64-build append-date-and-hash: true cache-id: release stonesense: true @@ -84,53 +84,14 @@ jobs: secrets: inherit package-win64: - name: Win64 package (native) + name: Win64 package uses: ./.github/workflows/build-windows.yml with: - artifact-name: dfhack-win64 + artifact-name: dfhack-win64-build append-date-and-hash: true cache-id: msvc secrets: inherit - build-cross-win64: - name: Win64 package - runs-on: ubuntu-22.04 - steps: - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install ccache - - 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.sha }} - restore-keys: | - ccache-win64-cross-msvc - - name: Cross-compile win64 - env: - CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1' - run: | - cd build - bash -x build-win64-from-linux.sh - ccache -d win64-cross/ccache --max-size 200M - ccache -d win64-cross/ccache --cleanup - ccache -d win64-cross/ccache --show-stats - - name: Format artifact name - id: artifactname - run: | - echo name=$(date +%Y%m%d)-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: dfhack-win64-build-${{ steps.artifactname.outputs.name }} - path: build/win64-cross/output/* - docs: uses: ./.github/workflows/build-linux.yml with: diff --git a/.github/workflows/steam.yml b/.github/workflows/steam.yml index d57fa00ac..6d4533ee9 100644 --- a/.github/workflows/steam.yml +++ b/.github/workflows/steam.yml @@ -13,127 +13,65 @@ on: type: string required: true release_channel: - description: Release channel + description: Steam release channel type: string required: true default: staging jobs: + depot-common: + name: Common depot files + uses: ./.github/workflows/build-linux.yml + with: + artifact-name: common-depot + ref: ${{ github.event.inputs.ref }} + platform-files: false + docs: true + stonesense: true + secrets: inherit + + depot-linux: + name: Linux depot files + uses: ./.github/workflows/build-linux.yml + with: + artifact-name: linux64-depot + ref: ${{ github.event.inputs.ref }} + cache-id: depot + common-files: false + stonesense: true + gcc-ver: "10" + secrets: inherit + + depot-win64: + name: Windows depot files + uses: ./.github/workflows/build-windows.yml + with: + artifact-name: win64-depot + ref: ${{ github.event.inputs.ref }} + cache-id: msvc + common-files: false + launchdf: true + secrets: inherit + deploy-to-steam: name: Deploy to Steam - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - - name: Set up Python 3 - uses: actions/setup-python@v4 - with: - python-version: 3 - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install \ - ccache \ - gcc-10 \ - g++-10 \ - libgl-dev \ - libxml-libxslt-perl \ - ninja-build - pip install 'sphinx<4.4.0' - - name: Clone DFHack - uses: actions/checkout@v3 - with: - submodules: true - fetch-depth: 0 - ref: ${{ github.event.inputs.ref }} - - name: Get 3rd party SDKs - uses: actions/checkout@v3 + - name: Stage common depot files + uses: actions/download-artifact@v3 with: - repository: DFHack/3rdparty - ref: main - ssh-key: ${{ secrets.DFHACK_3RDPARTY_TOKEN }} - path: depends/steam - - name: Fetch linux64 ccache - uses: actions/cache@v3 + name: common-depot + path: common + - name: Stage linux64 depot files + uses: actions/download-artifact@v3 with: - path: ~/.ccache - key: ccache-ubuntu-22.04-gcc-10-${{ github.sha }} - restore-keys: | - ccache-ubuntu-22.04-gcc-10 - - name: Fetch win64 ccache - uses: actions/cache@v3 + name: linux64-depot + path: linux64 + - name: Stage win64 depot files + uses: actions/download-artifact@v3 with: - path: build/win64-cross/ccache - key: ccache-win64-cross-msvc-${{ github.sha }} - restore-keys: | - ccache-win64-cross-msvc - - name: Set up environment - id: env_setup - run: | - echo "CCACHE_DIR=${HOME}/.ccache" >> $GITHUB_ENV - - name: Configure DFHack (common files) - env: - CC: gcc-10 - CXX: g++-10 - run: | - cmake \ - -S . \ - -B build \ - -G Ninja \ - -DCMAKE_INSTALL_PREFIX=build/common-output \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DDFHACK_BUILD_ARCH=64 \ - -DBUILD_DOCS:BOOL=1 \ - -DBUILD_LIBRARY:BOOL=0 \ - -DBUILD_PLUGINS:BOOL=0 \ - -DBUILD_STONESENSE:BOOL=1 \ - -DINSTALL_DATA_FILES:BOOL=1 \ - -DINSTALL_SCRIPTS:BOOL=1 - - name: Build DFHack (common files) - run: | - ninja -C build install - - name: Configure DFHack (linux build) - env: - CC: gcc-10 - CXX: g++-10 - run: | - cmake \ - -S . \ - -B build \ - -G Ninja \ - -DCMAKE_INSTALL_PREFIX=build/linux-output \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_C_COMPILER_LAUNCHER=ccache \ - -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ - -DDFHACK_BUILD_ARCH=64 \ - -DBUILD_DOCS:BOOL=0 \ - -DBUILD_LIBRARY:BOOL=1 \ - -DBUILD_PLUGINS:BOOL=1 \ - -DBUILD_STONESENSE:BOOL=1 \ - -DINSTALL_DATA_FILES:BOOL=0 \ - -DINSTALL_SCRIPTS:BOOL=0 - - name: Build DFHack (linux build) - run: | - ninja -C build install - ccache --max-size 50M - ccache --cleanup - ccache --show-stats - - name: Cross-compile win64 artifacts - env: - CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1 -DBUILD_DFLAUNCH:BOOL=1 -DBUILD_DOCS:BOOL=0 -DINSTALL_DATA_FILES:BOOL=0 -DINSTALL_SCRIPTS:BOOL=0' - steam_username: ${{ secrets.STEAM_SDK_USERNAME }} - steam_password: ${{ secrets.STEAM_SDK_PASSWORD }} - run: | - echo "ref: ${{ github.event.inputs.ref }}" - echo "sha: ${{ github.sha }}" - echo "version: ${{ github.event.inputs.version }}" - echo "release_channel: ${{ github.event.inputs.release_channel }}" - echo - cd build - bash -x build-win64-from-linux.sh - ccache -d win64-cross/ccache --max-size 200M - ccache -d win64-cross/ccache --cleanup - ccache -d win64-cross/ccache --show-stats + name: win64-depot + path: win64 - name: Steam deploy uses: game-ci/steam-deploy@v3 with: @@ -142,7 +80,7 @@ jobs: appId: 2346660 buildDescription: ${{ github.event.inputs.version }} rootPath: build - depot1Path: common-output - depot2Path: win64-cross/output - depot3Path: linux-output + depot1Path: common + depot2Path: win64 + depot3Path: linux64 releaseBranch: ${{ github.event.inputs.release_channel }} From 737ff8b3abf0f04c50f693e1142c713e0ae35ac7 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 31 Jul 2023 02:50:32 -0700 Subject: [PATCH 14/21] more cache tuning --- .github/workflows/build-linux.yml | 13 +++++++++++-- .github/workflows/build-windows.yml | 13 +++++++++++-- .github/workflows/build.yml | 2 +- .github/workflows/steam.yml | 6 ++++-- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 77906bbd4..b504403ee 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -14,6 +14,9 @@ on: cache-id: type: string default: '' + cache-readonly: + type: boolean + default: false platform-files: type: boolean default: true @@ -64,7 +67,7 @@ jobs: fetch-depth: ${{ !inputs.platform-files && 1 || 0 }} - name: Fetch ccache if: inputs.platform-files - uses: actions/cache@v3 + uses: actions/cache/restore@v3 with: path: ~/.cache/ccache key: linux-gcc-${{ inputs.gcc-ver }}-${{ inputs.cache-id }}-${{ github.sha }} @@ -101,9 +104,15 @@ jobs: - name: Trim cache if: inputs.platform-files run: | - ccache --max-size 50M + ccache --max-size 40M ccache --cleanup ccache --show-stats --verbose + - name: Save ccache + if: inputs.platform-files && !inputs.cache-readonly + uses: actions/cache/save@v3 + with: + path: ~/.cache/ccache + key: linux-gcc-${{ inputs.gcc-ver }}-${{ inputs.cache-id }}-${{ github.sha }} - name: Format artifact name if: inputs.append-date-and-hash id: artifactname diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index b5a96b12d..8fe4502e4 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -14,6 +14,9 @@ on: cache-id: type: string default: '' + cache-readonly: + type: boolean + default: false common-files: type: boolean default: true @@ -45,7 +48,7 @@ jobs: ssh-key: ${{ secrets.DFHACK_3RDPARTY_TOKEN }} path: depends/steam - name: Fetch ccache - uses: actions/cache@v3 + uses: actions/cache/restore@v3 with: path: build/win64-cross/ccache key: win-msvc-${{ inputs.cache-id }}-${{ github.sha }} @@ -60,9 +63,15 @@ jobs: bash -x build-win64-from-linux.sh - name: Trim cache run: | - ccache -d win64-cross/ccache --max-size 50M + cd build + ccache -d win64-cross/ccache --max-size 200M ccache -d win64-cross/ccache --cleanup ccache -d win64-cross/ccache --show-stats --verbose + - name: Save ccache + uses: actions/cache/save@v3 + with: + path: build/win64-cross/ccache + key: win-msvc-${{ inputs.cache-id }}-${{ github.sha }} - name: Format artifact name if: inputs.append-date-and-hash id: artifactname diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 648fd3838..f6116b3c9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -89,7 +89,7 @@ jobs: with: artifact-name: dfhack-win64-build append-date-and-hash: true - cache-id: msvc + cache-id: release secrets: inherit docs: diff --git a/.github/workflows/steam.yml b/.github/workflows/steam.yml index 6d4533ee9..1801ad33f 100644 --- a/.github/workflows/steam.yml +++ b/.github/workflows/steam.yml @@ -36,7 +36,8 @@ jobs: with: artifact-name: linux64-depot ref: ${{ github.event.inputs.ref }} - cache-id: depot + cache-id: release + cache-readonly: true common-files: false stonesense: true gcc-ver: "10" @@ -48,7 +49,8 @@ jobs: with: artifact-name: win64-depot ref: ${{ github.event.inputs.ref }} - cache-id: msvc + cache-id: release + cache-readonly: true common-files: false launchdf: true secrets: inherit From a509bb5e61d4a37a063a2d4488ec09b0c90590cf Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 31 Jul 2023 03:01:11 -0700 Subject: [PATCH 15/21] always build launchdf --- .github/workflows/build-windows.yml | 6 +----- .github/workflows/steam.yml | 1 - 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 8fe4502e4..e1076b161 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -20,9 +20,6 @@ on: common-files: type: boolean default: true - launchdf: - type: boolean - default: false jobs: build-win64: @@ -40,7 +37,6 @@ jobs: submodules: true fetch-depth: 0 - name: Get 3rd party SDKs - if: inputs.launchdf uses: actions/checkout@v3 with: repository: DFHack/3rdparty @@ -57,7 +53,7 @@ jobs: win-msvc - name: Cross-compile env: - CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1 -DBUILD_DOCS:BOOL=${{ inputs.common-files }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }}' + CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1 -DBUILD_DOCS:BOOL=${{ inputs.common-files }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=1' run: | cd build bash -x build-win64-from-linux.sh diff --git a/.github/workflows/steam.yml b/.github/workflows/steam.yml index 1801ad33f..cbf311c7d 100644 --- a/.github/workflows/steam.yml +++ b/.github/workflows/steam.yml @@ -52,7 +52,6 @@ jobs: cache-id: release cache-readonly: true common-files: false - launchdf: true secrets: inherit deploy-to-steam: From 52a478d1d74fe2a454aa33e2996437953132ff77 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 31 Jul 2023 03:03:25 -0700 Subject: [PATCH 16/21] rename steam workflow file --- .github/workflows/{steam.yml => steam-deploy.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{steam.yml => steam-deploy.yml} (100%) diff --git a/.github/workflows/steam.yml b/.github/workflows/steam-deploy.yml similarity index 100% rename from .github/workflows/steam.yml rename to .github/workflows/steam-deploy.yml From bbe7dbb0b8698395e34c0103f3917c8e7ba7154f Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 31 Jul 2023 03:56:11 -0700 Subject: [PATCH 17/21] build with gcc 10 by default --- .github/workflows/build-linux.yml | 2 +- .github/workflows/build.yml | 3 +- .github/workflows/clean-cache.yml | 1 + .github/workflows/steam-deploy.yml | 77 ++++++++++++++++-------------- 4 files changed, 43 insertions(+), 40 deletions(-) diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index b504403ee..b6c4e5aa5 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -34,7 +34,7 @@ on: default: false gcc-ver: type: string - default: "11" + default: "10" jobs: build-linux64: diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f6116b3c9..e10894696 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,7 +25,7 @@ jobs: test-linux: name: Test (Linux, GCC ${{ matrix.gcc }}, ${{ matrix.plugins }} plugins) needs: build-linux - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: fail-fast: false matrix: @@ -80,7 +80,6 @@ jobs: cache-id: release stonesense: true docs: true - gcc-ver: "10" secrets: inherit package-win64: diff --git a/.github/workflows/clean-cache.yml b/.github/workflows/clean-cache.yml index d3e12959d..0a4bddf64 100644 --- a/.github/workflows/clean-cache.yml +++ b/.github/workflows/clean-cache.yml @@ -1,4 +1,5 @@ name: Clean up PR caches + on: pull_request_target: types: diff --git a/.github/workflows/steam-deploy.yml b/.github/workflows/steam-deploy.yml index cbf311c7d..006c05ec1 100644 --- a/.github/workflows/steam-deploy.yml +++ b/.github/workflows/steam-deploy.yml @@ -30,58 +30,61 @@ jobs: stonesense: true secrets: inherit - depot-linux: - name: Linux depot files - uses: ./.github/workflows/build-linux.yml + depot-win64: + name: Windows depot files + uses: ./.github/workflows/build-windows.yml with: - artifact-name: linux64-depot + artifact-name: win64-depot ref: ${{ github.event.inputs.ref }} cache-id: release cache-readonly: true common-files: false - stonesense: true - gcc-ver: "10" secrets: inherit - depot-win64: - name: Windows depot files - uses: ./.github/workflows/build-windows.yml + depot-linux64: + name: Linux depot files + uses: ./.github/workflows/build-linux.yml with: - artifact-name: win64-depot + artifact-name: linux64-depot ref: ${{ github.event.inputs.ref }} cache-id: release cache-readonly: true common-files: false + stonesense: true secrets: inherit deploy-to-steam: name: Deploy to Steam + needs: + - depot-common + - depot-win64 + - depot-linux64 runs-on: ubuntu-latest steps: - - name: Stage common depot files - uses: actions/download-artifact@v3 - with: - name: common-depot - path: common - - name: Stage linux64 depot files - uses: actions/download-artifact@v3 - with: - name: linux64-depot - path: linux64 - - name: Stage win64 depot files - uses: actions/download-artifact@v3 - with: - name: win64-depot - path: win64 - - name: Steam deploy - uses: game-ci/steam-deploy@v3 - with: - username: ${{ secrets.STEAM_USERNAME }} - configVdf: ${{ secrets.STEAM_CONFIG_VDF}} - appId: 2346660 - buildDescription: ${{ github.event.inputs.version }} - rootPath: build - depot1Path: common - depot2Path: win64 - depot3Path: linux64 - releaseBranch: ${{ github.event.inputs.release_channel }} + - name: Stage common depot files + uses: actions/download-artifact@v3 + with: + name: common-depot + path: common + - name: Stage win64 depot files + uses: actions/download-artifact@v3 + with: + name: win64-depot + path: win64 + - name: Stage linux64 depot files + uses: actions/download-artifact@v3 + with: + name: linux64-depot + path: linux64 + - name: Steam deploy + uses: game-ci/steam-deploy@v3 + with: + username: ${{ secrets.STEAM_USERNAME }} + configVdf: ${{ secrets.STEAM_CONFIG_VDF}} + appId: 2346660 + buildDescription: ${{ github.event.inputs.version }} + rootPath: build + depot1Path: common + depot2Path: win64 + depot3Path: linux64 + releaseBranch: ${{ github.event.inputs.release_channel }} From e3a8009717c90b26927fbabd8441baf448560625 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 31 Jul 2023 03:56:26 -0700 Subject: [PATCH 18/21] initial draft of automated github release --- .github/release_template.md | 65 ++++++++++++++++++++++ .github/workflows/github-release.yml | 83 ++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+) create mode 100644 .github/release_template.md create mode 100644 .github/workflows/github-release.yml diff --git a/.github/release_template.md b/.github/release_template.md new file mode 100644 index 000000000..a47628b3c --- /dev/null +++ b/.github/release_template.md @@ -0,0 +1,65 @@ +#### Q: How do I download DFHack? +**A:** Either add to your Steam library from our [Steam page](https://store.steampowered.com/app/2346660/DFHack) or scroll to the latest release on our [GitHub releases page](https://github.com/DFHack/dfhack/releases), expand the "Assets" list, and download the file for your platform (e.g. `dfhack-XX.XX-rX-Windows-64bit.zip`. + +------------- + +This release is compatible with all distributions of Dwarf Fortress: [Steam](https://store.steampowered.com/app/975370/Dwarf_Fortress/), [Itch](https://kitfoxgames.itch.io/dwarf-fortress), and [Classic](https://www.bay12games.com/dwarves/). + +- [Install DFHack from Steam](https://store.steampowered.com/app/2346660/DFHack) +- [Manual install](https://docs.dfhack.org/en/stable/docs/Installing.html#installing) +- [Quickstart guide (for players)](https://docs.dfhack.org/en/stable/docs/Quickstart.html#quickstart) +- [Modding guide (for modders)](https://docs.dfhack.org/en/stable/docs/guides/modding-guide.html) + +Please report any issues (or feature requests) on the DFHack [GitHub issue tracker](https://github.com/DFHack/dfhack/issues). When reporting issues, please upload a zip file of your savegame and a zip file of your `mods` directory to the cloud and add links to the GitHub issue. Make sure your files are downloadable by "everyone with the link". We need your savegame to reproduce the problem and test the fix, and we need your active mods so we can load your savegame. Issues with savegames and mods attached get fixed first! + +Announcements +---------------------------------- + +
+Annc 1, PSAs + +### Annc 1 + + + +### PSAs + +As always, remember that, just like the vanilla DF game, DFHack tools can also have bugs. It is a good idea to **save often and keep backups** of the forts that you care about. + +Many DFHack tools that worked in previous (pre-Steam) versions of DF have not been updated yet and are marked with the "unavailable" tag in their docs. If you try to run them, they will show a warning and exit immediately. You can run the command again to override the warning (though of course the tools may not work). We make no guarantees of reliability for the tools that are marked as "unavailable". + +The in-game interface for running DFHack commands (`gui/launcher`) will not show "unavailable" tools by default. You can still run them if you know their names, or you can turn on dev mode by hitting Ctrl-D while in `gui/launcher` and they will be added to the autocomplete list. Some tools do not compile yet and are not available at all, even when in dev mode. + +If you see a tool complaining about the lack of a cursor, know that it's referring to the **keyboard** cursor (which used to be the only real option in Dwarf Fortress). You can enable the keyboard cursor by entering mining mode or selecting the dump/forbid tool and hitting Alt-K (the DFHack keybinding for `toggle-kbd-cursor`. We're working on making DFHack tools more mouse-aware and accessible so this step isn't necessary in the future. + +
+ +Highlights +---------------------------------- + +
+Highlight 1, Highlight 2 + +### Highlight 1 + +Demo screenshot/vidcap + +Text + +### Highlight 2 + +Demo screenshot/vidcap + +Text + +
+ +Generated release notes +==================== + +
+ New tools, fixes, and improvements + +RELEASE NOTES HERE + +
diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml new file mode 100644 index 000000000..e37960ef1 --- /dev/null +++ b/.github/workflows/github-release.yml @@ -0,0 +1,83 @@ +name: Releases + +on: + push: + tags: + - '*-r[0-9]+' + workflow_dispatch: + inputs: + tag: + description: tag + required: true + +jobs: + package-win64: + name: Windows release + uses: ./.github/workflows/build-windows.yml + with: + artifact-name: win64-release + ref: ${{ github.event.inputs.tag }} + cache-id: release + cache-readonly: true + stonesense: true + docs: true + secrets: inherit + + package-linux64: + name: Linux release + uses: ./.github/workflows/build-linux.yml + with: + artifact-name: linux64-release + ref: ${{ github.event.inputs.tag }} + cache-id: release + cache-readonly: true + stonesense: true + docs: true + secrets: inherit + + create-update-release: + name: GitHub release + needs: + - package-win64 + - package-linux64 + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Clone DFHack + uses: actions/checkout@v3 + with: + ref: ${{ github.event.inputs.tag }} + - name: Stage win64 release + uses: actions/download-artifact@v3 + with: + name: win64-release + path: win64 + - name: Create win64 release archive + run: | + cd win64 + zip -r ../dfhack-${{ github.event.inputs.tag }}-Windows-64bit.zip . + - name: Stage linux64 release + uses: actions/download-artifact@v3 + with: + name: linux64-release + path: linux64 + - name: Create linux64 release archive + run: | + cd linux64 + tar cjf ../dfhack-${{ github.event.inputs.tag }}-Linux-64bit.tar.bz2 . + - name: Create or update GitHub release + uses: ncipollo/release-action@v1 + with: + artifacts: "dfhack-*" + bodyFile: ".github/release_template.md" + allowUpdates: true + artifactErrorsFailBuild: true + draft: true + name: "DFHack ${{ github.event.inputs.tag }}" + omitBodyDuringUpdate: true + omitDraftDuringUpdate: true + omitNameDuringUpdate: true + omitPrereleaseDuringUpdate: true + replacesArtifacts: true + tag: ${{ github.event.inputs.tag }} From cf0b87fbc463b0c5f65b4b16dc8134d991598a7f Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 31 Jul 2023 04:02:12 -0700 Subject: [PATCH 19/21] Revert "always build launchdf" This reverts commit a509bb5e61d4a37a063a2d4488ec09b0c90590cf. --- .github/workflows/build-windows.yml | 6 +++++- .github/workflows/steam-deploy.yml | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index e1076b161..8fe4502e4 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -20,6 +20,9 @@ on: common-files: type: boolean default: true + launchdf: + type: boolean + default: false jobs: build-win64: @@ -37,6 +40,7 @@ jobs: submodules: true fetch-depth: 0 - name: Get 3rd party SDKs + if: inputs.launchdf uses: actions/checkout@v3 with: repository: DFHack/3rdparty @@ -53,7 +57,7 @@ jobs: win-msvc - name: Cross-compile env: - CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1 -DBUILD_DOCS:BOOL=${{ inputs.common-files }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=1' + CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1 -DBUILD_DOCS:BOOL=${{ inputs.common-files }} -DINSTALL_DATA_FILES:BOOL=${{ inputs.common-files }} -DINSTALL_SCRIPTS:BOOL=${{ inputs.common-files }} -DBUILD_DFLAUNCH:BOOL=${{ inputs.launchdf }}' run: | cd build bash -x build-win64-from-linux.sh diff --git a/.github/workflows/steam-deploy.yml b/.github/workflows/steam-deploy.yml index 006c05ec1..ef1433212 100644 --- a/.github/workflows/steam-deploy.yml +++ b/.github/workflows/steam-deploy.yml @@ -39,6 +39,7 @@ jobs: cache-id: release cache-readonly: true common-files: false + launchdf: true secrets: inherit depot-linux64: From 97ea3f3d671bf5f0374733b37a5069cc06f1cc17 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 31 Jul 2023 04:43:43 -0700 Subject: [PATCH 20/21] generate release notes changelog text --- .github/release_template.md | 6 +++--- .github/workflows/github-release.yml | 12 +++++++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/release_template.md b/.github/release_template.md index a47628b3c..eb1c43146 100644 --- a/.github/release_template.md +++ b/.github/release_template.md @@ -20,7 +20,7 @@ Announcements ### Annc 1 - +Text ### PSAs @@ -58,8 +58,8 @@ Generated release notes ====================
- New tools, fixes, and improvements +New tools, fixes, and improvements -RELEASE NOTES HERE +%RELEASE_NOTES%
diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index e37960ef1..3adec790a 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -48,6 +48,16 @@ jobs: uses: actions/checkout@v3 with: ref: ${{ github.event.inputs.tag }} + submodules: true + - name: Generate release text + run: | + python docs/gen_changelog.py -a + TOKEN_LINE=$(grep -Fhne '%RELEASE_NOTES%' .github/release_template.md | sed 's/:.*//') + head -n $((TOKEN_LINE - 1)) .github/release_template.md > release_body.md + CHANGELOG_LINES=$(wc -l > release_body.md + tail -n 2 .github/release_template.md >> release_body.md + cat release_body.md - name: Stage win64 release uses: actions/download-artifact@v3 with: @@ -70,7 +80,7 @@ jobs: uses: ncipollo/release-action@v1 with: artifacts: "dfhack-*" - bodyFile: ".github/release_template.md" + bodyFile: "release_body.md" allowUpdates: true artifactErrorsFailBuild: true draft: true From 9b59fc6440ab82a120c90764ce6f3b5ae175dab5 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 31 Jul 2023 04:51:44 -0700 Subject: [PATCH 21/21] use the actual tag of the checkout --- .github/workflows/github-release.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/github-release.yml b/.github/workflows/github-release.yml index 3adec790a..6a4110710 100644 --- a/.github/workflows/github-release.yml +++ b/.github/workflows/github-release.yml @@ -21,6 +21,7 @@ jobs: cache-readonly: true stonesense: true docs: true + launchdf: true secrets: inherit package-linux64: @@ -49,13 +50,16 @@ jobs: with: ref: ${{ github.event.inputs.tag }} submodules: true + - name: Get tag + id: gettag + run: echo name=$(git describe --tags --abbrev=0 --exact-match) >> $GITHUB_OUTPUT - name: Generate release text run: | python docs/gen_changelog.py -a TOKEN_LINE=$(grep -Fhne '%RELEASE_NOTES%' .github/release_template.md | sed 's/:.*//') head -n $((TOKEN_LINE - 1)) .github/release_template.md > release_body.md - CHANGELOG_LINES=$(wc -l > release_body.md + CHANGELOG_LINES=$(wc -l > release_body.md tail -n 2 .github/release_template.md >> release_body.md cat release_body.md - name: Stage win64 release @@ -66,7 +70,7 @@ jobs: - name: Create win64 release archive run: | cd win64 - zip -r ../dfhack-${{ github.event.inputs.tag }}-Windows-64bit.zip . + zip -r ../dfhack-${{ steps.gettag.outputs.name }}-Windows-64bit.zip . - name: Stage linux64 release uses: actions/download-artifact@v3 with: @@ -75,7 +79,7 @@ jobs: - name: Create linux64 release archive run: | cd linux64 - tar cjf ../dfhack-${{ github.event.inputs.tag }}-Linux-64bit.tar.bz2 . + tar cjf ../dfhack-${{ steps.gettag.outputs.name }}-Linux-64bit.tar.bz2 . - name: Create or update GitHub release uses: ncipollo/release-action@v1 with: @@ -84,10 +88,10 @@ jobs: allowUpdates: true artifactErrorsFailBuild: true draft: true - name: "DFHack ${{ github.event.inputs.tag }}" + name: "DFHack ${{ steps.gettag.outputs.name }}" omitBodyDuringUpdate: true omitDraftDuringUpdate: true omitNameDuringUpdate: true omitPrereleaseDuringUpdate: true replacesArtifacts: true - tag: ${{ github.event.inputs.tag }} + tag: ${{ steps.gettag.outputs.name }}