Skip to content

Commit 87f49eb

Browse files
author
Luke
authored
More CI Fixes (#100)
1 parent 17872e6 commit 87f49eb

File tree

22 files changed

+203
-218
lines changed

22 files changed

+203
-218
lines changed

.github/actions/build-library-and-upload/action.yml

Lines changed: 64 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,77 @@ inputs:
77
nakama-cpp-path:
88
description: 'Relative path under $GITHUB_WORKSPACE to the nakama-cpp repository'
99
required: true
10-
build_type:
10+
build-type:
1111
description: 'Build config: MinSizeRel or Debug'
1212
required: true
13-
default: 'MinSizeRel'
1413
runs:
1514
using: "composite"
1615
steps:
1716
- id: build
1817
run: |
1918
rm -rf out
2019
cmake --preset ${{ inputs.preset }}
21-
cmake --build ./build/${{ inputs.preset }} --config ${{ inputs.build_type }} --verbose
22-
cmake --install ./build/${{ inputs.preset }} --config ${{ inputs.build_type }}
20+
cmake --build ./build/${{ inputs.preset }} --config ${{ inputs.build-type }} --verbose
21+
cmake --install ./build/${{ inputs.preset }} --config ${{ inputs.build-type }}
2322
working-directory: ${{ inputs.nakama-cpp-path }}
24-
shell: bash
23+
shell: bash
24+
25+
- name: Get folder name (Linux/MacOS)
26+
id: get-folder-name-unix
27+
run: |
28+
path="./out"
29+
for dir in "$path"/*/; do
30+
folder_name=$(basename "$dir")
31+
echo "folder-name=$folder_name" >> $GITHUB_OUTPUT
32+
done
33+
working-directory: ${{ inputs.nakama-cpp-path }}
34+
shell: bash
35+
if: runner.os != 'Windows'
36+
37+
- name: Get folder name (Windows)
38+
id: get-folder-name-windows
39+
run: |
40+
$path = "./out"
41+
Get-ChildItem -Directory "$path" | ForEach-Object {
42+
$folder_name = $_.Name
43+
Write-Output "folder-name=$folder_name" >> $env:GITHUB_OUTPUT
44+
}
45+
working-directory: ${{ inputs.nakama-cpp-path }}
46+
shell: powershell
47+
if: runner.os == 'Windows'
48+
49+
- name: Create zip file (Linux/MacOS)
50+
id: create-zip-unix
51+
run: |
52+
folder_name="${{ steps.get-folder-name-unix.outputs.folder-name }}"
53+
zip -r "./${folder_name}" "./${folder_name}"
54+
echo "artifact-path=${PWD}/${folder_name}.zip" >> $GITHUB_OUTPUT
55+
working-directory: ${{ inputs.nakama-cpp-path }}/out
56+
shell: bash
57+
if: runner.os != 'Windows'
58+
59+
- name: Create zip file (Windows)
60+
id: create-zip-windows
61+
run: |
62+
$folder_name = "${{ steps.get-folder-name-windows.outputs.folder-name }}"
63+
Compress-Archive -Path "./$folder_name" -DestinationPath "./$folder_name.zip"
64+
$artifact_path = Join-Path $PWD "$folder_name.zip"
65+
Write-Output "artifact-path=$artifact_path" >> $env:GITHUB_OUTPUT
66+
working-directory: ${{ inputs.nakama-cpp-path }}/out
67+
shell: powershell
68+
if: runner.os == 'Windows'
69+
70+
- name: Upload artifact
71+
uses: actions/upload-artifact@v3
72+
with:
73+
name: ${{ steps.get-folder-name-unix.outputs.folder-name }}
74+
path: ${{ steps.create-zip-unix.outputs.artifact-path }}
75+
if-no-files-found: error
76+
if: runner.os != 'Windows'
77+
78+
- name: Upload artifact (Windows)
79+
uses: actions/upload-artifact@v3
80+
with:
81+
name: ${{ steps.get-folder-name-windows.outputs.folder-name }}-${{ inputs.build-type }}
82+
path: ${{ steps.create-zip-windows.outputs.artifact-path }}
83+
if: runner.os == 'Windows'

.github/actions/build-test-and-run/action.yml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,41 @@ inputs:
77
nakama-cpp-path:
88
description: 'Relative path under $GITHUB_WORKSPACE to the nakama-cpp repository'
99
required: true
10+
testrunner-pat:
11+
description: 'PAT to access the private Nakama testrunner'
12+
required: true
13+
build-type:
14+
description: The build type.
15+
required: true
16+
native-tool-options:
17+
description: 'Flags to pass to the underlying build system used by the CMake generator.'
18+
required: false
19+
1020
runs:
1121
using: "composite"
1222
steps:
1323
- id: build
1424
run: |
15-
cmake --preset ${{ inputs.preset }} ${{ steps.cmake_args.outputs.args }}
16-
cmake --build ./build/${{ inputs.preset }} --config ${{ inputs.build_type }} --verbose
17-
cmake --install ./build/${{ inputs.preset }} --config ${{ inputs.build_type }}
18-
shell: bash
25+
cmake --preset ${{ inputs.preset }}
26+
cmake --build ./build/${{ inputs.preset }} --config ${{ inputs.build-type }} -- ${{ inputs.native-tool-options }}
27+
cmake --install ./build/${{ inputs.preset }} --config ${{ inputs.build-type }}
1928
working-directory: ${{ inputs.nakama-cpp-path }}/test
20-
- id: setup-postgres
21-
uses: ikalnytskyi/action-setup-postgres@v3
22-
with:
23-
username: root
24-
database: nakama
25-
port: 26257
26-
- uses: ./.github/actions/run-nakama
29+
shell: bash
30+
- name: Checkout nakama-client-testrunner
31+
uses: actions/checkout@v2
2732
with:
28-
postgres_uri: "${{ steps.setup-postgres.outputs.connection-uri }}"
29-
- shell: bash
33+
repository: heroiclabs/nakama-client-testrunner
34+
token: ${{ inputs.testrunner-pat }}
35+
path: nakama-client-testrunner
36+
- name: Start docker containers for nakama-client-testrunner
3037
run: |
38+
docker-compose up -d
39+
working-directory: nakama-client-testrunner
40+
shell: bash
41+
- run: |
3142
./${{ inputs.nakama-cpp-path }}/test/out/${{ inputs.preset }}/nakama-test || {
3243
echo "Test failed, showing Nakama log for diagnostics";
3344
cat /tmp/nakama.log;
3445
exit 1;
35-
}
46+
}
47+
shell: bash

.github/actions/handle-failure/action.yml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,39 @@ inputs:
1010
runs:
1111
using: "composite"
1212
steps:
13-
- run: "zip -r build.zip ./build"
13+
- if: runner.os != 'Windows'
14+
run: |
15+
cd $GITHUB_WORKSPACE/${{ inputs.nakama-cpp-path }}
16+
if [ -d "./build" ]; then
17+
zip -r build ./build
18+
fi
19+
if [ -d "./out" ]; then
20+
zip -r out ./out
21+
fi
22+
cd $GITHUB_WORKSPACE/${{ inputs.vcpkg-path }}
23+
if [ -d "./buildtrees" ]; then
24+
zip -r buildtrees ./buildtrees
25+
fi
1426
shell: bash
15-
working-directory: ${{ inputs.nakama-cpp-path }}
16-
- run: "zip -r buildtrees.zip ./buildtrees"
17-
shell: bash
18-
working-directory: ${{ inputs.vcpkg-path }}
27+
- if: runner.os == 'Windows'
28+
run: |
29+
cd $GITHUB_WORKSPACE/${{ inputs.nakama-cpp-path }}
30+
if (Test-Path -Path './build') {
31+
Compress-Archive -Path ./build -DestinationPath build.zip
32+
}
33+
if (Test-Path -Path './out') {
34+
Compress-Archive -Path ./out -DestinationPath out.zip
35+
}
36+
cd $GITHUB_WORKSPACE/${{ inputs.vcpkg-path }}
37+
if (Test-Path -Path './buildtrees') {
38+
Compress-Archive -Path ./buildtrees -DestinationPath buildtrees.zip
39+
}
40+
shell: powershell
1941
- uses: actions/upload-artifact@v3
2042
with:
2143
name: ${{ steps.build.outputs.artifact_name }}-workdir-debug
2244
path: |
23-
./nakama-cpp/build.zip
24-
./vcpkg/buildtrees.zip
45+
./${{ inputs.nakama-cpp-path }}/build.zip
46+
./${{ inputs.nakama-cpp-path }}/out.zip
47+
./${{ inputs.vcpkg-path }}/buildtrees.zip
2548
retention-days: 1

.github/actions/run-nakama/action.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/build_all.yml

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,3 @@ jobs:
1111
uses: ./.github/workflows/build_osx.yml
1212
build_windows:
1313
uses: ./.github/workflows/build_windows.yml
14-
combine:
15-
needs: [build_android, build_ios, build_linux, build_osx, build_windows]
16-
runs-on: ubuntu-22.04
17-
steps:
18-
- uses: actions/checkout@v3
19-
- name: restore apple's lipo from cache
20-
id: lipo_cache
21-
uses: actions/cache@v3
22-
with:
23-
path: cctools/cctools/misc/lipo
24-
key: lipo-${{ hashFiles('ci/build-lipo.sh') }}
25-
- name: build apple's lipo
26-
if: steps.lipo_cache.outputs.cache-hit != 'true'
27-
run: ./ci/build-lipo.sh
28-
- name: make lipo available on system path
29-
run: echo "$PWD/cctools/cctools/misc" >> $GITHUB_PATH
30-
- uses: actions/download-artifact@v3
31-
with:
32-
path: artifacts7z
33-
34-
- name: Unpack artifacts as if they were plain dir uploads
35-
run: |
36-
for f in artifacts7z/*/*.7z; do
37-
destdir=artifacts/$(basename $(dirname $f))
38-
echo "Unpacking $f to $destdir"
39-
7zr x -o$destdir $f
40-
done
41-
- id: combine
42-
run: /bin/bash -x ./ci/combine-artifacts.sh artifacts
43-
44-
- name: Prepare artifacts archives
45-
run: |
46-
(
47-
cd ./${{ steps.combine.outputs.generic-artifact-dir }}
48-
7zr a ../${{ steps.combine.outputs.generic-artifact-name }}.7z '*'
49-
)
50-
51-
- uses: actions/upload-artifact@v3
52-
with:
53-
name: ${{ steps.combine.outputs.generic-artifact-name }}
54-
path: ./${{ steps.combine.outputs.generic-artifact-dir }}.7z
55-
retention-days: 2
56-

.github/workflows/build_android.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ jobs:
55
timeout-minutes: 30
66
strategy:
77
matrix:
8-
preset: ["android-arm64-v8a-host_osx_x64", "android-x64-host_osx_x64"]
8+
preset: ["android-arm64-v8a-host_linux-x64", "android-x64-host_linux-x64"]
9+
build-type: [MinSizeRel]
910
runs-on: ubuntu-22.04
1011
steps:
1112
- uses: actions/checkout@v3
@@ -20,6 +21,7 @@ jobs:
2021
with:
2122
nakama-cpp-path: nakama-cpp
2223
preset: ${{ matrix.preset }}
24+
build-type: ${{ matrix.build-type }}
2325
- if: failure()
2426
uses: ./nakama-cpp/.github/actions/handle-failure
2527
with:

.github/workflows/build_ios.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,24 @@ jobs:
66
strategy:
77
matrix:
88
preset: ["ios-arm64-host_x64", "iphonesimulator-x64-host_x64"]
9+
build-type: [MinSizeRel]
910
runs-on: macos-12
1011
steps:
1112
- uses: actions/checkout@v3
1213
with:
1314
path: nakama-cpp
15+
- run: |
16+
brew install pkg-config
17+
shell: bash
1418
- uses: ./nakama-cpp/.github/actions/setup-vcpkg
1519
with:
1620
github_token: ${{ secrets.github_token }}
1721
vcpkg-path: vcpkg
18-
- run: ./nakama-cpp/ci/setup-osx.sh
19-
shell: bash
2022
- uses: ./nakama-cpp/.github/actions/build-library-and-upload
2123
with:
2224
nakama-cpp-path: nakama-cpp
2325
preset: ${{ matrix.preset }}
26+
build-type: ${{ matrix.build-type }}
2427
- if: failure()
2528
uses: ./nakama-cpp/.github/actions/handle-failure
2629
with:

.github/workflows/build_linux.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on: [workflow_call, workflow_dispatch]
33
jobs:
44
build_linux:
55
timeout-minutes: 30
6+
strategy:
7+
matrix:
8+
build-type: [MinSizeRel]
69
runs-on: ubuntu-22.04
710
steps:
811
- uses: actions/checkout@v3
@@ -17,6 +20,7 @@ jobs:
1720
with:
1821
nakama-cpp-path: nakama-cpp
1922
preset: linux-amd64
23+
build-type: ${{ matrix.build-type }}
2024
- if: failure()
2125
uses: ./nakama-cpp/.github/actions/handle-failure
2226
with:

.github/workflows/build_osx.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,24 @@ jobs:
66
strategy:
77
matrix:
88
preset: ["macosx-x64-host_x64", "macosx-arm64-host_x64"]
9+
build-type: [MinSizeRel]
910
runs-on: macos-12
1011
steps:
1112
- uses: actions/checkout@v3
1213
with:
1314
path: nakama-cpp
15+
- run: |
16+
brew install pkg-config
17+
shell: bash
1418
- uses: ./nakama-cpp/.github/actions/setup-vcpkg
1519
with:
1620
github_token: ${{ secrets.github_token }}
1721
vcpkg-path: vcpkg
18-
- run: ./nakama-cpp/ci/setup-osx.sh
19-
shell: bash
2022
- uses: ./nakama-cpp/.github/actions/build-library-and-upload
2123
with:
2224
nakama-cpp-path: nakama-cpp
2325
preset: ${{ matrix.preset }}
26+
build-type: ${{ matrix.build-type }}
2427
- if: failure()
2528
uses: ./nakama-cpp/.github/actions/handle-failure
2629
with:

.github/workflows/build_windows.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ jobs:
55
timeout-minutes: 30
66
strategy:
77
matrix:
8-
build_type: [MinSizeRel, Debug]
8+
build-type: [MinSizeRel, Debug]
99
preset: [win-x64, win-x86]
10-
1110
runs-on: windows-latest
1211
steps:
1312
- uses: actions/checkout@v3
@@ -21,7 +20,7 @@ jobs:
2120
with:
2221
nakama-cpp-path: nakama-cpp
2322
preset: ${{ matrix.preset }}
24-
build_type: ${{ matrix.build_type }}
23+
build-type: ${{ matrix.build-type }}
2524
- if: failure()
2625
uses: ./nakama-cpp/.github/actions/handle-failure
2726
with:

0 commit comments

Comments
 (0)