Skip to content

Feature/add linux commands to readme file #168

Feature/add linux commands to readme file

Feature/add linux commands to readme file #168

Workflow file for this run

# ITNOA
# Based on https://github.com/flcdrg/VsShowMissing
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
env:
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
DOTNET_VERSION: '6.0.412' # The .NET SDK version to use
PRODUCT_VERSION: '0.1.0'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build-and-test:
name: build-and-test-${{matrix.os}}
strategy:
matrix:
include:
- solution: BSN.IpTables.Api.sln
os: [ubuntu-20.04]
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
outputs:
GitAssemblyInformationalVersion: ${{ steps.gitversion.outputs.GitAssemblyInformationalVersion }}
GitBuildVersion: ${{ steps.gitversion.outputs.GitBuildVersion }}
GitBuildVersionSimple: ${{ steps.gitversion.outputs.GitBuildVersionSimple }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- uses: actions/cache@v3
with:
path: ~/.nuget/packages
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
restore-keys: |
${{ runner.os }}-nuget
- name: Install dependencies
run: dotnet restore
- name: Build with Cake
uses: cake-build/cake-action@v1
with:
target: JustBuild
script-path: Build/linux-build.cake
verbosity: Diagnostic
arguments: |
projectVersion: ${{ env.PRODUCT_VERSION }}
- name: Build
id: build
run: dotnet build --configuration Release --no-restore
- name: Git Version
id: gitversion
uses: codacy/[email protected]
# set pr number, if it's a pr build
- name: set pr build number
id: PRNUMBER
if: ${{ github.event_name == 'pull_request' }}
uses: kkak10/[email protected]
# set report file and title
- name: Set Test Title
run: |
if ${{ github.event_name == 'pull_request' }}
then
echo "title=Test Run for PR #${{steps.PRNUMBER.outputs.pr}} (${{github.run_number}})" >> $GITHUB_ENV
echo "file_name=TestReport.${{steps.PRNUMBER.outputs.pr}}.${{github.run_number}}.md" >> $GITHUB_ENV
else
echo "title=Test Run ${{github.run_number}}" >> $GITHUB_ENV
echo "file_name=TestReport.${{github.run_number}}.md" >> $GITHUB_ENV
fi
# run tests with built project
- name: Test with Cake
uses: cake-build/cake-action@v1
with:
target: JustTest
script-path: Build/linux-build.cake
verbosity: Diagnostic
arguments: |
projectVersion: ${{ env.PRODUCT_VERSION }}
- name: Test
run: |
sudo dotnet test --no-restore --verbosity normal --logger trx --results-directory Build/artifacts
sudo dotnet test --no-restore --no-build --configuration Release --logger:"liquid.md;LogFileName=${{github.workspace}}/${{env.file_name}};Title=${{env.title}};"
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3
with:
# Artifact name
name: Test Results
# A file, directory or wildcard pattern that describes what to upload
path: 'Build/artifacts/*.xml'
# Use always() to always run this step to publish test results when there are test failures
if: ${{ always() }}
# add report as PR comment (if PR)
- name: comment PR
uses: machine-learning-apps/pr-comment@master
if: ${{ github.event_name == 'pull_request' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
path: ${{env.file_name}}
- name: Dump steps context
env:
STEPS_CONTEXT: ${{ toJson(steps) }}
run: echo "$STEPS_CONTEXT"
update_release_draft:
name: Update release draft
runs-on: ubuntu-latest
needs: [build-and-test]
env:
GitAssemblyInformationalVersion: ${{ needs.build-and-test.outputs.GitAssemblyInformationalVersion }}
GitBuildVersion: ${{ needs.build-and-test.outputs.GitBuildVersion }}
GitBuildVersionSimple: ${{ needs.build-and-test.outputs.GitBuildVersionSimple }}
if: github.ref == 'refs/heads/main' # Running this job only for master branch
steps:
- uses: actions/checkout@v4
- uses: release-drafter/release-drafter@v5
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: ${{ needs.build-and-test.outputs.GitBuildVersionSimple }}