Skip to content

Commit 67d53d5

Browse files
committed
Improved workflows for reuse
1 parent 8fbde93 commit 67d53d5

2 files changed

Lines changed: 77 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ on:
55
tags:
66
- 'v*' # Triggers on v1.0, v2.1.5, etc.
77

8+
# --- DEFINED HERE FOR REUSABILITY ---
9+
env:
10+
PROJECT_NAME: OutSystems.YAML2JSON
11+
PRODUCT_NAME: YAML2JSON
12+
# ------------------------------------
13+
814
jobs:
915
release:
1016
runs-on: ubuntu-latest
@@ -26,18 +32,18 @@ jobs:
2632

2733
- name: Publish App
2834
# We publish to a local 'publish' folder
29-
run: dotnet publish OutSystems.YAML2JSON/OutSystems.YAML2JSON.csproj -c Release -r linux-x64 --self-contained false -o ./publish
35+
run: dotnet publish ${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}.csproj -c Release -r linux-x64 --self-contained false -o ./publish
3036

3137
- name: Create Versioned Zip
3238
run: |
3339
cd ./publish
34-
zip -r ../YAML2JSON_${{ steps.get_version.outputs.VERSION }}.zip .
40+
zip -r ../${{ env.PRODUCT_NAME }}_${{ steps.get_version.outputs.VERSION }}.zip .
3541
cd ..
3642
3743
- name: Create GitHub Release
3844
uses: softprops/action-gh-release@v2
3945
with:
40-
files: YAML2JSON_${{ steps.get_version.outputs.VERSION }}.zip
46+
files: ${{ env.PRODUCT_NAME }}_${{ steps.get_version.outputs.VERSION }}.zip
4147
name: Release ${{ steps.get_version.outputs.VERSION }}
4248
draft: false
4349
prerelease: false

.github/workflows/test.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: CI - Run Tests
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
workflow_dispatch:
9+
10+
# --- DEFINED HERE FOR REUSABILITY ---
11+
env:
12+
PROJECT_NAME: OutSystems.YAML2JSON
13+
PRODUCT_NAME: YAML2JSON
14+
# ------------------------------------
15+
16+
jobs:
17+
test:
18+
name: Unit Tests
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout Code
23+
uses: actions/checkout@v4
24+
25+
- name: Setup .NET
26+
uses: actions/setup-dotnet@v4
27+
with:
28+
dotnet-version: '8.0.x'
29+
30+
- name: Restore dependencies
31+
# Uses the variable to build the path
32+
run: dotnet restore ${{ env.PROJECT_NAME }}.UnitTests/${{ env.PROJECT_NAME }}.UnitTests.csproj
33+
34+
- name: Run Tests
35+
# Uses the variable in the test command
36+
run: |
37+
dotnet test ${{ env.PROJECT_NAME }}.UnitTests/${{ env.PROJECT_NAME }}.UnitTests.csproj \
38+
--configuration Release \
39+
--no-restore \
40+
--nologo \
41+
--collect:"XPlat Code Coverage" \
42+
--results-directory ./coverage
43+
44+
- name: Report Code Coverage
45+
uses: irongut/CodeCoverageSummary@v1.3.0
46+
with:
47+
filename: coverage/**/coverage.cobertura.xml
48+
badge: true
49+
fail_below_min: false
50+
format: markdown
51+
output: both
52+
53+
- name: Write Summary
54+
run: cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY
55+
56+
- name: Upload coverage to Codecov
57+
uses: codecov/codecov-action@v5
58+
with:
59+
token: ${{ secrets.CODECOV_TOKEN }}
60+
directory: ./coverage
61+
fail_ci_if_error: true
62+
# OPTION A: If your Repo name matches the Codecov slug exactly,
63+
# you can often remove 'slug' entirely or use:
64+
# slug: ${{ github.repository }}
65+
66+
# OPTION B: If the slug is different, you can construct it:
67+
# (Assuming your repos are always named OutSystems.Extension.Name)
68+
slug: Redeagle48/OutSystems.Extension.${{ env.PROJECT_NAME }}

0 commit comments

Comments
 (0)