Skip to content

Merge pull request #35 from dogged/ethomson/libgit2_v18 #143

Merge pull request #35 from dogged/ethomson/libgit2_v18

Merge pull request #35 from dogged/ethomson/libgit2_v18 #143

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ published ]
workflow_dispatch:
jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
name: 'Check out source'
with:
fetch-depth: 0
- run: |
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
SHA=$(git rev-parse --short HEAD)
VERSION="$(git describe --tags | \
sed -e "s/^v//" | \
sed -e "s/-g[0-9a-f]*$//" | \
sed -e "s/-[0-9]*$//")-pr${{ github.event.number }}-${SHA}"
else
VERSION=$(git describe --tags | \
sed -e "s/^v//" | \
sed -e "s/-g[0-9a-f]*$//" | \
sed -e "s/-\([0-9]*\)$/\.\1/")
fi
echo "Building version ${VERSION}"
echo "VERSION=${VERSION}" >> ${GITHUB_ENV}
shell: bash
name: 'Update Version'
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x'
name: 'Setup .NET Core 3.1'
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
name: 'Setup .NET 6.0'
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
name: 'Setup .NET 7.0'
- run: |
dotnet restore
dotnet build --no-restore --configuration Release "-p:PackageVersion=${{ env.VERSION }}"
shell: bash
name: Build
- run: |
set +e
dotnet test Dogged.Tests/Dogged.Tests.csproj --no-build --configuration Release --logger "trx;LogFileName=Dogged.Tests.trx"
ret=$(($ret + $?))
dotnet test Dogged.Native.Tests/Dogged.Native.Tests.csproj --no-build --configuration Release --logger "trx;LogFileName=Dogged.Native.Tests.trx"
ret=$(($ret + $?))
exit $ret
shell: bash
name: Test
- run: |
mkdir ${{ github.workspace }}\package
dotnet pack Dogged.Native/Dogged.Native.csproj --no-build -c Release --output "${{ github.workspace }}\package" "-p:Version=${{ env.VERSION }}" "-p:PackageVersion=${{ env.VERSION }}"
dotnet pack Dogged/Dogged.csproj --no-build -c Release --output "${{ github.workspace }}\package" "-p:Version=${{ env.VERSION }}" "-p:PackageVersion=${{ env.VERSION }}"
shell: pwsh
name: Package
if: matrix.os == 'windows-latest'
- uses: actions/upload-artifact@v3
with:
name: Dogged-${{ env.VERSION }}.nupkg
path: ${{ github.workspace }}/package/Dogged.${{ env.VERSION }}.nupkg
if: matrix.os == 'windows-latest'
name: 'Upload Dogged Package'
- uses: actions/upload-artifact@v3
with:
name: Dogged.Native-${{ env.VERSION }}.nupkg
path: ${{ github.workspace }}/package/Dogged.Native.${{ env.VERSION }}.nupkg
if: matrix.os == 'windows-latest'
name: 'Upload Dogged.Native Package'
documentation:
runs-on: windows-latest
steps:
- name: 'Check out source'
uses: actions/checkout@v3
# Check out the `docs` branch into the `Documentation/_site` directory
- name: 'Check out documentation branch'
uses: actions/checkout@v3
with:
ref: 'docs'
path: 'Documentation/_site'
- name: 'Install DocFX'
run: choco install docfx
- name: 'Generate documentation'
run: docfx
working-directory: Documentation
- name: 'Upload documentation'
uses: actions/upload-artifact@v3
with:
name: docs
path: ${{ github.workspace }}/Documentation/_site
# Check for changes; this avoids publishing a new change to the
# dist branch when we made a change to (for example) a unit test.
# If there were changes made in the publish step above, then this
# will set the variable `has_changes` to `1` for subsequent steps.
- name: Check for changes
id: status
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "has_changes=1" >> $GITHUB_OUTPUT
fi
shell: bash
working-directory: Documentation/_site
if: github.event_name == 'push'
# Commit the changes to the dist branch and push the changes up to
# GitHub. (Replace the name and email address with your own.)
# This step only runs if the previous step set `has_changes` to `1`.
- name: Publish documentation
run: |
git add --verbose .
git config user.name 'CI User'
git config user.email 'noreply@dogged.app'
git commit -m 'Update from CI'
git push origin docs
if: steps.status.outputs.has_changes == '1'
working-directory: Documentation/_site