added postb articles #275
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: GDSC API Tests | |
on: | |
push: | |
branches: [ main, dev ] | |
pull_request: | |
branches: [ main, dev ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
config: 'Release' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 7.0.x | |
# restore dependencies | |
- name: Install dependencies | |
run: dotnet restore | |
# build project | |
- name: Build | |
run: dotnet build --configuration $config --no-restore | |
- name: set pr build number (if pr) | |
id: PRNUMBER | |
if: ${{ github.event_name == 'pull_request' }} | |
uses: kkak10/pr-number-action@v1.3 | |
# set report file and title | |
- name: Set Test Title | |
run: | | |
if ${{ github.event_name == 'pull_request' }} | |
then | |
echo "title=Test Run for PR #${{steps.PRNUMBER.outputs.pr}} (${{github.run_number}})" >> $GITHUB_ENV | |
echo "file_name=TestReport.${{steps.PRNUMBER.outputs.pr}}.${{github.run_number}}.md" >> $GITHUB_ENV | |
else | |
echo "title=Test Run ${{github.run_number}}" >> $GITHUB_ENV | |
echo "file_name=TestReport.${{github.run_number}}.md" >> $GITHUB_ENV | |
fi | |
# run tests with built project | |
- name: Test PR | |
run: dotnet test --no-restore --no-build --configuration $config --logger:"liquid.md;LogFileName=${{github.workspace}}/${{env.file_name}};Title=${{env.title}};" | |
# upload report as build artifact | |
- name: Upload a Build Artifact | |
uses: actions/upload-artifact@v3 | |
if: ${{always()}} | |
with: | |
name: 'Test Run' | |
path: ${{github.workspace}}/${{env.file_name}} | |
# add report as PR comment (if PR) | |
- name: comment PR | |
uses: machine-learning-apps/pr-comment@master | |
if: ${{ github.event_name == 'pull_request' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
path: ${{env.file_name}} |