Skip to content

WIP

WIP #1063

Workflow file for this run

# This is alight weight build and test, suitable for rapid checks of commits on feature branches etc.
name: CI
on:
push: # Trigger on pushes to feature branches for safety before a PR
branches-ignore:
- main # don't run on main (build.yml handles that)
paths-ignore:
- docs/
pull_request:
branches:
- main
paths-ignore:
- docs/
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-code:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET 7
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Restore dependencies
run: dotnet restore -r linux-x64 grate.unittests/grate.unittests.csproj
- name: Build
run: dotnet build --no-self-contained grate.unittests/grate.unittests.csproj -r linux-x64 --no-restore -c release -o bin/bin
- name: Upload built binaries
uses: actions/upload-artifact@v3
with:
name: binaries
# Note the double bin/bin above. If you add more paths here, you should remove one 'bin', as if there's only one folder, the files are added to the zip root instead.
path: |
bin
retention-days: 1
analyze:
name: Analyze Code Security
if: ${{ '1' == '2' }}
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET 7
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
test:
name: Run tests
runs-on: ubuntu-latest
needs: build-code
strategy:
fail-fast: false
matrix:
#category: [ "Basic", "SqlServer", "PostgreSQL", "MariaDB", "Sqlite", "Oracle" ]
category: [ "Basic", "Sqlite" ]
steps:
- name: Download binaries
uses: actions/download-artifact@v3
with:
name: binaries
- name: Setup .NET 7
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
- name: Test
run: |
dotnet test --filter "FullyQualifiedName~grate.unittests.${{ matrix.category }}" \
bin/grate.unittests.dll \
--logger:"nunit;LogFilePath=test-results/${{ matrix.category }}.xml" -- \
-MaxCpuCount 2
env:
LogLevel: Warning
TZ: UTC
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.category }}
path: |
test-results/${{ matrix.category }}.xml
retention-days: 1
report:
runs-on: ubuntu-latest
name: Create test report
needs: test
steps:
- name: Download XML test reports
uses: actions/download-artifact@v3
with:
#name: test-results-${{ matrix.category }}
path: test-results
- name: Install smink
run: |
BASEURL="https://github.com/erikbra/smink/releases/download/"
VERSION="0.2.0"
INSTALL_DIR="/tmp/smink"
SMINK="${INSTALL_DIR}/smink"
FILENAME="smink-linux-x64-${VERSION}.zip"
FULL_URL="${BASEURL}${VERSION}/${FILENAME}"
DOWNLOAD_DIR="/tmp/smink-download"
DOWNLOAD_FILE="${DOWNLOAD_DIR}/${FILENAME}"
test -f "${SMINK}" && \
echo "smink already installed - not installing" || \
echo "Installing smink v ${VERSION}" && \
(test -d "${DOWNLOAD_DIR}" || mkdir -p "${DOWNLOAD_DIR}") && \
(test -d "${INSTALL_DIR}" || mkdir -p "${INSTALL_DIR}") && \
(test -f "${DOWNLOAD_FILE}" || curl -o "${DOWNLOAD_FILE}" -sL "${FULL_URL}") && \
unzip -o "${DOWNLOAD_FILE}" -d "${INSTALL_DIR}"
chmod u+x "${SMINK}"
- name: Create HTML test report
run: |
rm -rf test-results/binaries
XML_DIR='/tmp/xml'
REPORT_DIR='/tmp/test-results'
test -d $XML_DIR || mkdir $XML_DIR
find "test-results" -name '*.xml' -exec cp "{}" $XML_DIR \;
ls -lR $XML_DIR
test -d $REPORT_DIR || mkdir $REPORT_DIR
echo "Running smink"
/tmp/smink/smink "${XML_DIR}/*.xml" "${REPORT_DIR}/test-report.html" --title "grate tests"
ls -lR ${REPORT_DIR}
- name: Upload HTML test report
uses: actions/upload-artifact@v3
with:
name: test-html-report
path: |
/tmp/test-results/test-report.html
retention-days: 1