Skip to content

Commit 4a7c4c9

Browse files
committed
ci: 🎉 add CI workflow for automated build and testing
1 parent 3acaf78 commit 4a7c4c9

1 file changed

Lines changed: 75 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
env:
14+
DOTNET_NOLOGO: true
15+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
16+
DOTNET_CLI_TELEMETRY_OPTOUT: true
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
timeout-minutes: 30
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Verify Steam credentials
27+
shell: bash
28+
run: |
29+
if [ -z "${{ secrets.STEAMUSER }}" ]; then
30+
echo '::error::Missing secrets.STEAMUSER. Add the Steam username used for SteamCMD downloads.'
31+
exit 1
32+
fi
33+
if [ -z "${{ secrets.STEAMPASS }}" ]; then
34+
echo '::error::Missing secrets.STEAMPASS. Add the Steam password used for SteamCMD downloads.'
35+
exit 1
36+
fi
37+
38+
- name: Setup Resonite environment
39+
id: resonite
40+
uses: resonite-modding-group/setup-resonite-env-action@v0.1.0
41+
with:
42+
steam-user: ${{ secrets.STEAMUSER }}
43+
steam-password: ${{ secrets.STEAMPASS }}
44+
45+
- name: Cache NuGet packages
46+
uses: actions/cache@v4
47+
with:
48+
path: ~/.nuget/packages
49+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json', '**/*.csproj') }}
50+
restore-keys: |
51+
${{ runner.os }}-nuget-
52+
53+
- name: Restore
54+
shell: bash
55+
run: |
56+
dotnet restore ReferenceReplacement.sln \
57+
-p:ResoniteAssembliesDir="${{ steps.resonite.outputs.resonite-path }}"
58+
59+
- name: Verify formatting
60+
shell: bash
61+
run: |
62+
dotnet format ReferenceReplacement.sln --verify-no-changes --no-restore \
63+
-p:ResoniteAssembliesDir="${{ steps.resonite.outputs.resonite-path }}"
64+
65+
- name: Build
66+
shell: bash
67+
run: |
68+
dotnet build ReferenceReplacement.sln --configuration Release --no-restore \
69+
-p:ResoniteAssembliesDir="${{ steps.resonite.outputs.resonite-path }}"
70+
71+
- name: Test
72+
shell: bash
73+
run: |
74+
dotnet test ReferenceReplacement.sln --configuration Release --no-build \
75+
-p:ResoniteAssembliesDir="${{ steps.resonite.outputs.resonite-path }}"

0 commit comments

Comments
 (0)