Skip to content

Commit a6fd967

Browse files
authored
Merge pull request #1 from GlebChili/initial
Initial
2 parents ef7707f + 11e46f6 commit a6fd967

File tree

13 files changed

+1097
-1
lines changed

13 files changed

+1097
-1
lines changed

.github/workflows/ci.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push: {}
6+
release:
7+
types: [published]
8+
9+
10+
env:
11+
DOTNET_SDK_VERSION: '6.0.100-preview.5.21302.13'
12+
GMOD_DOT_NET_VERSION: '0.7.0-beta.2.46713465.main'
13+
14+
jobs:
15+
linux-test:
16+
runs-on: ubuntu-20.04
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/[email protected]
21+
22+
- name: Setup .NET SDK
23+
uses: actions/[email protected]
24+
with:
25+
dotnet-version: ${{ env.DOTNET_SDK_VERSION }}
26+
27+
- name: Download Steam and install garrysmod
28+
run: |
29+
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
30+
tar -xvzf steamcmd_linux.tar.gz
31+
rm -rfv steamcmd_linux.tar.gz
32+
./steamcmd.sh +login anonymous +force_install_dir gmod "+app_update 4020 -beta x86-64 validate" +quit
33+
34+
- name: Publish Test
35+
run: dotnet publish ./Tests/Tests.csproj -c Release -o ./gmod/garrysmod/lua/bin/Modules/Tests
36+
37+
- name: Download GmodDotNet
38+
working-directory: ./gmod/garrysmod/lua/bin/
39+
run: |
40+
wget https://gleb-krasilich.fra1.digitaloceanspaces.com/GmodNETStorage/storage/gmod-dot-net-linux.${{ env.GMOD_DOT_NET_VERSION }}.tar.gz
41+
tar -xvf gmod-dot-net-linux.${{ env.GMOD_DOT_NET_VERSION }}.tar.gz
42+
rm -rfv gmod-dot-net-linux.${{ env.GMOD_DOT_NET_VERSION }}.tar.gz
43+
44+
- name: Copy Lua file
45+
run: cp tests-run.lua ./gmod/garrysmod/lua/autorun
46+
47+
- name: Run Garry's Mod
48+
working-directory: ./gmod/
49+
run: ./srcds_run_x64 -game garrysmod -systemtest -condebug +sv_hibernate_think 1
50+
continue-on-error: true
51+
timeout-minutes: 1
52+
53+
- name: Print console log
54+
working-directory: ./gmod/garrysmod/
55+
run: cat console.log
56+
57+
- name: Check tests success
58+
working-directory: ./gmod/
59+
run: cat test-success.txt
60+
61+
windows-test:
62+
runs-on: windows-latest
63+
64+
steps:
65+
- name: Checkout
66+
uses: actions/[email protected]
67+
68+
- name: Setup .NET SDK
69+
uses: actions/[email protected]
70+
with:
71+
dotnet-version: ${{ env.DOTNET_SDK_VERSION }}
72+
73+
- name: Download Steam and install Garrys Mod
74+
shell: pwsh
75+
run: |
76+
Invoke-WebRequest -Uri https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip -OutFile steamcmd.zip
77+
Expand-Archive -Path steamcmd.zip -DestinationPath .\
78+
./steamcmd.exe +login anonymous +force_install_dir gmod "+app_update 4020 -beta x86-64 validate" +quit || True
79+
80+
- name: Publish Tests
81+
run: dotnet publish ./Tests/Tests.csproj -c Release -o ./gmod/garrysmod/lua/bin/Modules/Tests
82+
83+
- name: Download GmodDotNet
84+
working-directory: ./gmod/garrysmod/lua/bin/
85+
shell: pwsh
86+
run: |
87+
Invoke-WebRequest -Uri https://gleb-krasilich.fra1.digitaloceanspaces.com/GmodNETStorage/storage/gmod-dot-net-windows.${{ env.GMOD_DOT_NET_VERSION }}.zip -OutFile gmodnet.zip
88+
Expand-Archive -Path gmodnet.zip -DestinationPath .\
89+
90+
- name: Copy Lua file
91+
shell: pwsh
92+
run: Copy-Item "tests-run.lua" -Destination "./gmod/garrysmod/lua/autorun"
93+
94+
- name: Run Garry's Mod
95+
working-directory: ./gmod/
96+
shell: pwsh
97+
run: |
98+
./srcds_win64.exe -console -systemtest -condebug -game "garrysmod" +exec "server.cfg" +gamemode sandbox +map gm_construct +maxplayers 16 +sv_hibernate_think 1
99+
Wait-Process -Name srcds_win64
100+
continue-on-error: true
101+
timeout-minutes: 1
102+
103+
- name: Print console log
104+
working-directory: ./gmod/garrysmod/
105+
shell: bash
106+
run: cat console.log
107+
108+
- name: Check tests success
109+
working-directory: ./gmod/
110+
shell: bash
111+
run: cat test-success.txt
112+
113+
deploy:
114+
runs-on: ubuntu-20.04
115+
116+
needs: [linux-test, windows-test]
117+
118+
if: ${{ github.event_name != 'pull_request' && github.repository_owner == 'GmodNET' }}
119+
120+
steps:
121+
- name: Checkout
122+
uses: actions/[email protected]
123+
124+
- name: Install .NET SDK
125+
uses: actions/[email protected]
126+
with:
127+
dotnet-version: ${{ env.DOTNET_SDK_VERSION }}
128+
129+
- name: Create NuGet package
130+
run: dotnet pack ./GmodNET.Serilog.Sink/GmodNET.Serilog.Sink.csproj -c Release -o nupkgs
131+
132+
- name: Upload NuGet package to Azure DevOps
133+
run: |
134+
dotnet nuget update source gmodnet-packages --username CI --password ${{ secrets.DEVOPS_PASSWORD }} --store-password-in-clear-text
135+
dotnet nuget push nupkgs/**.nupkg --source gmodnet-packages --api-key az --skip-duplicate
136+
137+
- name: Upload NuGet package to NuGet.org
138+
if: ${{ github.event_name == 'release' }}
139+
run: dotnet nuget push nupkgs/**.nupkg --source nuget --api-key ${{ secrets.NUGET_API_KEY }} --skip-duplicate

0 commit comments

Comments
 (0)