From 81208c0f03f7fa1d7b648cc854acb461a0311550 Mon Sep 17 00:00:00 2001 From: Serge Camille Date: Sun, 13 Sep 2020 10:02:16 +0200 Subject: [PATCH] Add github actions for multi-platform unit tests. --- .github/workflows/deploy.yml | 43 +++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 47 ++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 .github/workflows/deploy.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..ae11e7a --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,43 @@ +name: Deploy + +on: + release: + types: release + +jobs: + deploy: + name: Deploy + needs: build_test + runs-on: windows-latest + if: ${{ false }} # not active right now + + steps: + - uses: actions/checkout@v2 + + - name: Fetch all history for all tags and branches + run: git fetch --prune --unshallow + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0.9.2 + with: + versionSpec: '5.2.x' + + - name: Use GitVersion + id: gitversion # step id used as reference for output values + uses: gittools/actions/gitversion/execute@v0.9.2 + + - name: Setup Dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '3.1.x' # SDK Version to use; x will use the latest version of the 3.1 channel + + - name: Pack + if: ${{ matrix.pack }} + run: dotnet pack --configuration "${{ env.configuration }}" /p:Version="${{ steps.gitversion.outputs.nuGetVersion }}" -o "${{ env.artifacts }}" + + - name: Upload Artifacts + if: ${{ matrix.pack }} + uses: actions/upload-artifact@v2 + with: + name: NugetPackage + path: ${{ env.artifacts }}/** diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..ad8397a --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,47 @@ +name: Test + +on: + [pull_request, push] + +jobs: + + build_test: + name: test-${{ matrix.os }}-${{ matrix.test-framework }} + runs-on: ${{ matrix.os }} + env: + configuration: Release + artifacts: ${{ github.workspace }}/artifacts + strategy: + matrix: + os: [windows-latest, ubuntu-latest, macos-latest] + test-framework: [netcoreapp3.1] + include: + - os: ubuntu-latest + installSnap7: true + - os: macos-latest + installSnap7: true + - os: windows-latest + test-framework: net452 + + steps: + - uses: actions/checkout@v2 + + - name: Install Snap7 Linux + if: ${{ matrix.installSnap7 && matrix.os == 'ubuntu-latest' }} + run: | + sudo add-apt-repository ppa:gijzelaar/snap7 + sudo apt-get update + sudo apt-get install libsnap7-1 libsnap7-dev + + - name: Install Snap7 MacOs + if: ${{ matrix.installSnap7 && matrix.os == 'macos-latest' }} + run: | + brew install snap7 + + - name: Setup Dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: '3.1.x' # SDK Version to use; x will use the latest version of the 3.1 channel + + - name: Test + run: dotnet test --verbosity normal --logger GitHubActions --framework ${{ matrix.test-framework }} \ No newline at end of file