From 30e7175273ea78a2fcf4ddb4f45cae5890ac5c70 Mon Sep 17 00:00:00 2001 From: DomCR Date: Mon, 5 Aug 2024 12:48:13 +0200 Subject: [PATCH 01/10] test --- .github/workflows/coverage.yml | 33 ++++++++++++++++++++++++++ ACadSharp.Tests/ACadSharp.Tests.csproj | 6 ++++- ACadSharp.Tests/IO/IOTests.cs | 4 ++-- ACadSharp.Tests/IO/LocalSampleTests.cs | 3 +-- ACadSharp.sln | 1 + 5 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000..6af2760c --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,33 @@ +name: Unit Test With Coverage +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.1.301 + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test -p:CollectCoverage=true -p:CoverletOutput=TestResults/ -p:CoverletOutputFormat=opencover --no-build --verbosity normal ACadSharp.Tests/ + - name: Create Test Coverage Badge + uses: simon-k/dotnet-code-coverage-badge@v1.0.0 + id: create_coverage_badge + with: + label: Unit Test Coverage + color: brightgreen + path: ACadSharp.Tests/TestResults/coverage.opencover.xml + gist-filename: code-coverage.json + gist-id: 1234567890abcdef1234567890abcdef + gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }} + - name: Print code coverage + run: echo "Code coverage percentage ${{steps.create_coverage_badge.outputs.percentage}}%" \ No newline at end of file diff --git a/ACadSharp.Tests/ACadSharp.Tests.csproj b/ACadSharp.Tests/ACadSharp.Tests.csproj index 72585c0a..0dad927e 100644 --- a/ACadSharp.Tests/ACadSharp.Tests.csproj +++ b/ACadSharp.Tests/ACadSharp.Tests.csproj @@ -12,10 +12,14 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/ACadSharp.Tests/IO/IOTests.cs b/ACadSharp.Tests/IO/IOTests.cs index 54ab8aa6..11300ebe 100644 --- a/ACadSharp.Tests/IO/IOTests.cs +++ b/ACadSharp.Tests/IO/IOTests.cs @@ -56,7 +56,7 @@ public void DxfToDxf(string test) { CadDocument doc = DxfReader.Read(test); - if(doc.Header.Version < ACadVersion.AC1012) + if (doc.Header.Version < ACadVersion.AC1012) { return; } @@ -66,7 +66,7 @@ public void DxfToDxf(string test) this.writeDxfFile(pathOut, doc); } - [Theory] + [Theory(Skip = "ddd")] [MemberData(nameof(DwgFilePaths))] public void DwgEntitiesToDwgFile(string test) { diff --git a/ACadSharp.Tests/IO/LocalSampleTests.cs b/ACadSharp.Tests/IO/LocalSampleTests.cs index 1a53ed01..bef508f8 100644 --- a/ACadSharp.Tests/IO/LocalSampleTests.cs +++ b/ACadSharp.Tests/IO/LocalSampleTests.cs @@ -50,8 +50,7 @@ public void ReadUserDxf(string test) } } - - [Theory] + [Theory(Skip = "HELLO")] [MemberData(nameof(StressFiles))] public void ReadStressFiles(string test) { diff --git a/ACadSharp.sln b/ACadSharp.sln index b54d7ca0..5760c9c3 100644 --- a/ACadSharp.sln +++ b/ACadSharp.sln @@ -37,6 +37,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{ ProjectSection(SolutionItems) = preProject .github\workflows\build.yml = .github\workflows\build.yml .github\workflows\build_n_test.yml = .github\workflows\build_n_test.yml + .github\workflows\coverage.yml = .github\workflows\coverage.yml publish.yml = publish.yml .github\workflows\wiki-gen.yml = .github\workflows\wiki-gen.yml EndProjectSection From b559306d7fb42e1c8069c80acad449a828992c76 Mon Sep 17 00:00:00 2001 From: DomCR Date: Mon, 5 Aug 2024 12:50:20 +0200 Subject: [PATCH 02/10] submodules --- .github/workflows/coverage.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 6af2760c..7987bfa3 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -9,6 +9,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + with: + submodules: true - name: Setup .NET uses: actions/setup-dotnet@v1 with: From 4242e2feca43fe91612d84c21f12f5c6adbe61e9 Mon Sep 17 00:00:00 2001 From: DomCR Date: Mon, 5 Aug 2024 12:51:55 +0200 Subject: [PATCH 03/10] fix --- .github/workflows/coverage.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 7987bfa3..a7dce305 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -11,14 +11,10 @@ jobs: - uses: actions/checkout@v2 with: submodules: true - - name: Setup .NET - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 3.1.301 - name: Restore dependencies - run: dotnet restore + run: dotnet restore - name: Build - run: dotnet build --no-restore + run: dotnet build --configuration Release --no-restore - name: Test run: dotnet test -p:CollectCoverage=true -p:CoverletOutput=TestResults/ -p:CoverletOutputFormat=opencover --no-build --verbosity normal ACadSharp.Tests/ - name: Create Test Coverage Badge From 9b17ba57c04f3de3089ffdc708f836a7f4e36e49 Mon Sep 17 00:00:00 2001 From: DomCR Date: Mon, 5 Aug 2024 12:53:59 +0200 Subject: [PATCH 04/10] env --- .github/workflows/coverage.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index a7dce305..b30c9585 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,9 +1,20 @@ name: Unit Test With Coverage + on: push: branches: [ master ] pull_request: branches: [ master ] + +env: + SAMPLES_FOLDER: "../../../../samples" + OUTPUT_SAMPLES_FOLDER: "../../../../samples/out" + OUTPUT_SINGLE_CASES_FOLDER: "../../../../samples/out/single_cases" + LOCAL_ENV: "false" + DELTA: "0.00001" + DECIMAL_PRECISION: "5" + RUN_DWG_WRITER_SINGLE_CASES_TEST: "false" + jobs: build: runs-on: ubuntu-latest From ec0d97fd44ecf18f3ea1dd39470d2c038110a5d4 Mon Sep 17 00:00:00 2001 From: DomCR Date: Mon, 5 Aug 2024 12:56:38 +0200 Subject: [PATCH 05/10] debug --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index b30c9585..3a3d1c1b 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -25,7 +25,7 @@ jobs: - name: Restore dependencies run: dotnet restore - name: Build - run: dotnet build --configuration Release --no-restore + run: dotnet build --no-restore - name: Test run: dotnet test -p:CollectCoverage=true -p:CoverletOutput=TestResults/ -p:CoverletOutputFormat=opencover --no-build --verbosity normal ACadSharp.Tests/ - name: Create Test Coverage Badge From d8a709bc1aac66445ef04bb8c7580b4fa53b034e Mon Sep 17 00:00:00 2001 From: DomCR Date: Mon, 5 Aug 2024 13:02:45 +0200 Subject: [PATCH 06/10] ignore CreateFromBulgeTest --- ACadSharp.Tests/Entities/ArcTests.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ACadSharp.Tests/Entities/ArcTests.cs b/ACadSharp.Tests/Entities/ArcTests.cs index 41e28804..13938025 100644 --- a/ACadSharp.Tests/Entities/ArcTests.cs +++ b/ACadSharp.Tests/Entities/ArcTests.cs @@ -10,6 +10,11 @@ public class ArcTests [Fact] public void CreateFromBulgeTest() { + if (!TestVariables.LocalEnv) + { + return; + } + XY start = new XY(1, 0); XY end = new XY(0, 1); // 90 degree bulge From 10a49f5788672d6d2d7c12419c8b7232d6d70bd5 Mon Sep 17 00:00:00 2001 From: DomCR Date: Tue, 6 Aug 2024 16:18:19 +0200 Subject: [PATCH 07/10] coveralls --- .github/workflows/coverage.yml | 2 +- .github/workflows/coveralls.yml | 35 +++++++++++++++++++++++++++++++++ ACadSharp.sln | 2 +- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/coveralls.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3a3d1c1b..ff1c921a 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -37,6 +37,6 @@ jobs: path: ACadSharp.Tests/TestResults/coverage.opencover.xml gist-filename: code-coverage.json gist-id: 1234567890abcdef1234567890abcdef - gist-auth-token: ${{ secrets.GIST_AUTH_TOKEN }} + gist-auth-token: ${{ github.token }} - name: Print code coverage run: echo "Code coverage percentage ${{steps.create_coverage_badge.outputs.percentage}}%" \ No newline at end of file diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml new file mode 100644 index 00000000..2e97596a --- /dev/null +++ b/.github/workflows/coveralls.yml @@ -0,0 +1,35 @@ +name: Unit Test With Coverage + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +env: + SAMPLES_FOLDER: "../../../../samples" + OUTPUT_SAMPLES_FOLDER: "../../../../samples/out" + OUTPUT_SINGLE_CASES_FOLDER: "../../../../samples/out/single_cases" + LOCAL_ENV: "false" + DELTA: "0.00001" + DECIMAL_PRECISION: "5" + RUN_DWG_WRITER_SINGLE_CASES_TEST: "false" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test -p:CollectCoverage=true -p:CoverletOutput=TestResults/ -p:CoverletOutputFormat=lcov --no-build --verbosity normal ACadSharp.Tests/ + - name: Create Test Coverage Badge + uses: coverallsapp/github-action@master + with: + github-token: ${{ github.token }} + path-to-lcov: ACadSharp.Tests/TestResults/coverage.info \ No newline at end of file diff --git a/ACadSharp.sln b/ACadSharp.sln index 5760c9c3..70b880ca 100644 --- a/ACadSharp.sln +++ b/ACadSharp.sln @@ -37,8 +37,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{ ProjectSection(SolutionItems) = preProject .github\workflows\build.yml = .github\workflows\build.yml .github\workflows\build_n_test.yml = .github\workflows\build_n_test.yml - .github\workflows\coverage.yml = .github\workflows\coverage.yml publish.yml = publish.yml + .github\workflows\coveralls.yml = .github\workflows\coveralls.yml .github\workflows\wiki-gen.yml = .github\workflows\wiki-gen.yml EndProjectSection EndProject From 98e965f8532824d76e2d81a73a6c4c090753b420 Mon Sep 17 00:00:00 2001 From: DomCR Date: Tue, 6 Aug 2024 16:22:11 +0200 Subject: [PATCH 08/10] badge --- .github/workflows/coveralls.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml index 2e97596a..cea87d9c 100644 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coveralls.yml @@ -1,4 +1,4 @@ -name: Unit Test With Coverage +name: Coveralls on: push: diff --git a/README.md b/README.md index 08b54094..390e3d58 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -ACadSharp ![Build&Test](https://github.com/DomCr/ACadSharp/actions/workflows/build_n_test.yml/badge.svg) ![License](https://img.shields.io/github/license/DomCr/ACadSharp) ![nuget](https://img.shields.io/nuget/v/Acadsharp) +ACadSharp ![Build&Test](https://github.com/DomCr/ACadSharp/actions/workflows/build_n_test.yml/badge.svg) ![License](https://img.shields.io/github/license/DomCr/ACadSharp) ![nuget](https://img.shields.io/nuget/v/Acadsharp) [![Coverage Status](https://coveralls.io/repos/github/DomCR/ACadSharp/badge.svg?branch=master)](https://coveralls.io/github/DomCR/ACadSharp?branch=master) --- C# library to read/write cad files like dxf/dwg. From 647f9dbb48825b3489453adb0c328252db372356 Mon Sep 17 00:00:00 2001 From: DomCR Date: Tue, 6 Aug 2024 16:27:42 +0200 Subject: [PATCH 09/10] cleanup --- .github/workflows/coverage.yml | 42 -------------------------- .github/workflows/coveralls.yml | 2 +- ACadSharp.Tests/Entities/ArcTests.cs | 5 --- ACadSharp.Tests/IO/IOTests.cs | 2 +- ACadSharp.Tests/IO/LocalSampleTests.cs | 2 +- 5 files changed, 3 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/coverage.yml diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml deleted file mode 100644 index ff1c921a..00000000 --- a/.github/workflows/coverage.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Unit Test With Coverage - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -env: - SAMPLES_FOLDER: "../../../../samples" - OUTPUT_SAMPLES_FOLDER: "../../../../samples/out" - OUTPUT_SINGLE_CASES_FOLDER: "../../../../samples/out/single_cases" - LOCAL_ENV: "false" - DELTA: "0.00001" - DECIMAL_PRECISION: "5" - RUN_DWG_WRITER_SINGLE_CASES_TEST: "false" - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - name: Restore dependencies - run: dotnet restore - - name: Build - run: dotnet build --no-restore - - name: Test - run: dotnet test -p:CollectCoverage=true -p:CoverletOutput=TestResults/ -p:CoverletOutputFormat=opencover --no-build --verbosity normal ACadSharp.Tests/ - - name: Create Test Coverage Badge - uses: simon-k/dotnet-code-coverage-badge@v1.0.0 - id: create_coverage_badge - with: - label: Unit Test Coverage - color: brightgreen - path: ACadSharp.Tests/TestResults/coverage.opencover.xml - gist-filename: code-coverage.json - gist-id: 1234567890abcdef1234567890abcdef - gist-auth-token: ${{ github.token }} - - name: Print code coverage - run: echo "Code coverage percentage ${{steps.create_coverage_badge.outputs.percentage}}%" \ No newline at end of file diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml index cea87d9c..ac4dc1fd 100644 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coveralls.yml @@ -17,7 +17,7 @@ env: jobs: build: - runs-on: ubuntu-latest + runs-on: windows-latest steps: - uses: actions/checkout@v2 with: diff --git a/ACadSharp.Tests/Entities/ArcTests.cs b/ACadSharp.Tests/Entities/ArcTests.cs index 13938025..41e28804 100644 --- a/ACadSharp.Tests/Entities/ArcTests.cs +++ b/ACadSharp.Tests/Entities/ArcTests.cs @@ -10,11 +10,6 @@ public class ArcTests [Fact] public void CreateFromBulgeTest() { - if (!TestVariables.LocalEnv) - { - return; - } - XY start = new XY(1, 0); XY end = new XY(0, 1); // 90 degree bulge diff --git a/ACadSharp.Tests/IO/IOTests.cs b/ACadSharp.Tests/IO/IOTests.cs index 11300ebe..d0215b7a 100644 --- a/ACadSharp.Tests/IO/IOTests.cs +++ b/ACadSharp.Tests/IO/IOTests.cs @@ -66,7 +66,7 @@ public void DxfToDxf(string test) this.writeDxfFile(pathOut, doc); } - [Theory(Skip = "ddd")] + [Theory] [MemberData(nameof(DwgFilePaths))] public void DwgEntitiesToDwgFile(string test) { diff --git a/ACadSharp.Tests/IO/LocalSampleTests.cs b/ACadSharp.Tests/IO/LocalSampleTests.cs index bef508f8..9b13bc3b 100644 --- a/ACadSharp.Tests/IO/LocalSampleTests.cs +++ b/ACadSharp.Tests/IO/LocalSampleTests.cs @@ -50,7 +50,7 @@ public void ReadUserDxf(string test) } } - [Theory(Skip = "HELLO")] + [Theory] [MemberData(nameof(StressFiles))] public void ReadStressFiles(string test) { From 168866ff6be3d54b68984fa94c5faaa9544257f9 Mon Sep 17 00:00:00 2001 From: DomCR Date: Tue, 6 Aug 2024 16:32:30 +0200 Subject: [PATCH 10/10] naming fix --- .github/workflows/coveralls.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coveralls.yml b/.github/workflows/coveralls.yml index ac4dc1fd..6ae3bbd4 100644 --- a/.github/workflows/coveralls.yml +++ b/.github/workflows/coveralls.yml @@ -28,7 +28,7 @@ jobs: run: dotnet build --no-restore - name: Test run: dotnet test -p:CollectCoverage=true -p:CoverletOutput=TestResults/ -p:CoverletOutputFormat=lcov --no-build --verbosity normal ACadSharp.Tests/ - - name: Create Test Coverage Badge + - name: Coveralls action uses: coverallsapp/github-action@master with: github-token: ${{ github.token }}