-
Notifications
You must be signed in to change notification settings - Fork 9
148 lines (146 loc) · 5.46 KB
/
test_and_build.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
148
name: PugSharp_test_and_build
on:
push:
branches:
- main
- develop
tags: [ v**]
paths:
- '**'
- '!README.md'
- '!Makefile'
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- develop
- 'feature/**'
tags: [ v**]
paths:
- '**'
- '!README.md'
- '!Makefile'
jobs:
# test_linux_x64:
# runs-on: ubuntu-latest
# if: ${{ !startsWith( github.event.pull_request.head.label, 'lan2play-weblate' ) }}
# steps:
# - name : machine echo github
# env : { CONTENT : "${{ toJson(github) }}" }
# run : "echo $CONTENT"
# - name: Set up JDK 11
# uses: actions/setup-java@v3
# with:
# distribution: 'temurin'
# java-version: '11'
# - name: Setup .NET
# uses: actions/setup-dotnet@v3
# with:
# dotnet-version: 7.0
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
# - name: Cache SonarCloud packages
# uses: actions/cache@v3
# with:
# path: ./sonar/cache
# key: ${{ runner.os }}-sonar
# restore-keys: ${{ runner.os }}-sonar
# - name: Cache SonarCloud scanner
# id: cache-sonar-scanner
# uses: actions/cache@v3
# with:
# path: ./sonar/scanner
# key: ${{ runner.os }}-sonar-scanner
# restore-keys: ${{ runner.os }}-sonar-scanner
# - name: Install SonarCloud scanner
# if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
# shell: pwsh
# run: |
# New-Item -Path ./sonar/scanner -ItemType Directory
# dotnet tool install dotnet-sonarscanner --tool-path ./sonar/scanner
# - name: Update SonarCloud scanner
# if: steps.cache-sonar-scanner.outputs.cache-hit != 'false'
# shell: pwsh
# run: |
# dotnet tool update dotnet-sonarscanner --tool-path ./sonar/scanner
# - name: Restore dependencies
# run: dotnet restore
# - name: start sonarscanner
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.PUGSHARP_SONAR_TOKEN }}
# run: ./sonar/scanner/dotnet-sonarscanner begin /k:"Lan2Play_PugSharp" /o:"lan2play" /d:sonar.login="${{ secrets.PUGSHARP_SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.opencover.reportsPaths="./**/*.opencover.xml"
# - name: dotnet build
# run: dotnet build --no-restore
# - name: dotnet test
# run: dotnet test --no-build --no-restore --collect "XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
# - name: stop sonarscanner
# if: always()
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# SONAR_TOKEN: ${{ secrets.PUGSHARP_SONAR_TOKEN }}
# run: ./sonar/scanner/dotnet-sonarscanner end /d:sonar.login="${{ secrets.PUGSHARP_SONAR_TOKEN }}"
build_linux_x64:
runs-on: ubuntu-latest
# if: ${{ !startsWith( github.event.pull_request.head.label, 'lan2play-weblate' ) }}
# needs:
# - test_linux_x64
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: set Version
if: ${{ (startsWith(github.ref, 'refs/tags/v')) }}
run: echo "PUGSHARPNETVER=$(echo ${GITHUB_REF} | sed 's|refs/heads/||g' | sed 's|refs/tags/v||g' | sed 's|-beta||g' )" >> $GITHUB_ENV
- name: set Version
if: ${{ !(startsWith(github.ref, 'refs/tags/v')) }}
run: echo "PUGSHARPNETVER=0.0.1" >> $GITHUB_ENV
- name: Build Pugsharp
run: dotnet publish
- name: cleanup build
run: rm -rf PugSharp/bin/Debug/net7.0/publish/CounterStrikeSharp.API.dll
- name: prepare package structure
run: mkdir -p packagebuild/addons/counterstrikesharp/plugins/PugSharp
- name: copy package content
run: cp -rf PugSharp/bin/Debug/net7.0/publish/* packagebuild/addons/counterstrikesharp/plugins/PugSharp
- name: build package
run: zip -r PugSharp_$PUGSHARPNETVER.zip packagebuild/addons
- name: ls
run: ls -la
- name: find
run: find .
- name: replace version variable in meta files
run: sed -i "s|%%VERSION%%|$PUGSHARPNETVER|g" ./release.json;
- name: replace CounterStrikeSharpVersion variable in meta files
run: sed -i "s|%%COUNTERSTRIKESHARPVERSION%%|0.0.1|g" ./release.json;
- name: replace CS2VERSION variable in meta files
run: sed -i "s|%%CS2VERSION%%|1.39.6.5/13965 9842|g" ./release.json;
- name: Release
if: ${{ (startsWith(github.ref, 'refs/tags/v')) && !(contains(github.ref, '-beta')) }}
uses: softprops/action-gh-release@v1
with:
files: |
./release.json
./PugSharp_*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: pre Release
if: ${{ (startsWith(github.ref, 'refs/tags/v')) && (contains(github.ref, '-beta')) }}
uses: softprops/action-gh-release@v1
with:
prerelease: true
files: |
./release.json
./PugSharp_*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: upload pre - pre release
uses: actions/upload-artifact@v3
with:
name: latest_pre_pre
path: |
./release.json
./PugSharp_*.zip
retention-days: 10