Skip to content

Commit 8944472

Browse files
authored
Update main.yml
1 parent 3d9d767 commit 8944472

File tree

1 file changed

+68
-70
lines changed

1 file changed

+68
-70
lines changed

.github/workflows/main.yml

Lines changed: 68 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,6 @@ jobs:
7070

7171
verify-template:
7272
if: github.event_name != 'schedule'
73-
env:
74-
BRANCH: ''
75-
VERSION: ''
7673
runs-on: ubuntu-latest
7774
steps:
7875
- name: Checkout repository
@@ -84,10 +81,11 @@ jobs:
8481
with:
8582
setAllVars: true
8683

84+
- uses: nelonoel/[email protected]
8785
- name: Setting VERSION and BRANCH env
8886
run: |
89-
echo "::set-env name=VERSION::$NBGV_NuGetPackageVersion"
90-
echo "::set-env name=BRANCH::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')"
87+
echo "VERSION=$NBGV_NuGetPackageVersion" >> $GITHUB_ENV
88+
echo "BRANCH=$BRANCH_NAME" >> $GITHUB_ENV
9189
9290
- name: Update tokens in project files
9391
uses: cschleiden/replace-tokens@v1
@@ -121,79 +119,78 @@ jobs:
121119
if: github.event_name != 'schedule' && github.event_name != 'pull_request'
122120
runs-on: ubuntu-latest
123121
steps:
124-
- name: Checkout repository
125-
uses: actions/checkout@v2
126-
with:
127-
fetch-depth: 0
128-
129-
- uses: dotnet/nbgv@master
130-
with:
131-
setAllVars: true
132-
133-
- name: Setting VERSION and BRANCH env
134-
run: |
135-
echo "::set-env name=VERSION::$NBGV_NuGetPackageVersion"
136-
echo "::set-env name=BRANCH::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')"
137-
138-
- uses: actions/setup-dotnet@v1
139-
with:
140-
dotnet-version: '3.1.x'
141-
- uses: actions/setup-dotnet@v1
142-
with:
143-
dotnet-version: '5.0.x'
144-
145-
- name: Install dotnet-sonarscanner
146-
run: dotnet tool install --global dotnet-sonarscanner
147-
- name: Running dotnet-sonarscanner
148-
shell: bash
149-
env:
150-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
151-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152-
run: |
153-
dotnet sonarscanner begin /k:"egil_bUnit" /o:"egil" /n:"bUnit" /v:"$NBGV_NuGetPackageVersion" /d:sonar.login="$SONAR_TOKEN" /d:sonar.host.url=https://sonarcloud.io /d:sonar.branch.name="$BRANCH" /d:sonar.verbose="true" /d:sonar.cs.opencover.reportsPaths="tests/**/coverage/*.opencover.xml"
154-
dotnet build
155-
dotnet test tests/bunit.core.tests/ /p:CollectCoverage=true /p:CoverletOutput=./coverage/ /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute=\"Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute\"
156-
dotnet test tests/bunit.web.tests/ /p:CollectCoverage=true /p:CoverletOutput=./coverage/ /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute=\"Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute\"
157-
dotnet test tests/bunit.xunit.tests/ /p:CollectCoverage=true /p:CoverletOutput=./coverage/ /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute=\"Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute\"
158-
dotnet sonarscanner end /d:sonar.login="$SONAR_TOKEN"
122+
- name: Checkout repository
123+
uses: actions/checkout@v2
124+
with:
125+
fetch-depth: 0
126+
127+
- uses: dotnet/nbgv@master
128+
with:
129+
setAllVars: true
130+
131+
- uses: nelonoel/[email protected]
132+
133+
- name: Setting VERSION and BRANCH env
134+
run: |
135+
echo "VERSION=$NBGV_NuGetPackageVersion" >> $GITHUB_ENV
136+
echo "BRANCH=$BRANCH_NAME" >> $GITHUB_ENV
137+
138+
- uses: actions/setup-dotnet@v1
139+
with:
140+
dotnet-version: '3.1.x'
141+
- uses: actions/setup-dotnet@v1
142+
with:
143+
dotnet-version: '5.0.x'
144+
145+
- name: Install dotnet-sonarscanner
146+
run: dotnet tool install --global dotnet-sonarscanner
147+
- name: Running dotnet-sonarscanner
148+
shell: bash
149+
env:
150+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
151+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
152+
run: |
153+
dotnet sonarscanner begin /k:"egil_bUnit" /o:"egil" /n:"bUnit" /v:"$NBGV_NuGetPackageVersion" /d:sonar.login="$SONAR_TOKEN" /d:sonar.host.url=https://sonarcloud.io /d:sonar.branch.name="$BRANCH" /d:sonar.verbose="true" /d:sonar.cs.opencover.reportsPaths="tests/**/coverage/*.opencover.xml"
154+
dotnet build
155+
dotnet test tests/bunit.core.tests/ /p:CollectCoverage=true /p:CoverletOutput=./coverage/ /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute=\"Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute\"
156+
dotnet test tests/bunit.web.tests/ /p:CollectCoverage=true /p:CoverletOutput=./coverage/ /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute=\"Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute\"
157+
dotnet test tests/bunit.xunit.tests/ /p:CollectCoverage=true /p:CoverletOutput=./coverage/ /p:CoverletOutputFormat=opencover /p:ExcludeByAttribute=\"Obsolete,GeneratedCodeAttribute,CompilerGeneratedAttribute\"
158+
dotnet sonarscanner end /d:sonar.login="$SONAR_TOKEN"
159159
160160
code-ql:
161161
if: github.event_name != 'pull_request'
162162
runs-on: ubuntu-latest
163163
steps:
164-
- name: Checkout repository
165-
uses: actions/checkout@v2
166-
with:
167-
# We must fetch at least the immediate parents so that if this is
168-
# a pull request then we can checkout the head.
169-
fetch-depth: 0
170-
171-
- uses: actions/setup-dotnet@v1
172-
with:
173-
dotnet-version: '3.1.x'
174-
- uses: actions/setup-dotnet@v1
175-
with:
176-
dotnet-version: '5.0.x'
177-
178-
- name: Initialize CodeQL
179-
uses: github/codeql-action/init@v1
180-
with:
181-
languages: csharp
182-
config-file: ./.github/codeql/codeql-config.yml
183-
184-
- name: Building library
185-
run: dotnet build -p:ContinuousIntegrationBuild=true
186-
187-
- name: Perform CodeQL Analysis
188-
uses: github/codeql-action/analyze@v1
164+
- name: Checkout repository
165+
uses: actions/checkout@v2
166+
with:
167+
# We must fetch at least the immediate parents so that if this is
168+
# a pull request then we can checkout the head.
169+
fetch-depth: 0
170+
171+
- uses: actions/setup-dotnet@v1
172+
with:
173+
dotnet-version: '3.1.x'
174+
- uses: actions/setup-dotnet@v1
175+
with:
176+
dotnet-version: '5.0.x'
177+
178+
- name: Initialize CodeQL
179+
uses: github/codeql-action/init@v1
180+
with:
181+
languages: csharp
182+
config-file: ./.github/codeql/codeql-config.yml
183+
184+
- name: Building library
185+
run: dotnet build -p:ContinuousIntegrationBuild=true
186+
187+
- name: Perform CodeQL Analysis
188+
uses: github/codeql-action/analyze@v1
189189

190190
publish-nuget-packages:
191191
if: (github.event_name == 'push' && github.ref == 'refs/heads/dev') || github.event_name == 'release'
192192
needs: [dotnet-build, dotnet-test, verify-template]
193193
runs-on: ubuntu-latest
194-
env:
195-
VERSION: ''
196-
BRANCH: ''
197194
steps:
198195
- name: Checkout Repository
199196
uses: actions/checkout@v2
@@ -204,10 +201,11 @@ jobs:
204201
with:
205202
setAllVars: true
206203

204+
- uses: nelonoel/[email protected]
207205
- name: Setting VERSION and BRANCH env
208206
run: |
209-
echo "::set-env name=VERSION::$NBGV_NuGetPackageVersion"
210-
echo "::set-env name=BRANCH::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')"
207+
echo "VERSION=$NBGV_NuGetPackageVersion" >> $GITHUB_ENV
208+
echo "BRANCH=$BRANCH_NAME" >> $GITHUB_ENV
211209
212210
- name: Update tokens in project files
213211
uses: cschleiden/replace-tokens@v1

0 commit comments

Comments
 (0)