diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 1caa509..8786119 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -17,26 +17,10 @@ on: - '.github/**' jobs: - test-linux: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.x.x - - name: test - working-directory: ./ - run: dotnet test - - test-windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.x.x - - name: test - working-directory: ./ - run: dotnet test \ No newline at end of file + build-and-test: + name: "Build and test" + uses: nfdi4plants/actions-workflows/.github/workflows/build-and-test-solution.yml@main + with: + solution: ./arc-validation-packages.sln + checkout-submodules: true + configuration: Release \ No newline at end of file diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a24530f --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ArcPrototype"] + path = tests/fixtures/ArcPrototype + url = https://git.nfdi4plants.org/muehlhaus/ArcPrototype.git diff --git a/ValidationPackages.sln b/arc-validation-packages.sln similarity index 100% rename from ValidationPackages.sln rename to arc-validation-packages.sln diff --git a/tests/GitSubmodulesTests.fs b/tests/GitSubmodulesTests.fs new file mode 100644 index 0000000..5419e71 --- /dev/null +++ b/tests/GitSubmodulesTests.fs @@ -0,0 +1,12 @@ +module GitSubmoduleTests + +open System +open System.IO +open Xunit + +[] +let ``ArcPrototype commit hash is correct`` () = + Assert.Equal( + ReferenceObjects.expected_prototype_commit_hash, + TestObjects.prototypeCommitHash + ) diff --git a/tests/ReferenceObjects.fs b/tests/ReferenceObjects.fs new file mode 100644 index 0000000..3f1d193 --- /dev/null +++ b/tests/ReferenceObjects.fs @@ -0,0 +1,5 @@ +module ReferenceObjects + +open System.IO + +let expected_prototype_commit_hash = "2635598d9ea365c7ce545a9f279cca39af3de5df" \ No newline at end of file diff --git a/tests/TestObjects.fs b/tests/TestObjects.fs new file mode 100644 index 0000000..e396cb3 --- /dev/null +++ b/tests/TestObjects.fs @@ -0,0 +1,5 @@ +module TestObjects + +let prototypeCommitHashOutput = TestUtils.getCommitHash "../../../fixtures/ArcPrototype" + +let prototypeCommitHash = prototypeCommitHashOutput.Result.Output.TrimStart().TrimEnd() \ No newline at end of file diff --git a/tests/TestUtils.fs b/tests/TestUtils.fs new file mode 100644 index 0000000..91dc047 --- /dev/null +++ b/tests/TestUtils.fs @@ -0,0 +1,16 @@ +module TestUtils + +open System +open System.IO +open type System.Environment +open Fake.Core + +let runTool (tool: string) (args: string []) (dir:string) = + CreateProcess.fromRawCommand tool args + |> CreateProcess.withWorkingDirectory dir + |> CreateProcess.redirectOutput + |> Proc.run + +let getCommitHash path = + let output = runTool "git" [|"rev-parse"; "HEAD"|] path + output \ No newline at end of file diff --git a/tests/ValidationPackages.Tests.fsproj b/tests/ValidationPackages.Tests.fsproj index d7919f3..a0ed58d 100644 --- a/tests/ValidationPackages.Tests.fsproj +++ b/tests/ValidationPackages.Tests.fsproj @@ -10,11 +10,16 @@ + + + + + diff --git a/tests/fixtures/ArcPrototype b/tests/fixtures/ArcPrototype new file mode 160000 index 0000000..2635598 --- /dev/null +++ b/tests/fixtures/ArcPrototype @@ -0,0 +1 @@ +Subproject commit 2635598d9ea365c7ce545a9f279cca39af3de5df