Skip to content

Commit

Permalink
Merge pull request #2 from BRP-API/chore/sync-met-source-repo_064d498
Browse files Browse the repository at this point in the history
sync met 'BRP-API/brp-shared-dotnet' repo
  • Loading branch information
MelvLee authored Jun 4, 2024
2 parents f103ca0 + 45743e6 commit cfcde08
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/actions/genereer-build-run-identifier/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Genereer build run identifier
description: Genereer een build run identifier op basis van datum en tijd (<jaar><maand><dag><uur><minuut>)

outputs:
build-run:
description: een build run identifier gegenereerd op basis van datum en tijd
value: ${{ steps.get-build-run.outputs.BUILD_RUN }}

runs:
using: composite
steps:
- name: Get build run identifier
id: get-build-run
run: |
export TZ="Europe/Amsterdam"
echo "BUILD_RUN=$(date +'%Y%m%d%H%M')" >> $GITHUB_OUTPUT
shell: bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Haal build run identifier uit Docker manifest
description: Haal de build run identifier uit een docker manifest

inputs:
path-docker-manifest:
description: het pad van een docker manifest
required: true
outputs:
build-run:
description: de build run identifier in de docker manifest
value: ${{ steps.get-build-run.outputs.BUILD_RUN }}

runs:
using: composite
steps:
- name: Get build run identifier
id: get-build-run
run: |
echo "BUILD_RUN=$(sed -n 's/image:.*:.*-\(.*\)/\1/p' ${{ inputs.path-docker-manifest }})" >> $GITHUB_OUTPUT
shell: bash
20 changes: 20 additions & 0 deletions .github/actions/haal-versie-uit-docker-manifest/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Haal versie uit Docker manifest
description: Haal de versie uit een docker manifest

inputs:
path-docker-manifest:
description: het pad van een docker manifest
required: true
outputs:
version:
description: de versie string in de docker manifest
value: ${{ steps.get-version.outputs.VERSION }}

runs:
using: composite
steps:
- name: Get version
id: get-version
run: |
echo "APP_VERSION=$(sed -n 's/image:.*:\(.*\)-.*/\1/p' ${{ inputs.path-docker-manifest }})" >> $GITHUB_OUTPUT
shell: bash
15 changes: 15 additions & 0 deletions .github/actions/toevoegen-localhost-naam/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Toevoegen localhost naam
description: Voeg een host naam toe voor localhost in het /etc/hosts bestand

inputs:
host-name:
description: de naam dat moet worden toegevoegd voor localhost (127.0.0.1)
required: true

runs:
using: composite
steps:
- name: Add a host name to /etc/hosts
run: |
sudo echo '127.0.0.1 ${{ inputs.host-name }}' | sudo tee -a /etc/hosts
shell: bash
26 changes: 26 additions & 0 deletions .github/actions/valideer-dotnet-solution/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Valideer .NET solution
description: Compileren van de projecten en uitvoeren van de unit tests opgenomen in een .NET solution bestand

inputs:
path-solution-file:
description: het pad van een .NET solution file
required: true

runs:
using: composite
steps:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
- name: Restore dependencies
run: dotnet restore ${{ inputs.path-solution-file }}
shell: bash
- name: Build
run: dotnet build ${{ inputs.path-solution-file }} --configuration Release --no-restore
shell: bash
- name: Run unit tests
run: dotnet test ${{ inputs.path-solution-file }} --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage" --results-directory ./test-reports/coverage
shell: bash
13 changes: 13 additions & 0 deletions .github/actions/zet-run-bash-scripts-permission/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Zet run bash script permission
description: Zet run permission voor een bash script of voor alle bash scripts in een map

inputs:
path-bash-file-or-folder:
description: pad van een bash script of pad van een bash script map. Voeg /* toe in geval van een script map
required: true

runs:
using: composite
steps:
- run: sudo chmod +x ${{ inputs.path-bash-file-or-folder }}
shell: bash
31 changes: 31 additions & 0 deletions .github/actions/zet-versie-met-build-run-in-csproj/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Zet versie met build run identifier in csproj file
description: Voeg de build run conform semver in het Version element van de opgegeven csproj bestand

# source: https://www.jameskerr.blog/posts/sharing-steps-in-github-action-workflows/

inputs:
path-csproj-file:
description: path van het csproj bestand
required: true
build-run:
description: string dat als build wordt gebruikt conform semver
required: true
outputs:
version:
description: de versie string in het Version element
value: ${{ steps.get-version.outputs.VERSION }}

runs:
using: composite
steps:
- name: Get version element value
id: get-version
run: |
echo "VERSION=$(sed -n 's/.*<Version>\([0-9.]*\).*/\1/p' ${{ inputs.path-csproj-file }})" >> $GITHUB_OUTPUT
shell: bash
- name: Append build run identifier
run: |
search_string="\(<Version>\([0-9.]*\)\)"
replace_string="<Version>${{ steps.get-version.outputs.VERSION }}+${{ inputs.build-run }}"
sed -i "s/$search_string/$replace_string/" ${{ inputs.path-csproj-file }}
shell: bash

0 comments on commit cfcde08

Please sign in to comment.