Skip to content

Commit 3edd8ea

Browse files
committed
test
1 parent 0d5981f commit 3edd8ea

File tree

1 file changed

+46
-29
lines changed

1 file changed

+46
-29
lines changed

.github/workflows/dotnet.yml

Lines changed: 46 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ jobs:
3636
os: [ubuntu-latest, windows-latest, macos-latest]
3737
runs-on: ${{ matrix.os }}
3838
steps:
39-
- name: Print messages
40-
run: |
41-
echo "PR ${{github.event.pull_request.number}} at ${{github.event.pull_request.url}}"
42-
echo "Base repo = ${{github.context.repo.owner}}/${{github.context.repo.repo}}, SHA = ${{github.event.pull_request.head.sha||github.sha}}"
43-
- name: Dump event object
44-
run: |
45-
echo "${{toJSON(github.event)}}"
4639
- name: Setup PostgreSQL
4740
uses: ikalnytskyi/action-setup-postgres@v4
4841
with:
@@ -73,6 +66,27 @@ jobs:
7366
Write-Host "$(pwsh --version) is installed at $PSHOME"
7467
psql --version
7568
Write-Host "Using .NET SDK: $(dotnet --version)"
69+
#
70+
- name: Print messages
71+
shell: pwsh
72+
env:
73+
#MY_MSG: ${{ github.event.pull_request.merged == true && ('#'github.event.pull_request.number) || github.sha }}
74+
MY_MSG: ${{ github.event_name == 'pull_request' && ('#'github.event.pull_request.number) || github.sha }}
75+
run: |
76+
# github.event.pull_request.merged == true
77+
Write-Host "Message = "$env:MY_MSG"
78+
79+
80+
# For a PR:
81+
# Auto-generated documentation from [1294](https://github.com/json-api-dotnet/JsonApiDotNetCore/pull/1294)
82+
# For a commit
83+
# Auto-generated documentation from {auto}
84+
#echo "PR ${{github.event.pull_request.number}} at ${{github.event.pull_request.url}}"
85+
#echo "Base repo = ${{github.context.repo.owner}}/${{github.context.repo.repo}}, SHA = ${{github.event.pull_request.head.sha||github.sha}}"
86+
- name: Dump event object
87+
run: |
88+
echo "${{toJSON(github.event)}}"
89+
#
7690
- name: Git checkout
7791
uses: actions/checkout@v3
7892
- name: Restore tools
@@ -112,26 +126,26 @@ jobs:
112126
shell: pwsh
113127
run: |
114128
dotnet build --no-restore --configuration Release --version-suffix=$env:PACKAGE_VERSION_SUFFIX
115-
- name: Test
116-
run: |
117-
dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" --logger "GitHubActions;summary.includeSkippedTests=true" -- RunConfiguration.CollectSourceInformation=true DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.DeterministicReport=true
118-
- name: Upload coverage to codecov.io
119-
if: matrix.os == 'ubuntu-latest'
120-
uses: codecov/codecov-action@v3
121-
- name: Generate packages
122-
shell: pwsh
123-
run: |
124-
dotnet pack --no-build --configuration Release --output $env:GITHUB_WORKSPACE/artifacts/packages --version-suffix=$env:PACKAGE_VERSION_SUFFIX
125-
- name: Upload packages to artifacts
126-
if: matrix.os == 'ubuntu-latest'
127-
uses: actions/upload-artifact@v3
128-
with:
129-
name: packages
130-
path: artifacts/packages
129+
# - name: Test
130+
# run: |
131+
# dotnet test --no-build --configuration Release --collect:"XPlat Code Coverage" --logger "GitHubActions;summary.includeSkippedTests=true" -- RunConfiguration.CollectSourceInformation=true DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.DeterministicReport=true
132+
# - name: Upload coverage to codecov.io
133+
# if: matrix.os == 'ubuntu-latest'
134+
# uses: codecov/codecov-action@v3
135+
# - name: Generate packages
136+
# shell: pwsh
137+
# run: |
138+
# dotnet pack --no-build --configuration Release --output $env:GITHUB_WORKSPACE/artifacts/packages --version-suffix=$env:PACKAGE_VERSION_SUFFIX
139+
# - name: Upload packages to artifacts
140+
# if: matrix.os == 'ubuntu-latest'
141+
# uses: actions/upload-artifact@v3
142+
# with:
143+
# name: packages
144+
# path: artifacts/packages
131145
- name: Generate documentation
132146
shell: pwsh
133147
env:
134-
# This contains the git tag name on release; in that case we build but don't publish.
148+
# This contains the git tag name on release; in that case we build the docs without publishing.
135149
DOCFX_SOURCE_BRANCH_NAME: ${{ github.base_ref || github.ref_name }}
136150
run: |
137151
Write-Host "Using docfx branch name: $env:DOCFX_SOURCE_BRANCH_NAME"
@@ -232,7 +246,7 @@ jobs:
232246
shell: pwsh
233247
run: |
234248
# Not using the environment variables for SHAs, because they may be outdated. This happens on force-push after the build is queued, but before it starts.
235-
# The below works because HEAD is detached (at the merge commit), so HEAD~1 is at the base branch.
249+
# The below works because HEAD is detached (at the merge commit), so HEAD~1 is at the base branch. When a PR contains no commits, this job will not run.
236250
$headCommitHash = git rev-parse HEAD
237251
$baseCommitHash = git rev-parse HEAD~1
238252
@@ -248,8 +262,9 @@ jobs:
248262
publish:
249263
timeout-minutes: 60
250264
runs-on: ubuntu-latest
251-
needs: [ build-and-test, inspect-code, cleanup-code ]
252-
if: ${{ !github.event.pull_request.head.repo.fork }}
265+
needs: [ build-and-test ]
266+
#needs: [ build-and-test, inspect-code, cleanup-code ]
267+
#if: ${{ !github.event.pull_request.head.repo.fork }}
253268
permissions:
254269
packages: write
255270
contents: write
@@ -264,11 +279,13 @@ jobs:
264279
dotnet nuget add source --username 'json-api-dotnet' --password "$env:GITHUB_TOKEN" --store-password-in-clear-text --name 'github' 'https://nuget.pkg.github.com/json-api-dotnet/index.json'
265280
dotnet nuget push "$env:GITHUB_WORKSPACE/packages/*.nupkg" --api-key "$env:GITHUB_TOKEN" --source 'github'
266281
- name: Publish documentation
267-
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
282+
#if: github.event_name == 'push' && github.ref == 'refs/heads/master'
268283
uses: peaceiris/actions-gh-pages@v3
269284
with:
270285
github_token: ${{ secrets.GITHUB_TOKEN }}
271-
publish_branch: gh-pages
286+
# TODO: Revert
287+
publish_branch: gh-pages-test
288+
#publish_branch: gh-pages
272289
publish_dir: ./documentation
273290
commit_message: 'Auto-generated documentation from: ${{ github.event.head_commit.message }}'
274291
- name: Publish to NuGet

0 commit comments

Comments
 (0)