Skip to content

Commit

Permalink
feat: #428 new template with parameters for common features (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
ascott18 authored Sep 6, 2024
1 parent f20cdcb commit ccf2119
Show file tree
Hide file tree
Showing 115 changed files with 12,668 additions and 154 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Suppress: EC112

[*.{vue,ts,js,scss,html,csproj,md,props,targets}]
[*.{vue,ts,js,scss,html,csproj,md,props,targets,yml}]
indent_style = space
indent_size = 2

Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/alpha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@ on:
workflow_dispatch:

jobs:
meta:
uses: ./.github/workflows/part-compute-version.yml
secrets: inherit
with:
prereleaseSlug: ci

build:
uses: ./.github/workflows/part-build.yml
secrets: inherit
needs: meta
with:
prereleaseSlug: ci
COALESCE_VERSION: ${{ needs.meta.outputs.COALESCE_VERSION }}

publish:
if: success() && github.event_name == 'push'
Expand Down
193 changes: 86 additions & 107 deletions .github/workflows/part-build.yml
Original file line number Diff line number Diff line change
@@ -1,101 +1,24 @@
on:
workflow_call:
inputs:
prereleaseSlug:
required: false
type: string
checkTagIsUnique:
required: false
type: boolean
outputs:
COALESCE_VERSION:
description: "COALESCE_VERSION"
value: ${{ jobs.meta.outputs.COALESCE_VERSION }}
required: true
type: string

jobs:
meta:
runs-on: ubuntu-latest

outputs:
COALESCE_VERSION: ${{ steps.version.outputs.COALESCE_VERSION }}

steps:
- uses: actions/checkout@v3

- name: "Verify and set COALESCE_VERSION variable"
id: version
shell: pwsh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$apiBaseUrl = "${{ github.api_url }}/repos/${{ github.repository }}/actions"
$runInfo = curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "$apiBaseUrl/runs/${{ github.run_id }}";
$workflowId = $runInfo | jq -r .workflow_id;
$createdAt = $runInfo | jq -r .created_at;
$createdAtPST = [System.TimeZoneInfo]::ConvertTimeBySystemTimeZoneId( [System.DateTimeOffset](Get-Date -Date $createdAt), "America/Los_Angeles" );
echo "workflowId: $workflowId";
echo "createdAt: $createdAt ($createdAtPST)";
# Get how many runs of this workflow have happened today
$dateFormat = "yyyy-MM-ddT00:00:00K"
$revRequestUrl = "$apiBaseUrl/workflows/$workflowId/runs?created=$($createdAtPST.ToString($dateFormat))..$($createdAtPST.AddDays(1).ToString($dateFormat))";
$rev = curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" $revRequestUrl | jq .total_count;
$path = "version.txt";
$version = "$((cat $path).Trim())"
$date = $createdAtPST.ToString("yyyyMMdd")
$prereleaseSlug = "${{ inputs.prereleaseSlug }}"
echo "Version from $($path): $version";
echo "Prerelease: $prereleaseSlug";
echo "Date: $date";
echo "Rev: $rev";
echo "checkTagIsUnique: ${{ inputs.checkTagIsUnique }}";
if ($prereleaseSlug) {
$version = "$version-$prereleaseSlug.$date.$rev"
}
echo "Computed version: $version";
try
{
[System.Management.Automation.SemanticVersion]::Parse($version);
}
catch
{
Write-Error "'$version' is an invalid SemVer version"
exit 1
}
if ("${{ inputs.checkTagIsUnique }}" -eq "true") {
if (git tag -l "$version") {
Write-Error "Tag $version already exists.";
exit 1;
}
}
echo "COALESCE_VERSION=$version" >> $env:GITHUB_OUTPUT
echo "# Version $version" >> $env:GITHUB_STEP_SUMMARY
build-dotnet:
needs: meta
runs-on: ubuntu-latest

env:
COALESCE_VERSION: ${{needs.meta.outputs.COALESCE_VERSION}}
COALESCE_VERSION: ${{inputs.COALESCE_VERSION}}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup dotnet
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
include-prerelease: true
- run: npm ci
working-directory: src/coalesce-vue
Expand All @@ -105,28 +28,25 @@ jobs:
- run: dotnet pack --no-build --configuration Release -p:PackageOutputPath="$(pwd)/out/packages"

- name: 'Upload Artifact: NuGet Packages'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: packages
path: out/packages


