the vcpkg bump #211
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: | |
push: | |
paths-ignore: | |
- 'schemas/**.json' | |
- 'staging/cfg/**.json' | |
- '*.md' | |
- '*.appinstaller_template' | |
env: | |
VCPKG_ROOT: ${{ github.workspace }}/submodules/vcpkg | |
VCPKG_BINARY_SOURCES: 'clear;nuget,GitHub,readwrite' | |
VCPKG_FEATURE_FLAGS: manifests,binarycaching,registries | |
VCPKG_CACHE_VERSION: 9 | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
config: | |
runs-on: windows-latest | |
outputs: | |
tf2bd_version: ${{ steps.tf2bd_version.outputs.value }} | |
tf2bd_workspace: ${{ steps.tf2bd_paths.outputs.workspace }} | |
tf2bd_build_dir: ${{ steps.tf2bd_paths.outputs.build_dir }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Extract TF2BD_VERSION | |
id: tf2bd_version | |
run: | | |
mkdir build_dir | |
cd build_dir | |
cmake -DCMAKE_TOOLCHAIN_FILE="" ../ || true # we know this will fail, we just need version info from CMakeCache.txt | |
TF2BD_VERSION_NOBUILD=`cat CMakeCache.txt | grep TF2BD_VERSION_NOBUILD: | cut -d "=" -f2` | |
echo "value=$TF2BD_VERSION_NOBUILD.${{ github.run_number }}" >> $GITHUB_OUTPUT | |
- name: Debug | |
run: | | |
echo "github.event_name = ${{ github.event_name }}" | |
echo "github.sha = ${{ github.sha }}" | |
echo "github.ref = ${{ github.ref }}" | |
echo "github.run_id = ${{ github.run_id }}" | |
echo "github.run_number = ${{ github.run_number }}" | |
- name: Config cross-platform paths | |
id: tf2bd_paths | |
run: | | |
tf2bd_workspace=`realpath "${{ github.workspace }}"` | |
echo "workspace=$tf2bd_workspace" >> $GITHUB_OUTPUT | |
echo "build_dir=$tf2bd_workspace/tf2bd_cmake_build_dir/" >> $GITHUB_OUTPUT | |
build: | |
needs: config | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest] | |
triplet: [x86-windows, x64-windows] | |
discord_integration: [true] | |
# discord_integration: [true, false] | |
build_type: [Debug, Release] | |
include: | |
- os: windows-latest | |
triplet: x86-windows | |
tf2bd_arch: x86 | |
- os: windows-latest | |
triplet: x64-windows | |
tf2bd_arch: x64 | |
steps: | |
- name: Determine artifact behavior | |
id: determine_artifact_behavior | |
if: matrix.discord_integration == true | |
run: echo "upload=1" >> $GITHUB_OUTPUT | |
- name: Debug | |
run: | | |
echo "matrix.os = ${{ matrix.os }}" | |
echo "matrix.triplet = ${{ matrix.triplet }}" | |
echo "matrix.discord_integration = ${{ matrix.discord_integration }}" | |
echo "matrix.tf2bd_arch = ${{ matrix.tf2bd_arch }}" | |
echo "matrix.build_type = ${{ matrix.build_type }}" | |
echo "steps.determine_artifact_behavior.outputs.upload = ${{ steps.determine_artifact_behavior.outputs.upload }}" | |
echo "needs.config.outputs.tf2bd_version = ${{ needs.config.outputs.tf2bd_version }}" | |
echo "needs.config.outputs.tf2bd_workspace = ${{ needs.config.outputs.tf2bd_workspace }}" | |
echo "needs.config.outputs.tf2bd_build_dir = ${{ needs.config.outputs.tf2bd_build_dir }}" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: true | |
- name: Setup NuGet Credentials | |
run: > | |
nuget sources add | |
-source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" | |
-storepasswordincleartext | |
-name "GitHub" | |
-username "${{ github.repository_owner }}" | |
-password "${{ secrets.GITHUB_TOKEN }}" | |
- uses: seanmiddleditch/gha-setup-ninja@v4 | |
- name: Configure build tools | |
uses: ilammy/[email protected] | |
with: | |
arch: ${{ matrix.tf2bd_arch }} | |
# we're technically getting cmake twice | |
# should be fine right | |
- uses: lukka/get-cmake@latest | |
- name: Create Build Folder | |
run: | | |
mkdir "${{needs.config.outputs.tf2bd_build_dir}}" | |
- name: Configure Build | |
working-directory: ${{needs.config.outputs.tf2bd_build_dir}} | |
run: | | |
cmake -G Ninja \ | |
-DTF2BD_IS_CI_COMPILE=ON \ | |
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \ | |
-DCMAKE_TOOLCHAIN_FILE="${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake" \ | |
-DCMAKE_RUNTIME_OUTPUT_DIRECTORY="${{ needs.config.outputs.tf2bd_build_dir }}" \ | |
-DTF2BD_ENABLE_DISCORD_INTEGRATION=${{ matrix.discord_integration }} \ | |
-DTF2BD_VERSION_BUILD=${{ github.run_number }} \ | |
../ | |
- name: Build tf2bd | |
working-directory: ${{needs.config.outputs.tf2bd_build_dir}} | |
if: ${{ startsWith(matrix.os, 'windows') }} | |
run: | | |
cmake --build . --config ${{matrix.build_type}} | |
- name: "Artifacts: Fresh, signed exe" | |
if: steps.determine_artifact_behavior.outputs.upload && startsWith(matrix.os, 'windows') | |
uses: actions/upload-artifact@v2 | |
with: | |
name: "smartscreen_${{ matrix.triplet }}_${{ needs.config.outputs.tf2bd_version }}_${{ matrix.build_type }}" | |
if-no-files-found: error | |
path: "${{ needs.config.outputs.tf2bd_build_dir }}/*.exe" | |
- name: "Artifacts: Prepare staging/" | |
if: steps.determine_artifact_behavior.outputs.upload && startsWith(matrix.os, 'windows') | |
run: | | |
echo "Copying build artifacts to staging..." | |
cp -v ${{ needs.config.outputs.tf2bd_build_dir }}/*.exe ${{ needs.config.outputs.tf2bd_build_dir }}/*.dll ${{ needs.config.outputs.tf2bd_workspace }}/staging/ | |
echo "Performing smartscreen workaround..." | |
echo "Hash of current exe: " | |
sha1sum "${{ needs.config.outputs.tf2bd_workspace }}/staging/tf2_bot_detector.exe" | |
cp -v "${{ needs.config.outputs.tf2bd_workspace }}/smartscreen/${{ matrix.tf2bd_arch }}/tf2_bot_detector.exe" "${{ needs.config.outputs.tf2bd_workspace }}/staging/tf2_bot_detector.exe" | |
echo "Hash of cached exe: " | |
sha1sum "${{ needs.config.outputs.tf2bd_workspace }}/staging/tf2_bot_detector.exe" | |
- name: "Artifacts: Upload staging/" | |
if: steps.determine_artifact_behavior.outputs.upload && startsWith(matrix.os, 'windows') | |
uses: actions/upload-artifact@v2 | |
with: | |
name: "tf2-bot-detector_${{ matrix.os }}_${{ matrix.triplet }}_${{ needs.config.outputs.tf2bd_version }}_${{ matrix.build_type }}" | |
if-no-files-found: error | |
path: ${{ needs.config.outputs.tf2bd_workspace }}/staging/ | |
- name: "Artifacts: symbols" | |
if: steps.determine_artifact_behavior.outputs.upload && startsWith(matrix.os, 'windows') | |
uses: actions/upload-artifact@v2 | |
with: | |
name: "tf2-bot-detector-symbols_${{ matrix.triplet }}_${{ needs.config.outputs.tf2bd_version }}_${{ matrix.build_type }}" | |
if-no-files-found: error | |
path: "${{ needs.config.outputs.tf2bd_build_dir }}/**.pdb" |