Skip to content

Build on windows 2019 and 2022 #88

Build on windows 2019 and 2022

Build on windows 2019 and 2022 #88

Workflow file for this run

name: Build
on:
- push
- pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite"
VCPKG_REPOSITORY: https://github.com/OpenMW/vcpkg.git
VCPKG_REVISION: dbbbfe8f58195ba49f3141dbba7a4f4b35e92052
jobs:
static:
strategy:
fail-fast: true
matrix:
image:
- windows-2019
- windows-2022
name: static-${{ matrix.image }}
runs-on: ${{ matrix.image }}
steps:
- uses: actions/checkout@v4
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- working-directory: 'C:/vcpkg'
run: git remote add openmw ${{ env.VCPKG_REPOSITORY }}
- working-directory: 'C:/vcpkg'
run: git fetch openmw
- working-directory: 'C:/vcpkg'
run: git checkout ${{ env.VCPKG_REVISION }}
- working-directory: 'C:/vcpkg'
run: ./bootstrap-vcpkg.bat -disableMetrics
- name: Install vcpkg packages
run: >
vcpkg install --triplet x64-windows-static
boost-geometry
boost-iostreams
boost-locale
boost-program-options
bullet3[double-precision,multithreading]
ffmpeg
freetype
icu
luajit
lz4
mygui
openal-soft
openmw-osg
sdl2
- name: Move pdb files
working-directory: 'C:/vcpkg'
run: |
robocopy installed pdb/installed *.pdb /S /MOVE
if ($lastexitcode -lt 8) {
$global:LASTEXITCODE = $null
}
- name: Archive pdb files
working-directory: 'C:/vcpkg/pdb'
run: 7z a "${{ github.workspace }}/vcpkg-x64-${{ matrix.image }}-static-pdb-${{ github.sha }}.7z" installed
- name: Store archived pdb files
uses: actions/upload-artifact@v4
with:
name: vcpkg-x64-${{ matrix.image }}-static-pdb-${{ github.sha }}
path: ${{ github.workspace }}/vcpkg-x64-${{ matrix.image }}-static-pdb-${{ github.sha }}.7z
- name: Export installed vcpkg packages
run: >
vcpkg export
--x-all-installed
--7zip
--output-dir ${{ github.workspace }}
--output vcpkg-x64-${{ matrix.image }}-static-${{ github.sha }}
- name: Store exported vcpkg packages
uses: actions/upload-artifact@v4
with:
name: vcpkg-x64-${{ matrix.image }}-static-${{ github.sha }}
path: ${{ github.workspace }}/vcpkg-x64-${{ matrix.image }}-static-${{ github.sha }}.7z
dynamic:
strategy:
fail-fast: true
matrix:
image:
- windows-2019
- windows-2022
name: dynamic-${{ matrix.image }}
runs-on: ${{ matrix.image }}
steps:
- uses: actions/checkout@v4
- name: Export GitHub Actions cache environment variables
uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '');
- working-directory: 'C:/vcpkg'
run: git remote add openmw ${{ env.VCPKG_REPOSITORY }}
- working-directory: 'C:/vcpkg'
run: git fetch openmw
- working-directory: 'C:/vcpkg'
run: git checkout ${{ env.VCPKG_REVISION }}
- working-directory: 'C:/vcpkg'
run: ./bootstrap-vcpkg.bat -disableMetrics
- name: Install vcpkg packages
run: >
vcpkg install --triplet x64-windows
boost-geometry
boost-iostreams
boost-locale
boost-program-options
bullet3[double-precision,multithreading]
ffmpeg
freetype
icu
luajit
lz4
mygui
openal-soft
openmw-osg
sdl2
- name: Move pdb files
working-directory: 'C:/vcpkg'
run: |
robocopy installed pdb/installed *.pdb /S /MOVE
if ($lastexitcode -lt 8) {
$global:LASTEXITCODE = $null
}
- name: Archive pdb files
working-directory: 'C:/vcpkg/pdb'
run: 7z a "${{ github.workspace }}/vcpkg-x64-${{ matrix.image }}-pdb-${{ github.sha }}.7z" installed
- name: Store archived pdb files
uses: actions/upload-artifact@v4
with:
name: vcpkg-x64-${{ matrix.image }}-pdb-${{ github.sha }}
path: ${{ github.workspace }}/vcpkg-x64-${{ matrix.image }}-pdb-${{ github.sha }}.7z
- name: Export installed vcpkg packages
run: >
vcpkg export
--x-all-installed
--7zip
--output-dir ${{ github.workspace }}
--output vcpkg-x64-${{ matrix.image }}-${{ github.sha }}
- name: Store exported vcpkg packages
uses: actions/upload-artifact@v4
with:
name: vcpkg-x64-${{ matrix.image }}-${{ github.sha }}
path: ${{ github.workspace }}/vcpkg-x64-${{ matrix.image }}-${{ github.sha }}.7z
- name: Setup ssh-agent
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
if: ${{ env.SSH_PRIVATE_KEY != '' }}
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Import GPG key
id: import_gpg
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PRIVATE_KEY_PASSPHRASE: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
if: ${{ env.GPG_PRIVATE_KEY != '' && env.GPG_PRIVATE_KEY_PASSPHRASE != '' }}
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE }}
- name: Configure ssh known hosts for gitlab.com
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
if: ${{ env.SSH_PRIVATE_KEY != '' }}
run: cat gitlab_known_hosts >> ~/.ssh/known_hosts
- name: Configure git user
run: |
git config --global user.email '[email protected]'
git config --global user.name 'openmw-deps-build'
- name: Configure git sign key
if: ${{ steps.import_gpg.outputs.fingerprint != '' }}
run: |
git config --global user.signkey ${{ steps.import_gpg.outputs.fingerprint }}
git config --global commit.gpgsign true
- name: Clone openmw-deps repository via SSH
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
GIT_LFS_SKIP_SMUDGE: 1
# see https://github.com/git-lfs/git-lfs/issues/5749
GIT_CLONE_PROTECTION_ACTIVE: false
if: ${{ env.SSH_PRIVATE_KEY != '' }}
run: git clone [email protected]:OpenMW/openmw-deps.git
- name: Clone openmw-deps repository via HTTPS
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
GIT_LFS_SKIP_SMUDGE: 1
# see https://github.com/git-lfs/git-lfs/issues/5749
GIT_CLONE_PROTECTION_ACTIVE: false
if: ${{ env.SSH_PRIVATE_KEY == '' }}
run: git clone https://gitlab.com/OpenMW/openmw-deps.git
- name: Move exported vcpkg packages to openmw-deps repository
run: mv vcpkg-x64-${{ matrix.image }}-${{ github.sha }}.7z openmw-deps/windows/
- name: Move pdb files archive to openmw-deps repository
run: mv vcpkg-x64-${{ matrix.image }}-pdb-${{ github.sha }}.7z openmw-deps/windows/
- name: Generate commit message
shell: bash
env:
GH_TOKEN: ${{ github.token }}
working-directory: ${{ github.workspace }}/openmw-deps
run: |
echo Add ${{ matrix.image }} vcpkg packages built at ${{ github.sha }} > commit_message.txt
echo >> commit_message.txt
printf 'Generated by ' >> commit_message.txt
url=$(gh run --repo ${{ github.repository }} view ${{ github.run_id }} --json jobs --jq '.jobs[] | select(.name == "dynamic-${{ matrix.image }}") | .url')
echo "${url:?}" >> commit_message.txt
echo >> commit_message.txt
- name: Commit exported vcpkg packages
working-directory: ${{ github.workspace }}/openmw-deps
run: |
git checkout -b vcpkg-x64-${{ matrix.image }}-${{ github.sha }}
git add windows/vcpkg-x64-${{ matrix.image }}-${{ github.sha }}.7z
git add windows/vcpkg-x64-${{ matrix.image }}-pdb-${{ github.sha }}.7z
git commit -F commit_message.txt
- name: Verify commit to openmw-deps repository
if: ${{ steps.import_gpg.outputs.fingerprint != '' }}
working-directory: ${{ github.workspace }}/openmw-deps
run: git verify-commit HEAD
- name: Push exported vcpkg packages to gitlab
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
# Make sure only signed commits are pushed
if: ${{ vars.PUSH_URL != '' && env.SSH_PRIVATE_KEY != '' && steps.import_gpg.outputs.fingerprint != '' }}
working-directory: ${{ github.workspace }}/openmw-deps
run: |
git remote set-url --push origin "${{ vars.PUSH_URL }}"
git push origin vcpkg-x64-${{ matrix.image }}-${{ github.sha }}