Updated BUILD.md with release instructions #9
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 Test | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.x' | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --configuration Release --no-restore | |
- name: Install ReportGenerator | |
run: dotnet tool install -g dotnet-reportgenerator-globaltool | |
- name: Test | |
run: | | |
dotnet test --configuration Release tests/Tableau.Migration.App.Core.Tests/ /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../../CoreCoverage.xml | |
dotnet test --configuration Release tests/Tableau.Migration.App.GUI.Tests /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=../../GUICoverage.xml | |
env: | |
TABLEAU_CLOUD_URL: ${{ secrets.TABLEAU_CLOUD_URL }} | |
TABLEAU_CLOUD_SITE: ${{ secrets.TABLEAU_CLOUD_SITE }} | |
TABLEAU_CLOUD_TOKEN_NAME: ${{ secrets.TABLEAU_CLOUD_TOKEN_NAME }} | |
TABLEAU_CLOUD_TOKEN: ${{ secrets.TABLEAU_CLOUD_TOKEN }} | |
TABLEAU_SERVER_URL: ${{ secrets.TABLEAU_SERVER_URL }} | |
TABLEAU_SERVER_SITE: "" | |
TABLEAU_SERVER_TOKEN_NAME: ${{ secrets.TABLEAU_SERVER_TOKEN_NAME }} | |
TABLEAU_SERVER_TOKEN: ${{ secrets.TABLEAU_SERVER_TOKEN }} | |
- name: Generate coverage report | |
env: | |
PATH: $PATH:/home/runner/.dotnet/tools # Adds dotnet tools to PATH | |
run: reportgenerator -reports:"./*Coverage.xml" -targetdir:./coverage-report -reporttypes:"Html;TextSummary" | |
- name: Comment coverage summary on PR | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const fs = require('fs'); | |
const summary = fs.readFileSync('./coverage-report/Summary.txt', 'utf8'); | |
// Split the summary by lines and get the first 18 | |
const topSummary = summary.split('\n').slice(0, 18).join('\n'); | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: `## Code Coverage Summary\n\`\`\`\n${topSummary}\n\`\`\`` | |
}); | |
# Skipping for now due to line ending mismatches | |
# - name: Run dotnet format | |
# id: format | |
# run: | | |
# dotnet format --verbosity diagnostic > format.log | |
# grep -q 'Formatted code file' format.log || exit 0 | |
# exit 1 | |
# - name: Check format results | |
# if: failure() | |
# uses: actions/github-script@v6 | |
# with: | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# script: | | |
# github.rest.issues.createComment({ | |
# issue_number: context.issue.number, | |
# owner: context.repo.owner, | |
# repo: context.repo.repo, | |
# body: "Formatting issues were found and fixed. Please run 'dotnet format' locally to ensure your code is properly formatted." | |
# }) |