validate-vue2-playground:
needs: meta
runs-on: ubuntu-latest
defaults:
run:
working-directory: playground/Coalesce.Web.Vue2

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-dotnet@v2
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
include-prerelease: true
- run: npm ci
working-directory: src/coalesce-vue
Expand All @@ -139,20 +59,18 @@ jobs:


validate-vue3-playground:
needs: meta
runs-on: ubuntu-latest
defaults:
run:
working-directory: playground/Coalesce.Web.Vue3

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-dotnet@v2
- uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
include-prerelease: true
- run: npm ci
working-directory: src/coalesce-vue
Expand All @@ -166,17 +84,16 @@ jobs:


build-coalesce-vue:
needs: meta
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/coalesce-vue

env:
COALESCE_VERSION: ${{needs.meta.outputs.COALESCE_VERSION}}
COALESCE_VERSION: ${{inputs.COALESCE_VERSION}}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- run: npm ci

Expand Down Expand Up @@ -213,24 +130,23 @@ jobs:
- run: npm pack

- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coalesce-vue
path: src/coalesce-vue/coalesce-vue*.tgz


build-coalesce-vue-vuetify2:
needs: meta
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/coalesce-vue-vuetify2

env:
COALESCE_VERSION: ${{needs.meta.outputs.COALESCE_VERSION}}
COALESCE_VERSION: ${{inputs.COALESCE_VERSION}}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# build coalesce-vue
- run: npm run build-local-deps
Expand All @@ -249,24 +165,23 @@ jobs:
- run: npm pack

- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coalesce-vue-vuetify
name: coalesce-vue-vuetify2
path: src/coalesce-vue-vuetify2/*.tgz


build-coalesce-vue-vuetify3:
needs: meta
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/coalesce-vue-vuetify3

env:
COALESCE_VERSION: ${{needs.meta.outputs.COALESCE_VERSION}}
COALESCE_VERSION: ${{inputs.COALESCE_VERSION}}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

# build coalesce-vue
- run: npm run build-local-deps
Expand All @@ -286,7 +201,71 @@ jobs:
- run: npm pack

- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coalesce-vue-vuetify
path: src/coalesce-vue-vuetify3/*.tgz
name: coalesce-vue-vuetify3
path: src/coalesce-vue-vuetify3/*.tgz

validate-template:
runs-on: ubuntu-latest
name: "test template: ${{matrix.testCase}}"
needs: [build-coalesce-vue, build-coalesce-vue-vuetify3, build-dotnet]
strategy:
matrix:
testCase:
# Nothing:
- ""
# Everything:
- "--Identity --MicrosoftAuth --GoogleAuth --UserPictures --AuditLogs --ExampleModel --DarkMode --TrackingBase --AppInsights --OpenAPI"
# Assorted partial variants:
- "--Identity --UserPictures --TrackingBase"
- "--Identity --MicrosoftAuth --AuditLogs"

defaults:
run:
shell: pwsh
working-directory: ./templates/Coalesce.Vue.Template

env:
COALESCE_VERSION: ${{inputs.COALESCE_VERSION}}

steps:
- uses: actions/checkout@v4

- name: Setup dotnet
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}/artifacts

- name: Add local nuget source
run: |
dotnet nuget add source "${{ github.workspace }}/artifacts/packages" --name "local-nuget"
- name: "Set dependency versions"
run: |
$ErrorActionPreference = "Stop"
$PSNativeCommandUseErrorActionPreference = $true
echo $env:COALESCE_VERSION
ls ${{ github.workspace }}/artifacts
$filePath = "./content/Directory.Build.props"
$newVersion = "<CoalesceVersion>$env:COALESCE_VERSION</CoalesceVersion>"
(Get-Content $filePath) -replace '<CoalesceVersion>.*?<\/CoalesceVersion>', $newVersion | Set-Content $filePath
cat $filePath
cd ./content/*.Web
npm i $(Get-ChildItem -Path "${{ github.workspace }}/artifacts/coalesce-vue*.tgz").FullName --save
npm i $(Get-ChildItem -Path "${{ github.workspace }}/artifacts/coalesce-vue-vue3*.tgz").FullName --save
cat package.json
- name: TestLocal
run: ./TestLocal.ps1 "${{ matrix.testCase }}"
Loading

0 comments on commit ccf2119

Please sign in to comment.