Skip to content

Commit

Permalink
Merge pull request #21 from s2quake/ci/improve-action
Browse files Browse the repository at this point in the history
Improve build and test action
  • Loading branch information
s2quake authored Jun 17, 2024
2 parents 166bcd7 + 0bb2c90 commit 4928f41
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
40 changes: 26 additions & 14 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,39 @@ name: Build and Test
on:
pull_request:

env:
TEST_RESULTS_PATH: ${{ github.workspace }}/test-results.trx

permissions:
contents: read
actions: read
checks: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.7
- uses: actions/setup-dotnet@v4.0.0
- name: Checkout code
uses: actions/checkout@v4.1.7
- name: Setup .NET
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 8.0.100
- run: dotnet build --configuration Release
- run: |
dotnet test --configuration Release --no-restore --no-build \
--logger "trx;LogFileName=${{ github.workspace }}/logs/test-results.trx"
- run: echo "PWD=$(pwd)" >> $GITHUB_ENV
- uses: dorny/test-reporter@v1
- name: Dotnet Build
run: dotnet build --configuration Release
- name: Dotnet Test
run: |
dotnet test --configuration Release --no-restore --no-build --logger "trx;LogFileName=${{ env.TEST_RESULTS_PATH }}"
- name: Upload test results
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: XUnit Tests
path: ${{ github.workspace }}/logs/test-results.trx
reporter: dotnet-trx
- uses: actions/upload-artifact@v4
name: test-results
path: ${{ env.TEST_RESULTS_PATH }}
- name: Upload test results
uses: dorny/test-reporter@v1.9.1
if: success() || failure()
with:
name: test-results
path: ${{ github.workspace }}/logs/test-results.trx
name: XUnit Tests
path: ${{ env.TEST_RESULTS_PATH }}
reporter: dotnet-trx
9 changes: 4 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

.vs/
.vscode/
.example/
bin/
publish/
pack/
obj/
logs/
packages/
.DS_Store
.vs/
.vscode/
*.user
*.suo
launchSettings.json
build-temp.ps1
.example/
test-results.trx

0 comments on commit 4928f41

Please sign in to comment.