chore: update project to dotnet 7.0 and its libraries #28
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: Build and publish | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- 'scripts/start-sonarcloud.sh' | |
- '*.sln' | |
jobs: | |
build-n-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
with: | |
# Shallow clones should be disabled for a better relevancy of analysis | |
fetch-depth: 0 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '11' | |
- name: Install dotnet-format and dotnet-sonarscanner | |
run: | | |
dotnet tool install --global dotnet-format | |
dotnet tool install --global dotnet-sonarscanner | |
- name: Check if the project is well formatted | |
run: | | |
./scripts/start-lint.sh | |
- name: Import environment variables from a file | |
shell: bash | |
run: | | |
while read line; do | |
if [[ $line =~ ^([a-z]|[A-Z]).+ ]]; then | |
echo "Settings the following ==> $line" | |
echo "$line" >> $GITHUB_ENV | |
fi | |
done < .env.development | |
- name: Build the project, run all tests and publish to SonarCloud | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
# Host as "localhost" because the job will not run in the same network | |
ConnectionStrings__AppDbContext: "Host=localhost;Port=5432;Database=postgres;Username=boss_role;Password=boss_password;" | |
run: | | |
docker-compose up -d db | |
./scripts/start-sonarcloud.sh ${{ secrets.SONAR_TOKEN }} ${{ github.sha }} |