-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (73 loc) · 2.36 KB
/
ci.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
name: Continuous Integration
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '45 18 * * *'
concurrency:
group: ci
cancel-in-progress: true
env:
SYMBOL_PACKAGE: false
DOTNET_TEST_TFM: net9.0
jobs:
build:
name: Build
env:
build-configuration: Release
runs-on: ubuntu-latest
container:
image: ghcr.io/sliekens/gw2sdk/devcontainer:latest
options: --user 1001
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # (no history limit)
filter: tree:0
- name: Install dependencies
run: dotnet restore --locked-mode
- name: Build
run: dotnet build --configuration ${{ env.build-configuration }} --no-restore
- name: Update test data
run: dotnet run --configuration ${{ env.build-configuration }} --project GW2SDK.TestDataHelper -- GW2SDK.Tests/Data
- name: Test
run: dotnet test --framework $DOTNET_TEST_TFM --collect:"XPlat Code Coverage" --settings coverlet.runsettings --no-restore
env:
ApiKeyBasic: ${{ secrets.API_TOKEN_BASIC }}
ApiKey: ${{ secrets.API_TOKEN_FULL }}
GuildLeader__Token: ${{ secrets.API_TOKEN_GUILD_LEADER }}
- name: Pack artifacts
run: dotnet pack GW2SDK --configuration ${{ env.build-configuration }} --no-build --output artifacts
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: packages
path: artifacts
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Upload test data on failure
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-data
path: GW2SDK.Tests/Data
deploy-to-github-packages:
name: Deploy to GitHub Packages
needs: build
runs-on: ubuntu-latest
environment:
name: github-packages
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: packages
path: artifacts
- name: Upload packages to GitHub Packages
run: dotnet nuget push artifacts/*.nupkg --source https://nuget.pkg.github.com/sliekens/index.json --api-key ${{secrets.GITHUB_TOKEN}} --skip-duplicate