-
Notifications
You must be signed in to change notification settings - Fork 8
160 lines (121 loc) · 4.46 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
name: "Develop"
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CORE_SDK_VERSION: 6.0
on:
push:
branches:
- main
tags:
- v*
paths-ignore:
- '**/*.md'
pull_request:
branches:
- main
paths-ignore:
- '**.md'
jobs:
native-job:
name: "Build native libraries ${{ matrix.platform.rid }}"
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
platform:
- { name: Windows (x64), os: windows-latest, rid: win-x64 }
- { name: Linux (x64), os: ubuntu-latest, rid: linux-x64 }
- { name: macOS (x64+arm64), os: macos-latest, rid: osx }
steps:
- name: "Clone Git repository"
uses: actions/checkout@v3
with:
submodules: 'false'
- name: "Update Git submodules"
shell: bash
run: |
git submodule update --init --recursive
git submodule update --remote --merge ./ext/katabasis-bedrock
- name: "Set variables"
id: vars
shell: bash
run: |
cd ./ext/katabasis-bedrock
HASH="$(git rev-parse HEAD)"
echo "HASH: $HASH"
echo ::set-output name=katabasis_bedrock_hash::$HASH
- name: "Cache native libraries"
id: cache-libs
uses: actions/cache@v3
with:
path: "./ext/katabasis-bedrock/lib"
key: "libs-${{ matrix.platform.rid }}-${{ hashFiles('library.sh') }}-${{ steps.vars.outputs.katabasis_bedrock_hash }}"
- name: "Install Windows dependencies"
if: ${{ steps.cache-libs.outputs.cache-hit != 'true' && runner.os == 'Windows' }}
run: |
choco install ninja
- name: "Install macOS dependencies"
if: ${{ steps.cache-libs.outputs.cache-hit != 'true' && runner.os == 'macOS' }}
run: |
brew install ninja
- name: "Install Linux dependencies"
if: ${{ steps.cache-libs.outputs.cache-hit != 'true' && runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install ninja-build
- name: "Build native libraries"
if: steps.cache-libs.outputs.cache-hit != 'true'
shell: bash
run: ./library.sh
- name: "Upload native libraries"
uses: actions/upload-artifact@v2
with:
name: "native-libraries-${{ matrix.platform.rid }}"
path: './ext/katabasis-bedrock/lib/${{ matrix.platform.rid }}'
dotnet-job:
name: ".NET"
runs-on: ubuntu-latest
needs: [native-job]
steps:
- name: "Checkout Git repository"
uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: "Fetch all history for all tags and branches"
run: git fetch --prune --unshallow
- name: "Install GitVersion"
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'
- name: "Use GitVersion"
id: gitversion
uses: gittools/actions/gitversion/[email protected]
- name: "Download native libraries: win-x64"
uses: actions/download-artifact@v1
with:
name: "native-libraries-win-x64"
path: './ext/katabasis-bedrock/lib/win-x64'
- name: "Download native libraries: osx"
uses: actions/download-artifact@v1
with:
name: "native-libraries-osx"
path: './ext/katabasis-bedrock/lib/osx'
- name: "Download native libraries: linux-x64"
uses: actions/download-artifact@v1
with:
name: "native-libraries-linux-x64"
path: './ext/katabasis-bedrock/lib/linux-x64'
- name: "Build solution"
run: dotnet build --nologo --configuration Release /p:Version='${{ steps.gitversion.outputs.nuGetVersionV2 }}'
- name: "Test solution"
run: dotnet test --nologo --configuration Release --no-build
- name: "Pack solution"
run: dotnet pack --nologo --configuration Release --no-build /p:Version='${{ steps.gitversion.outputs.nuGetVersionV2 }}'
- name: "Upload NuGet packages: MyGet"
shell: bash
if: ${{ github.event_name == 'push' || startsWith(github.ref, 'refs/tags/v') }}
run: dotnet nuget push "${{ github.workspace }}/**/*.nupkg" --source https://www.myget.org/F/bottlenoselabs/api/v3/index.json --skip-duplicate --api-key ${{ secrets.MYGET_ACCESS_TOKEN }}
- name: "Upload NuGet packages: NuGet"
shell: bash
if: "${{ startsWith(github.ref, 'refs/tags/v') }}"
run: dotnet nuget push "${{ github.workspace }}/**/*.nupkg" --source https://api.nuget.org/v3/index.json --skip-duplicate --api-key ${{ secrets.NUGET_ACCESS_TOKEN }}