Unify builds and add matrix build with LTS versions. #12
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: csharp-simple-build | |
on: | |
push: | |
paths: | |
- 'csharp-simple/**' | |
- '.github/workflows/csharp-simple-build.yml' | |
pull_request: | |
paths: | |
- 'csharp-simple/**' | |
- '.github/workflows/csharp-simple-build.yml' | |
jobs: | |
build: | |
defaults: | |
run: | |
working-directory: ./csharp-simple | |
runs-on: ubuntu-latest | |
env: | |
DB_USER: root | |
DB_OLD_PASSWORD: root | |
DB_PASSWORD: mysql | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Start MYSQL and import DB | |
run: | | |
sudo systemctl start mysql | |
mysqladmin --user=${{ env.DB_USER }} --password=${{ env.DB_OLD_PASSWORD }} password ${{ env.DB_PASSWORD }} | |
mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < ${GITHUB_WORKSPACE}/database/initDatabase.sql | |
- name: Setup dotnet build | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 3.1.x | |
- name: use nuget cache | |
uses: actions/cache@v4 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
restore-keys: ${{ runner.os }}-nuget | |
- name: install dependencies | |
run: dotnet restore | |
- name: build solution | |
run: dotnet build | |
- name: run unit tests | |
run: dotnet test --logger "trx;logfilename=${GITHUB_WORKSPACE}/unit_test_results.xml" |