Skip to content

Commit 7747d1d

Browse files
committed
workflows
1 parent b15f6b1 commit 7747d1d

10 files changed

Lines changed: 185 additions & 61 deletions

File tree

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Short description about this PR
44

55
# Tasks done in this PR
66
* [ ] Something awesome.
7-
* [ ] An evil bug have been defeted.
7+
* [ ] An evil bug have been defeated.
88
* [ ] Code cleanup and maintenance has been done.
99

1010
# Related Issues / Pull Requests

.github/workflows/auto-version.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Auto Version
2+
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
7+
permissions:
8+
contents: write
9+
10+
env:
11+
CURRENT_BRANCH: ${{github.event.pull_request.head.ref}}
12+
VERSION_FORMAT: ${{ fromJSON('[ "*.^.0", "*.*.^"]')[contains(github.event.pull_request.labels.*.name, 'minor')] }}
13+
14+
jobs:
15+
update:
16+
if: contains(github.event.pull_request.labels.*.name, 'minor') || contains(github.event.pull_request.labels.*.name, 'major')
17+
runs-on: windows-latest
18+
name: Update version
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
with:
23+
submodules: true
24+
ref: ${{env.CURRENT_BRANCH}}
25+
- name: Update version
26+
id: update
27+
uses: vers-one/dotnet-project-version-updater@v1.7
28+
with:
29+
file: ./src/ACadSharp/ACadSharp.csproj
30+
version: ${{env.VERSION_FORMAT}}
31+
- name: Push changes
32+
run: ./push-changes.sh
33+
shell: bash
34+
env:
35+
VERSION: ${{steps.update.outputs.newVersion}}
36+
BRANCH: ${{env.CURRENT_BRANCH}}

.github/workflows/build.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/build_n_test.yml

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/coveralls.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Coveralls
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
coveralls:
11+
runs-on: windows-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
submodules: true
16+
- uses: cardinalby/export-env-action@v2
17+
with:
18+
envFile: 'github.env'
19+
- name: Build and Test MeshIO
20+
working-directory: src
21+
run: |
22+
dotnet restore
23+
dotnet build --no-restore
24+
dotnet test -p:CollectCoverage=true -p:CoverletOutput=TestResults/ -p:CoverletOutputFormat=lcov --no-restore --no-build --framework net9.0 --verbosity normal MeshIO.Tests/
25+
- name: Build and Test Submodules
26+
working-directory: src/CSUtilities
27+
run: |
28+
dotnet restore
29+
dotnet build --no-restore
30+
dotnet test -p:CollectCoverage=true -p:CoverletOutput=TestResults/ -p:CoverletOutputFormat=lcov --no-restore --no-build --framework net9.0 --verbosity normal CSUtilities.Tests/
31+
dotnet test -p:CollectCoverage=true -p:CoverletOutput=TestResults/ -p:CoverletOutputFormat=lcov --no-restore --no-build --framework net9.0 --verbosity normal CSMath.Tests/
32+
- name: Coveralls action
33+
uses: coverallsapp/github-action@v2
34+
with:
35+
github-token: ${{ github.token }}
36+
files: src/MeshIO.Tests/TestResults/coverage.net9.0.info src/CSUtilities/CSUtilities.Tests/TestResults/coverage.info src/CSUtilities/CSMath.Tests/TestResults/coverage.info

.github/workflows/csharp.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: CSharp
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
defaults:
10+
run:
11+
working-directory: ./src
12+
13+
jobs:
14+
build:
15+
name: Build
16+
runs-on: windows-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
with:
20+
submodules: true
21+
- uses: cardinalby/export-env-action@v2
22+
with:
23+
envFile: 'github.env'
24+
- name: Install dependencies
25+
run: dotnet restore
26+
- name: Build
27+
run: dotnet build --no-restore
28+
29+
testDotNet:
30+
name: Test Dotnet
31+
runs-on: windows-latest
32+
needs: build
33+
steps:
34+
- uses: actions/checkout@v4
35+
with:
36+
submodules: true
37+
- uses: cardinalby/export-env-action@v2
38+
with:
39+
envFile: 'github.env'
40+
- name: Install dependencies
41+
run: dotnet restore
42+
- name: Build
43+
run: dotnet build --no-restore
44+
- name: Test with the dotnet CLI
45+
run: dotnet test --no-build --no-restore --framework net9.0
46+
47+
testFramework:
48+
name: Test net Framework
49+
runs-on: windows-latest
50+
needs: build
51+
steps:
52+
- uses: actions/checkout@v4
53+
with:
54+
submodules: true
55+
- uses: cardinalby/export-env-action@v2
56+
with:
57+
envFile: 'github.env'
58+
- name: Install dependencies
59+
run: dotnet restore
60+
- name: Build
61+
run: dotnet build --no-restore
62+
- name: Test with the dotnet CLI
63+
run: dotnet test --no-build --no-restore --framework net48

.github/workflows/publish.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Publish NuGet package
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
branches: [ master ]
7+
8+
jobs:
9+
build:
10+
runs-on: windows-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
with:
14+
submodules: true
15+
fetch-depth: 0
16+
- name: Publish NuGet package
17+
working-directory: src
18+
run: |
19+
git submodule update --force --recursive --init --remote
20+
dotnet restore
21+
dotnet build --configuration Release
22+
dotnet pack ./MeshIO/MeshIO.csproj --configuration Release
23+
foreach($file in (Get-ChildItem ./nupkg -Recurse -Include *.nupkg)) {
24+
dotnet nuget push $file --api-key "${{ secrets.NUGET_API_KEY }}" --source https://api.nuget.org/v3/index.json --skip-duplicate
25+
}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# MeshIO ![Build](https://github.com/DomCr/MeshIO/actions/workflows/build_n_test.yml/badge.svg) ![License](https://img.shields.io/github/license/DomCr/ACadSharp) ![nuget](https://img.shields.io/nuget/v/MeshIO)
1+
# MeshIO ![Build](https://github.com/DomCr/MeshIO/actions/workflows/csharp.yml/badge.svg) ![License](https://img.shields.io/github/license/DomCr/MeshIO) ![nuget](https://img.shields.io/nuget/v/MeshIO)
22

33
C# modular library to read/write and modify different 3D formats.
44

github.env

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SAMPLES_FOLDER: "../../../../../samples"
2+
LOCAL_ENV: "false"
3+
DELTA: "0.00001"
4+
DECIMAL_PRECISION: "5"
5+
SAVE_OUTPUT_IN_STREAM: "true"
6+
SAVE_PREVIEW: "false"
7+
SELF_CHECK_OUTPUT: "false"

push-changes.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
echo Prepare commit
2+
#Get commit details
3+
author=`git log -1 --format="%an"`
4+
email=`git log -1 --format="%ae"`
5+
6+
git config --local user.email "$email"
7+
git config --local user.name "$author"
8+
git add .
9+
if git diff-index --quiet HEAD; then
10+
echo "Nothing changed"
11+
exit 0
12+
fi
13+
14+
echo "Pushing changes $BRANCH"
15+
git commit -m "Update project version to $VERSION"
16+
git push origin $BRANCH

0 commit comments

Comments
 (0)