DN8RC2 #1835
Workflow file for this run
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: GithubActionsWIP | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
env: | |
buildPlatform: 'Any CPU' | |
buildConfiguration: 'WebAssembly' | |
outputDocFx: ${{github.workspace}}\siteDocFx | |
outputMB: ${{github.workspace}}/siteMB | |
outputWeb: ${{github.workspace}}/siteWeb | |
projectMB: 'Material.Blazor/Material.Blazor.csproj' | |
projectTest: 'Material.Blazor.Test/Material.Blazor.Test.csproj' | |
projectWeb: 'Material.Blazor.Website.WebAssembly/Material.Blazor.Website.WebAssembly.csproj' | |
outputDocFxMD3: ${{github.workspace}}\siteDocFxMD3 | |
outputMBMD3: ${{github.workspace}}/siteMBMD3 | |
outputWebMD3: ${{github.workspace}}/siteWebMD3 | |
projectMBMD3: 'Material.Blazor.MD3/Material.Blazor.MD3.csproj' | |
projectWebMD3: 'Material.Blazor.Website.WebAssembly.MD3/Material.Blazor.Website.WebAssembly.MD3.csproj' | |
jobs: | |
############################################################################################################ | |
# These jobs are used to gate actions. By creating these jobs we don't need to proliferate the repo checks | |
############################################################################################################ | |
build-allowed: | |
name: Build allowed | |
runs-on: ubuntu-latest | |
if: github.actor != 'dependabot[bot]' | |
steps: | |
- name: Nothing to see here | |
run: echo "" | |
build-allowed-fork: | |
name: Allow build only on M-B/M.B | |
needs: [build-allowed] | |
runs-on: ubuntu-latest | |
if: (github.repository != 'Material-Blazor/Material.Blazor') | |
steps: | |
- name: Nothing to see here | |
run: echo "" | |
deployment-allowed-mb: | |
name: Allow deployment on M-B/M.B | |
needs: [build-allowed] | |
runs-on: ubuntu-latest | |
if: (github.repository == 'Material-Blazor/Material.Blazor') | |
steps: | |
- name: Nothing to see here | |
run: echo "" | |
############################################################################################################ | |
# Set unified version | |
############################################################################################################ | |
set-unified-version: | |
name: Create the date based version | |
needs: [deployment-allowed-mb] | |
runs-on: ubuntu-latest | |
outputs: | |
unifiedVersion: ${{ steps.setVersion.outputs.version }} | |
steps: | |
- id: setVersion | |
run: echo "version=5.0.0-rc.$(date +'%Y-%m-%d--%H-%M-%S')" >> $GITHUB_OUTPUT | |
shell: bash | |
############################################################################################################ | |
# Run the test project. Should this fail, the deploy step (job deployghpages) is skipped | |
############################################################################################################ | |
test: | |
name: Run .NET tests | |
runs-on: windows-latest | |
needs: [build-allowed] | |
steps: | |
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
- name: Run the acceptance tests as the first build action and cancel out the rest if it fails | |
run: dotnet test ${{env.projectTest}} --configuration ${{env.buildConfiguration}} | |
############################################################################################################ | |
# Build documentation | |
############################################################################################################ | |
build-documentation: | |
name: Build documentation | |
runs-on: windows-latest | |
needs: [build-allowed] | |
steps: | |
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
- name: Setup docfx | |
run: | | |
copy Material.Blazor\docfx.json.MD2 docfx.json | |
copy Material.Blazor\index.md.MD2 index.md | |
copy Material.Blazor\toc.yml.MD2 toc.yml | |
dotnet tool update -g docfx | |
- name: Build Material.Blazor | |
run: dotnet build ${{env.projectMB}} --configuration ${{env.buildConfiguration}} | |
- name: Create documentation π§ | |
run: docfx docfx.json | |
env: | |
DOCFX_SOURCE_BRANCH_NAME: main | |
- name: Show the documentation artifacts | |
run: dir siteDocFx | |
- name: Upload Documentation Artifacts πΊ # The documentation site is then uploaded as an artifact named 'siteDocFx'. | |
uses: actions/upload-artifact@v3 | |
with: | |
name: siteDocFx | |
path: siteDocFx | |
############################################################################################################ | |
# Build website | |
############################################################################################################ | |
build-website: | |
name: Build website | |
needs: [test, set-unified-version] | |
runs-on: windows-latest | |
steps: | |
- name: Set ciVersion as env variable | |
run: echo "ciVersion=${{needs.set-unified-version.outputs.unifiedVersion}}" >> $GITHUB_ENV | |
shell: bash | |
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
- name: Build & Publish Website π§ | |
run: > | |
dotnet publish ${{env.projectWeb}} | |
--configuration ${{env.buildConfiguration}} | |
--output ${{env.outputWeb}} | |
-p:Version=${{env.ciVersion}} | |
-p:BlazorEnableCompression=false | |
--framework net8.0 | |
# All of the trace was added to show that .js & .min.js files were getting created but not | |
# being included in the published content. This was a result of VS 'helpfully' adding some | |
# 'content none' and 'content remove' directives after a deletion of the .js files to test | |
# the build of derived files. It is being left in place to help in the future. | |
# - name: Display workspace κͺ | |
# run: dir ${{github.workspace}} | |
- name: Display wwwroot κͺ | |
run: dir ${{github.workspace}}/Material.Blazor/wwwroot | |
# - name: Display MaterialBlazor package output κͺ | |
# run: dir ${{env.outputWeb}} | |
# - name: Display MaterialBlazor package output wwwroot κͺ | |
# run: dir ${{env.outputWeb}}/wwwroot | |
# - name: Display MaterialBlazor package output wwwroot/_content κͺ | |
# run: dir ${{env.outputWeb}}/wwwroot/_content | |
- name: Display MaterialBlazor package output wwwroot/_content κͺ | |
run: dir ${{env.outputWeb}}/wwwroot/_content/Material.Blazor | |
- name: Upload Website Artifacts πΊ # The website is then uploaded as an artifact named 'siteWeb'. | |
uses: actions/upload-artifact@v3 | |
with: | |
name: siteWeb | |
path: siteWeb | |
############################################################################################################ | |
# Build nuget package | |
############################################################################################################ | |
build-package: | |
name: Build nuget package | |
needs: [test, set-unified-version] | |
runs-on: windows-latest | |
steps: | |
- name: Set ciVersion as env variable | |
run: echo "ciVersion=${{needs.set-unified-version.outputs.unifiedVersion}}" >> $GITHUB_ENV | |
shell: bash | |
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
- name: Build Material.Blazor & Generate the NuGet package π§ | |
run: > | |
dotnet pack ${{env.projectMB}} | |
--configuration ${{env.buildConfiguration}} | |
--output ${{env.outputMB}} | |
-p:IncludeSymbols=true | |
-p:SymbolPackageFormat=snupkg | |
-p:Version=${{env.ciVersion}} | |
- name: Display MaterialBlazor package output κͺ | |
run: dir ${{env.outputMB}} | |
############################################################################################################ | |
# deployghpages-mbcurrent | |
# The current version of Material.Blazor is viewable on GH-pages in addition to material-blazor.com | |
############################################################################################################ | |
deployghpages-mbcurrent: | |
name: Deploy to GitHub pages (Material-Blazor/Material.Blazor.Current) | |
needs: [test, build-documentation, build-website, deployment-allowed-mb] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Download Artifacts π» # The built project is downloaded into the 'site' folder. | |
uses: actions/download-artifact@v3 | |
with: | |
name: siteDocFx | |
path: siteDocFx | |
- name: Download Artifacts π» # The built project is downloaded into the 'site' folder. | |
uses: actions/download-artifact@v3 | |
with: | |
name: siteWeb | |
path: siteWeb | |
- name: Configure deployment directory structure κͺ | |
run: mv siteWeb/wwwroot deployroot; mv siteDocFx deployroot/docs | |
# this step rewrites the base href when we are in the main repo and about to deploy to the Material.Blazor.Current repo | |
- name: Base Href Rewrite π | |
uses: SteveSandersonMS/ghaction-rewrite-base-href@v1 | |
with: | |
html_path: 'deployroot/index.html' | |
base_href: '/Material.Blazor.Current/' | |
# this step deploys to Material-Blazor/Material.Blazor.Current when we are in the main repo | |
- name: Deploy π | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{secrets.GH_PAT}} | |
branch: gh-pages | |
folder: 'deployroot' | |
repository-name: Material-Blazor/Material.Blazor.Current | |
############################################################################################################ | |
# comparison | |
############################################################################################################ | |
# compare: | |
# needs: [deployghpages, test] | |
# name: Compare pages | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
# uses: actions/checkout@v4 | |
# - id: install-puppeteer | |
# run: | | |
# npm i puppeteer trim-image looks-same glob | |
# - id: test | |
# run: | | |
# node Material.Blazor.Test/comparison.js https://${{github.repository_owner}}.github.io/Material.Blazor > comparison.log | |
# # A few things need to be ignored to make a sensible comparison: | |
# # some files have integrity hashes. Those change often, so ignore those | |
# # many elements have GUIDs as attributes etc. GUIDs are usually generated dynamically, so differ on each page render | |
# # tooltips have ids too, in the format mb-tooltip-123 | |
# - name: normalize | |
# run: | | |
# sed -i 's/integrity="\(.*\)"/integrity="..."/g' *.html | |
# sed -i 's/[a-f0-9]\{8\}-[a-f0-9]\{4\}-[a-f0-9]\{4\}-[a-f0-9]\{4\}-[a-f0-9]\{12\}/guid/g' *.html | |
# sed -i 's/mb-tooltip-[0-9]*/mb-tooltip-id/g' *.html | |
# sed -i 's/b-[0-9a-z]*/b-id/g' *.html | |
# sed -i 's/_bl_[0-9]*/_bl_id/g' *.html | |
# sed -i 's/<strong>.*-ci..*<\/strong>//' *.html | |
# sed -i 's/base href.*//' *.html | |
# # We only want to see the differences, so we run diff with -d | |
# # We also don't want to be notified of whitespace-only changes, so we ignore those with -w | |
# # The exit code of diff is non-zero when there is a non-empty difference, but we need to continue running this job regardless | |
# - name: diff | |
# run: | | |
# for file in $(find -type f -name 'mb_*.html') | |
# do | |
# suffix=$(echo $file | cut -c5-) | |
# echo "### Differences on page '${suffix}'" > report${suffix}.md | |
# echo "\`\`\`diff" >> report${suffix}.md | |
# diff -d -w mb${suffix} fork${suffix} >> report${suffix}.md || true | |
# echo "\`\`\`" >> report${suffix}.md | |
# done | |
# - name: Aggregate reports | |
# run: | | |
# echo "# Comparison report" > all_reports.md | |
# echo "Number of pages compared:" >> all_reports.md | |
# ls -a -1 report*md | wc -l >> all_reports.md | |
# cat report*md >> all_reports.md | |
# - name: Summarise report for auto-generated issue | |
# run: | | |
# echo "# Number of pages compared:" > meta_report.md | |
# ls -a -1 report*md | wc -l >> meta_report.md | |
# echo "" >> meta_report.md | |
# echo "# Pages with some difference:" >> meta_report.md | |
# wc -l report*md | sed '$d' | grep -v " 3 " | rev | cut -d' ' -f1 | rev | sed 's%report\(.*\).md%\1%' >> meta_report.md | |
# echo "" >> meta_report.md | |
# echo "# Pages without differences:" >> meta_report.md | |
# wc -l report*md | sed '$d' | grep " 3 " | rev | cut -d' ' -f1 | rev | sed 's%report\(.*\).md%\1%' >> meta_report.md | |
# echo "" >> meta_report.md | |
# echo "# Preview of differences:" >> meta_report.md | |
# wc -l report*md | sed '$d' | grep -v " 3 " | rev | cut -d' ' -f1 | rev | xargs cat >> meta_report.md | |
# # At this point we have the full differences in the meta report. This might be too large! We truncate, if necessary: | |
# if [ $(wc -c meta_report.md | cut -d ' ' -f 1) -lt 65536 ]; | |
# then | |
# echo "Report is small enough" | |
# else | |
# echo "" >> tail.md | |
# echo "" >> tail.md | |
# echo "The full report is available as artifact on https://github.com/${{github.actor}}/Material.Blazor/actions/runs/${{github.run_id}}" >> tail.md | |
# remaining_bytes=$((65536-$(wc -c tail.md | cut -d ' ' -f1))) | |
# dd if=meta_report.md of=trimmed_meta_report.md bs=1 count=$remaining_bytes | |
# cat trimmed_meta_report.md tail.md > meta_report.md | |
# fi | |
# - name: Upload comparison & report artifact | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: comparison_report | |
# path: | | |
# comparison.log | |
# *.html | |
# *.png | |
# report*.md | |
# all_reports.md | |
# - name: Create issue from file | |
# uses: peter-evans/create-issue-from-file@v4 | |
# with: | |
# title: Comparison of material-blazor.github.io/Material.Blazor.Current and ${{github.actor}}.github.io/Material.Blazor | |
# content-filepath: meta_report.md | |
# labels: report, automated issue | |
# token: ${{secrets.GH_PAT}} | |
############################################################################################################ | |
# Build only nuget package | |
############################################################################################################ | |
build-only-package: | |
name: Build nuget package | |
needs: [test, build-allowed-fork] | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
- name: Build Material.Blazor & Generate the NuGet package π§ | |
run: > | |
dotnet pack ${{env.projectMB}} | |
--configuration ${{env.buildConfiguration}} | |
--output ${{env.outputMB}} | |
-p:IncludeSymbols=true | |
-p:SymbolPackageFormat=snupkg | |
- name: Display MaterialBlazor package output κͺ | |
run: dir ${{env.outputMB}} | |
############################################################################################################ | |
############################################################################################################ | |
############################################################################################################ | |
# MD3 jobs | |
############################################################################################################ | |
############################################################################################################ | |
############################################################################################################ | |
############################################################################################################ | |
# Build documentation | |
############################################################################################################ | |
build-documentation-MD3: | |
name: Build documentation | |
runs-on: windows-latest | |
needs: [build-allowed] | |
steps: | |
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
- name: Setup docfx | |
run: | | |
copy Material.Blazor.MD3\docfx.json.MD3 docfx.json | |
copy Material.Blazor.MD3\index.md.MD3 index.md | |
copy Material.Blazor.MD3\toc.yml.MD3 toc.yml | |
dotnet tool update -g docfx | |
- name: Build Material.Blazor | |
run: dotnet build ${{env.projectMBMD3}} --configuration ${{env.buildConfiguration}} | |
- name: Create documentation π§ | |
run: docfx docfx.json | |
env: | |
DOCFX_SOURCE_BRANCH_NAME: main | |
- name: Show the documentation artifacts | |
run: dir siteDocFxMD3 | |
- name: Upload Documentation Artifacts πΊ # The project is then uploaded as an artifact named 'siteDocFx'. | |
uses: actions/upload-artifact@v3 | |
with: | |
name: siteDocFxMD3 | |
path: siteDocFxMD3 | |
########################################################################################################### | |
# Build website | |
############################################################################################################ | |
build-website-MD3: | |
name: Build website MD3 | |
needs: [test, set-unified-version] | |
runs-on: windows-latest | |
steps: | |
- name: Set ciVersion as env variable | |
run: echo "ciVersion=${{needs.set-unified-version.outputs.unifiedVersion}}" >> $GITHUB_ENV | |
shell: bash | |
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
- name: Build & Publish Website π§ | |
run: > | |
dotnet publish ${{env.projectWebMD3}} | |
--configuration ${{env.buildConfiguration}} | |
--output ${{env.outputWebMD3}} | |
-p:Version=${{env.ciVersion}} | |
-p:BlazorEnableCompression=false | |
--framework net8.0 | |
# All of the trace was added to show that .js & .min.js files were getting created but not | |
# being included in the published content. This was a result of VS 'helpfully' adding some | |
# 'content none' and 'content remove' directives after a deletion of the .js files to test | |
# the build of derived files. It is being left in place to help in the future. | |
# - name: Display workspace κͺ | |
# run: dir ${{github.workspace}} | |
- name: Display wwwroot κͺ | |
run: dir ${{github.workspace}}/Material.Blazor.MD3/wwwroot | |
# - name: Display MaterialBlazorMD3 package output κͺ | |
# run: dir ${{env.outputWebMD3}} | |
# - name: Display MaterialBlazorMD3 package output wwwroot κͺ | |
# run: dir ${{env.outputWebMD3}}/wwwroot | |
# - name: Display MaterialBlazorMD3 package output wwwroot _content κͺ | |
# run: dir ${{env.outputWebMD3}}/wwwroot/_content | |
- name: Display MaterialBlazorMD3 package output wwwroot _content Material.Blazor.MD3 κͺ | |
run: dir ${{env.outputWebMD3}}/wwwroot/_content/Material.Blazor.MD3 | |
- name: Upload Website Artifacts πΊ # The website is then uploaded as an artifact named 'siteWeb'. | |
uses: actions/upload-artifact@v3 | |
with: | |
name: siteWebMD3 | |
path: siteWebMD3 | |
############################################################################################################ | |
# Build nuget package | |
############################################################################################################ | |
build-package-MD3: | |
name: Build nuget package MD3 | |
needs: [test, set-unified-version] | |
runs-on: windows-latest | |
steps: | |
- name: Set ciVersion as env variable | |
run: echo "ciVersion=${{needs.set-unified-version.outputs.unifiedVersion}}" >> $GITHUB_ENV | |
shell: bash | |
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
- name: Build Material.Blazor & Generate the NuGet package π§ | |
run: > | |
dotnet pack ${{env.projectMBMD3}} | |
--configuration ${{env.buildConfiguration}} | |
--output ${{env.outputMBMD3}} | |
-p:IncludeSymbols=true | |
-p:SymbolPackageFormat=snupkg | |
-p:Version=${{env.ciVersion}} | |
- name: Display MaterialBlazor package output κͺ | |
run: dir ${{env.outputMBMD3}} | |
############################################################################################################ | |
# deployghpages-mbcurrent | |
# The current version of Material.Blazor is viewable on GH-pages in addition to material-blazor.com | |
############################################################################################################ | |
deployghpages-mbcurrent-MD3: | |
name: Deploy to GitHub pages (Material-Blazor/Material.Blazor.MD3.Current) | |
needs: [test, build-website-MD3, build-documentation-MD3, deployment-allowed-mb] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Download Artifacts π» # The built project is downloaded into the 'site' folder. | |
uses: actions/download-artifact@v3 | |
with: | |
name: siteDocFxMD3 | |
path: siteDocFxMD3 | |
- name: Download Artifacts π» # The built project is downloaded into the 'site' folder. | |
uses: actions/download-artifact@v3 | |
with: | |
name: siteWebMD3 | |
path: siteWebMD3 | |
- name: Configure deployment directory structure κͺ | |
run: mv siteWebMD3/wwwroot deployroot; mv siteDocFxMD3 deployroot/docs | |
# this step rewrites the base href when we are in the main repo and about to deploy to the Material.Blazor.Current repo | |
- name: Base Href Rewrite π | |
uses: SteveSandersonMS/ghaction-rewrite-base-href@v1 | |
with: | |
html_path: 'deployroot/index.html' | |
base_href: '/Material.Blazor.MD3.Current/' | |
# this step deploys to Material-Blazor/Material.Blazor.MD3.Current when we are in the main repo | |
- name: Deploy π | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{secrets.GH_PAT}} | |
branch: gh-pages | |
folder: 'deployroot' | |
repository-name: Material-Blazor/Material.Blazor.MD3.Current | |
############################################################################################################ | |
# Build only MD3 nuget package | |
############################################################################################################ | |
build-only-package-MD3: | |
name: Build nuget package MD3 | |
needs: [test, build-allowed-fork] | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
uses: actions/checkout@v4 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
- name: Build Material.Blazor & Generate the NuGet package π§ | |
run: > | |
dotnet pack ${{env.projectMBMD3}} | |
--configuration ${{env.buildConfiguration}} | |
--output ${{env.outputMBMD3}} | |
-p:IncludeSymbols=true | |
-p:SymbolPackageFormat=snupkg | |
- name: Display MaterialBlazor package output κͺ | |
run: dir ${{env.outputMBMD3}} |