Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ initial WIP implementation #1

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build & test

on:
workflow_dispatch:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read

outputs:
changed: ${{ steps.filter.outputs.changed }}

steps:
- uses: actions/checkout@v3
- name: 🔎 checking for changes
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
changed:
- 'src/Spillgebees.Blazor.RichTextEditor/**'
- 'src/Spillgebees.Blazor.RichTextEditor.Samples/**'
- 'src/Spillgebees.Blazor.RichTextEditor.Tests/**'

build-and-test:
name: build-and-test
needs: changes
uses: ./.github/workflows/build-test-publish.yml
with:
should-run: ${{ needs.changes.outputs.changed == 'true' }}
50 changes: 50 additions & 0 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build, test, & publish

on:
workflow_call:
inputs:
should-package:
type: boolean
description: Whether to package project and upload as artifact.
default: false
should-run:
type: boolean
description: Whether to run the job.
default: true

jobs:
build-test-publish:
name: build-test-publish
if: inputs.should-run
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: 📦 setup .NET
uses: actions/setup-dotnet@v3

- name: ⚙️ restore workloads
run: dotnet workload restore Spillgebees.Blazor.RichTextEditor.sln

- name: 📦 restore packages
run: dotnet restore Spillgebees.Blazor.RichTextEditor.sln

- name: 👷 build project
run: dotnet build --configuration Release --no-restore Spillgebees.Blazor.RichTextEditor.sln

- name: ✅ test project
run: dotnet test --configuration Release --no-build --verbosity normal Spillgebees.Blazor.RichTextEditor.sln

- name: 📦 package the application
if: inputs.should-package
run: dotnet pack src/Spillgebees.Blazor.RichTextEditor/Spillgebees.Blazor.RichTextEditor.csproj --configuration Release --no-build --output .

- name: 🔃 upload artifacts
if: inputs.should-package
uses: actions/upload-artifact@v3
with:
name: artifacts
if-no-files-found: error
retention-days: 1
path: ./*.nupkg
50 changes: 50 additions & 0 deletions .github/workflows/node-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Node test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read

outputs:
changed: ${{ steps.filter.outputs.changed }}

steps:
- uses: actions/checkout@v3
- name: 🔎 checking for changes
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
changed:
- 'src/Spillgebees.Blazor.RichTextEditor.JS.Tests/**'

node-test:
runs-on: ubuntu-latest

defaults:
run:
working-directory: src/Spillgebees.Blazor.RichTextEditor.JS.Tests

needs: changes
if: ${{ needs.changes.outputs.changed == 'true' }}

steps:
- uses: actions/checkout@v3

- name: 📦 setup node
uses: actions/setup-node@v3
with:
node-version: 19.x

- name: ⚙️ restore dependencies
run: npm install

- name: ✅ test project
run: npm test
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Publish nuget package

on:
release:
types: [ published ]

jobs:
build-and-test:
name: build-and-test
uses: ./.github/workflows/build-test-publish.yml
with:
should-package: true

publish:
name: publish
needs: [ build-and-test ]
runs-on: ubuntu-latest

steps:
- name: 🔃 download artifacts
uses: actions/download-artifact@v3
with:
name: artifacts
path: .

- name: 📦 setup .NET
uses: actions/setup-dotnet@v3

- name: 🚀 publish nuget packages
run: dotnet nuget push "*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
Loading