-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from PinguApps/8-setup-cicd
8 setup cicd
- Loading branch information
Showing
25 changed files
with
381 additions
and
26 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name-template: "v$RESOLVED_VERSION" | ||
tag-template: "v$RESOLVED_VERSION" | ||
change-template: "- [#$NUMBER] $TITLE - Thanks to @$AUTHOR!" | ||
exclude-labels: | ||
- automated | ||
categories: | ||
- title: "🚀 Features" | ||
labels: | ||
- "feature" | ||
- "enhancement" | ||
- title: "🐛 Bug Fixes" | ||
labels: | ||
- "bug" | ||
- "fix" | ||
- title: "📄 Documentation" | ||
labels: | ||
- "docs" | ||
- "documentation" | ||
version-resolver: | ||
major: | ||
labels: | ||
- 'major' | ||
minor: | ||
labels: | ||
- 'minor' | ||
patch: | ||
labels: | ||
- 'patch' | ||
default: patch | ||
template: | | ||
## Changes | ||
$CHANGES |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: Workflow Test | ||
|
||
on: | ||
workflow_call: | ||
|
||
env: | ||
DOTNET_VERSION: '8.0' | ||
|
||
jobs: | ||
build: | ||
name: Build & Test | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
contents: read | ||
issues: read | ||
checks: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
||
- name: Nuget Cache | ||
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | ||
with: | ||
path: ~/.nuget/packages | ||
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | ||
restore-keys: | | ||
${{ runner.os }}-nuget- | ||
- name: Restore | ||
run: dotnet restore | ||
|
||
- name: Build | ||
run: dotnet build -c Release --no-restore | ||
|
||
- name: Test | ||
run: dotnet test -c Release --no-build --verbosity normal --logger trx --collect:"XPlat Code Coverage" | ||
|
||
- name: Combine Coverage Reports | ||
uses: danielpalme/ReportGenerator-GitHub-Action@4924a48df5dbcdfbcbaef0cc1ad7d65d5aade7dd # 5.3.6 | ||
with: | ||
reports: "**/*.cobertura.xml" | ||
targetdir: "${{ github.workspace }}" | ||
reporttypes: "Cobertura" | ||
verbosity: "Info" | ||
title: "Code Coverage" | ||
tag: "${{ github.run_number }}_${{ github.run_id }}" | ||
customSettings: "" | ||
toolpath: "reportgeneratortool" | ||
|
||
- name: Upload Combined Coverage XML | ||
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4 | ||
with: | ||
name: coverage | ||
path: ${{ github.workspace }}/Cobertura.xml | ||
retention-days: 5 | ||
|
||
- name: Publish Code Coverage Report | ||
uses: irongut/CodeCoverageSummary@51cc3a756ddcd398d447c044c02cb6aa83fdae95 # v1.3.0 | ||
with: | ||
filename: "Cobertura.xml" | ||
badge: true | ||
fail_below_min: false | ||
format: markdown | ||
hide_branch_rate: false | ||
hide_complexity: false | ||
indicators: true | ||
output: both | ||
thresholds: "10 30" | ||
|
||
- name: Add Coverage PR Comment | ||
uses: marocchino/sticky-pull-request-comment@331f8f5b4215f0445d3c07b4967662a32a2d3e31 # v2 | ||
if: github.event_name == 'pull_request' | ||
with: | ||
recreate: true | ||
path: code-coverage-results.md | ||
|
||
- name: Upload Test Result Files | ||
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4 | ||
with: | ||
name: test-results | ||
path: ${{ github.workspace }}/**/TestResults/**/* | ||
retention-days: 5 | ||
|
||
- name: Publish Test Results | ||
uses: EnricoMi/publish-unit-test-result-action@30eadd5010312f995f0d3b3cff7fe2984f69409e # v2.16.1 | ||
if: always() | ||
with: | ||
trx_files: "${{ github.workspace }}/**/*.trx" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Dev | ||
|
||
on: | ||
push: | ||
branches: [ dev ] | ||
release: | ||
types: [ published ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
name: Build & Test | ||
uses: ./.github/workflows/_test.yml | ||
secrets: inherit | ||
permissions: | ||
pull-requests: write | ||
contents: read | ||
issues: read | ||
checks: write | ||
|
||
release: | ||
name: Push to main | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: github.event_name == 'release' | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | ||
with: | ||
ref: dev | ||
|
||
- name: Get Release Version | ||
id: releaseVersion | ||
run: | | ||
arrTag=(${GITHUB_REF//\// }) | ||
VERSION="${arrTag[2]}" | ||
echo Version: $VERSION | ||
VERSION="${VERSION:1}" | ||
echo Clean Version: $VERSION | ||
echo "version=$VERSION" >> ${GITHUB_OUTPUT} | ||
- name: Create Pull Request | ||
id: cpr | ||
env: | ||
GH_TOKEN: ${{ secrets.PAT }} | ||
run: | | ||
git fetch origin main | ||
pr_number=$(gh pr create --base main --head dev --assignee pingu2k4 --fill --label automated --label release --title "Merge v${{ steps.releaseVersion.outputs.version }}" | grep -o 'https://github.com/[^/]\+/[^/]\+/pull/\([0-9]\+\)' | awk -F '/' '{print $NF}') | ||
echo PR Number: $pr_number | ||
echo "prNumber=$pr_number" >> ${GITHUB_OUTPUT} | ||
- name: Merge Pull Request | ||
if: ${{ steps.cpr.outputs.prNumber }} | ||
env: | ||
GH_TOKEN: ${{ secrets.PAT }} | ||
run: | | ||
gh pr merge ${{ steps.cpr.outputs.prNumber }} --auto --merge |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Main | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
env: | ||
CLIENT_PROJECT_NAME: PinguApps.Appwrite.Client | ||
SERVER_PROJECT_NAME: PinguApps.Appwrite.Server | ||
DOTNET_VERSION: '8.0' | ||
NUGET_FEED: https://api.nuget.org/v3/index.json | ||
NUGET_KEY: ${{ secrets.NUGET_KEY }} | ||
|
||
jobs: | ||
build: | ||
name: Build & Test | ||
uses: ./.github/workflows/_test.yml | ||
secrets: inherit | ||
permissions: | ||
pull-requests: write | ||
contents: read | ||
issues: read | ||
checks: write | ||
|
||
push-nugets: | ||
needs: build | ||
name: Push Nuget's | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: read | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@4d6c8fcf3c8f7a60068d26b594648e99df24cee3 # v4 | ||
with: | ||
dotnet-version: ${{ env.DOTNET_VERSION }} | ||
|
||
- name: Get PR title | ||
id: pr-title | ||
env: | ||
GH_TOKEN: ${{ secrets.PAT }} | ||
run: | | ||
PR_NUMBER=$(gh pr list --base main --state merged --limit 1 --json number --jq '.[0].number') | ||
echo "PR Number: ${PR_NUMBER}" | ||
PR_TITLE=$(gh pr view $PR_NUMBER --json title --jq '.title') | ||
echo "PR Title: ${PR_TITLE}" | ||
echo "PR_TITLE=${PR_TITLE}" >> $GITHUB_ENV | ||
- name: Extract version from PR title | ||
id: extract-version | ||
run: | | ||
VERSION=$(echo "${PR_TITLE}" | grep -oP 'v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?') | ||
echo "Version: ${VERSION}" | ||
VERSION_WITHOUT_V=${VERSION#v} | ||
echo "Version -v: ${VERSION_WITHOUT_V}" | ||
echo "VERSION=${VERSION_WITHOUT_V}" >> $GITHUB_ENV | ||
- name: Create Nuget Packages | ||
run: | | ||
dotnet pack -c Release --verbosity normal --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$CLIENT_PROJECT_NAME/$CLIENT_PROJECT_NAME.csproj | ||
dotnet pack -c Release --verbosity normal --include-symbols --include-source -p:PackageVersion=$VERSION -o nupkg src/$SERVER_PROJECT_NAME/$SERVER_PROJECT_NAME.csproj | ||
- name: Push to NuGet Feed | ||
run: dotnet nuget push ./nupkg/*.{nupkg,snupkg} --source $NUGET_FEED --api-key $NUGET_KEY --skip-duplicate | ||
|
||
sync: | ||
name: Sync back to dev | ||
runs-on: ubuntu-latest | ||
needs: build | ||
if: github.event_name == 'push' | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4 | ||
with: | ||
ref: main | ||
|
||
- name: Create Pull Request | ||
id: cpr | ||
env: | ||
GH_TOKEN: ${{ secrets.PAT }} | ||
run: | | ||
git fetch origin dev | ||
pr_number=$(gh pr create --base dev --head main --assignee pingu2k4 --fill --label automated --label sync | grep -o 'https://github.com/[^/]\+/[^/]\+/pull/\([0-9]\+\)' | awk -F '/' '{print $NF}') | ||
echo PR Number: $pr_number | ||
echo "prNumber=$pr_number" >> ${GITHUB_OUTPUT} | ||
- name: Merge Pull Request | ||
if: ${{ steps.cpr.outputs.prNumber }} | ||
env: | ||
GH_TOKEN: ${{ secrets.PAT }} | ||
run: | | ||
gh pr merge ${{ steps.cpr.outputs.prNumber }} --auto --merge |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: PR | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
build: | ||
name: Build & Test | ||
uses: ./.github/workflows/_test.yml | ||
secrets: inherit | ||
permissions: | ||
pull-requests: write | ||
contents: read | ||
issues: read | ||
checks: write |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Release Drafter | ||
|
||
on: | ||
push: | ||
branches: [ dev ] | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
update_release_draft: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: release-drafter/release-drafter@3f0f87098bd6b5c5b9a36d49c41d998ea58f9348 # v6 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.