Bump terser from 5.18.0 to 5.18.2 in /Material.Blazor #1636
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 | |
############################################################################################################ | |
perform-deployment-mb: | |
name: Perform deployment on M-B/M.B | |
runs-on: ubuntu-latest | |
if: github.repository == 'Material-Blazor/Material.Blazor' && github.actor != 'dependabot[bot]' | |
steps: | |
- name: Nothing to see here | |
run: echo "" | |
perform-deployment-fork: | |
name: Perform deployment fork | |
runs-on: ubuntu-latest | |
if: github.repository != 'Material-Blazor/Material.Blazor' || github.actor == 'dependabot[bot]' | |
steps: | |
- name: Nothing to see here | |
run: echo "" | |
build-allowed: | |
name: Build allowed | |
runs-on: ubuntu-latest | |
if: github.actor != 'dependabot[bot]' | |
steps: | |
- name: Nothing to see here | |
run: echo "" | |
############################################################################################################ | |
# Set unified version | |
############################################################################################################ | |
set-unified-version: | |
name: Create the date based version | |
needs: [perform-deployment-mb] | |
runs-on: ubuntu-latest | |
outputs: | |
unifiedVersion: ${{ steps.setVersion.outputs.version }} | |
steps: | |
- id: setVersion | |
run: echo "version=4.0.0-preview.$(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@v3 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
dotnet-quality: 'preview' | |
- 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@v3 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
dotnet-quality: 'preview' | |
- name: Create documentation π§ | |
run: .\docfx\docfx docfx.json | |
env: | |
DOCFX_SOURCE_BRANCH_NAME: main | |
- name: Upload Documentation Artifacts πΊ # The project 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@v3 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
dotnet-quality: 'preview' | |
- name: Install WASM tools | |
run: dotnet workload restore | |
- name: Build & Publish Website π§ | |
run: dotnet publish ${{env.projectWeb}} --configuration ${{env.buildConfiguration}} --output ${{env.outputWeb}} -p:Version=${{env.ciVersion}} -p:BlazorEnableCompression=false | |
- 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@v3 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
dotnet-quality: 'preview' | |
- 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 | |
# We deploy to GH pages in the following conditions | |
# - on any fork on push | |
# - on any fork on PR by an authorized user | |
# We NEVER deploy to GH pages on Material-Blazor/Material.Blazor in this WIP workflow: | |
# Material.Blazor.Current is handled by deployghpages-mbcurrent below. | |
############################################################################################################ | |
deployghpages: | |
name: Deploy to GitHub pages | |
needs: [test, build-documentation, build-website, perform-deployment-fork] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
uses: actions/checkout@v2 | |
- 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 | |
- name: Base Href Rewrite π | |
uses: SteveSandersonMS/ghaction-rewrite-base-href@v1 | |
with: | |
html_path: 'deployroot/index.html' | |
base_href: '/Material.Blazor/' | |
# this step deploys to the current repo's gh-pages branch | |
- name: Deploy π | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
token: ${{secrets.GH_PAT}} | |
branch: gh-pages | |
folder: 'deployroot' | |
############################################################################################################ | |
# 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, perform-deployment-mb] | |
if: (github.event_name == 'push') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
uses: actions/checkout@v3 | |
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@v3 | |
- 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}} | |
############################################################################################################ | |
############################################################################################################ | |
############################################################################################################ | |
# MD3 jobs | |
############################################################################################################ | |
############################################################################################################ | |
############################################################################################################ | |
########################################################################################################### | |
# 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@v3 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
dotnet-quality: 'preview' | |
- name: Build & Publish Website π§ | |
run: dotnet publish ${{env.projectWebMD3}} --configuration ${{env.buildConfiguration}} --output ${{env.outputWebMD3}} -p:Version=${{env.ciVersion}} -p:BlazorEnableCompression=false | |
- 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@v3 | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.x' | |
dotnet-quality: 'preview' | |
- 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 | |
# We deploy to GH pages in the following conditions | |
# - on any fork on push | |
# - on any fork on PR by an authorized user | |
# We NEVER deploy to GH pages on Material-Blazor/Material.Blazor in this WIP workflow: | |
# Material.Blazor.MD3.Current is handled by deployghpages-mbcurrent-MD3 below. | |
############################################################################################################ | |
#deployghpages-MD3: | |
# name: Deploy to GitHub pages MD3 | |
# needs: [test, build-website-MD3, perform-deployment-fork] | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
# uses: actions/checkout@v2 | |
# - 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 | |
# # this step rewrites the base href | |
# - name: Base Href Rewrite π | |
# uses: SteveSandersonMS/ghaction-rewrite-base-href@v1 | |
# with: | |
# html_path: 'deployroot/index.html' | |
# base_href: '/Material.Blazor.MD3/' | |
# # this step deploys to the current repo's gh-pages branch | |
# - name: Deploy π | |
# uses: JamesIves/github-pages-deploy-action@v4 | |
# with: | |
# token: ${{secrets.GH_PAT}} | |
# branch: gh-pages | |
# folder: 'deployroot' | |
############################################################################################################ | |
# 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, perform-deployment-mb] | |
if: (github.event_name == 'push') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository under $GITHUB_WORKSPACE so the job can access it ποΈ | |
uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
- 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 | |
# 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 | |