Skip to content

Bump actions/setup-dotnet from 3 to 4 #183

Bump actions/setup-dotnet from 3 to 4

Bump actions/setup-dotnet from 3 to 4 #183

Workflow file for this run

name: .NET Core
on:
push:
branches: [ main, release*, feature* ]
tags: [ v* ]
pull_request:
branches: [ main, release*, feature* ]
env:
ECLINT_VERSION: "0.3.3"
_JAVA_OPTIONS: "-Xms10m -Xmx1024m"
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
env:
BUILD_ARTIFACTS_FOLDER: build_artifacts
steps:
- name: "[Setup] - Checkout code"
uses: actions/checkout@v4
with:
fetch-depth: 0 # Required for GitVersion
submodules: 'recursive'
- name: "[Setup] - Set HOME env variable (Windows)"
if: ${{ runner.os == 'Windows' }}
shell: pwsh
run: |
"HOME=${env:GITHUB_WORKSPACE}" >> $env:GITHUB_ENV
- name: "[Setup] - .NET Core"
uses: actions/setup-dotnet@v4
with:
global-json-file: ./global.json
- name: "[Setup] - Install GitVersion"
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.10.3'
- name: "[Setup] - Install Ruby"
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: "[Setup] - Install CycloneDX CLI (Windows)"
if: runner.os == 'Windows'
shell: pwsh
run: |
cd bin
Invoke-WebRequest -Uri https://github.com/CycloneDX/cyclonedx-cli/releases/download/v0.24.0/cyclonedx-win-x64.exe -OutFile cyclonedx.exe
"$env:GITHUB_WORKSPACE\bin" >> $env:GITHUB_PATH
- name: "[Setup] - Install CycloneDX CLI (Linux)"
if: runner.os != 'Windows'
run: |
cd bin
curl -LO https://github.com/CycloneDX/cyclonedx-cli/releases/download/v0.24.0/cyclonedx-linux-x64
chmod a+x cyclonedx-linux-x64
mv cyclonedx-linux-x64 cyclonedx
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
- name: "[Lint] - Install eclint on Linux"
if: runner.os != 'Windows'
run: |
curl -L https://gitlab.com/greut/eclint/-/releases/v$ECLINT_VERSION/downloads/eclint_${ECLINT_VERSION}_linux_x86_64.tar.gz -o /tmp/eclint_${ECLINT_VERSION}_linux_x86_64.tar.gz && \
mkdir -p $HOME/.local/opt/eclint && \
tar -zxvf /tmp/eclint_${ECLINT_VERSION}_linux_x86_64.tar.gz -C $HOME/.local/opt/eclint && \
rm /tmp/eclint_${ECLINT_VERSION}_linux_x86_64.tar.gz
echo "$HOME/.local/opt/eclint" >> $GITHUB_PATH
- name: "[Lint] - Install eclint on Windows"
if: runner.os == 'Windows'
run: |
New-Item -Type Directory -Force $HOME\.local\opt\eclint
Invoke-WebRequest -Uri https://gitlab.com/greut/eclint/-/releases/v$env:ECLINT_VERSION/downloads/eclint_${env:ECLINT_VERSION}_windows_x86_64.tar.gz -OutFile $HOME\.local\opt\eclint\eclint_${env:ECLINT_VERSION}_windows_x86_64.tar.gz
Set-Location $HOME\.local\opt\eclint
tar -zxvf .\eclint_${env:ECLINT_VERSION}_windows_x86_64.tar.gz
Write-Output "$HOME\.local\opt\eclint" | Out-File -Append $env:GITHUB_PATH
- name: "[Setup] - Install CycloneDX dotnet as a global tool"
run: |
dotnet tool install --global CycloneDX
echo "$GITHUB_WORKSPACE/.dotnet/tools" >> $GITHUB_PATH
- name: "[Setup] - Set HOME env variable (Windows)"
if: ${{ runner.os == 'Windows' }}
shell: pwsh
run: |
"HOME=${env:GITHUB_WORKSPACE}" >> $env:GITHUB_ENV
- name: "[Versioning] - GitVersion Config"
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
additionalArguments: '/showConfig'
- name: "[Versioning] - Determine Version"
uses: gittools/actions/gitversion/[email protected]
id: gitversion
with:
useConfigFile: true
- name: "[Versioning] - Update csproj Files"
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
additionalArguments: '/updateprojectfiles'
- name: "[Versioning] - Display updated csproj File"
run: cat Corgibytes.Freshli.Agent.DotNet/Corgibytes.Freshli.Agent.DotNet.csproj
- name: "[Build]"
run: |
ruby bin/build.rb
- name: "[Lint]"
run: |
ruby bin/lint.rb
- name: "[Test] - Test and Collect Code Coverage"
run: |
dotnet coverlet ./exe --target "ruby" --targetargs 'bin/test.rb --skip-build' --format lcov
- name: "[Test] - Upload coverage as build artifact"
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage.info
- name: "[Test] - Send Code Coverage Data to Code Climate"
uses: paambaati/[email protected]
if: ${{ github.actor != 'dependabot[bot]' && runner.os != 'Windows' }}
env:
CC_TEST_REPORTER_ID: ${{ secrets.TEST_REPORTER_ID }}
with:
coverageLocations: |
${{github.workspace}}/coverage.info:lcov
prefix: ${{github.workspace}}