Skip to content

Commit

Permalink
Merge pull request #7 from RaaLabs/renovate/configure
Browse files Browse the repository at this point in the history
Configure Renovate
  • Loading branch information
rafaelschlatter authored Nov 3, 2023
2 parents e846752 + c7ed4f9 commit 5efecb3
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 109 deletions.
82 changes: 11 additions & 71 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
name: .NET

env:
PRERELEASE_BRANCHES: experimental,alpha,beta,rc
DOCKER_HUB_REPO: ${{ secrets.RAAEDGE_LOGIN_SERVER }}/connectors-opcua
COVERAGE_FOLDER: Coverage
name: 'dotnet build'

on:
push:
Expand All @@ -13,68 +8,13 @@ on:
types: [ closed ]

jobs:
ci:
name: Integration
runs-on: ubuntu-latest
outputs:
should-publish: ${{ steps.context.outputs.should-publish }}
current-version: ${{ steps.context.outputs.current-version }}
release-type: ${{ steps.context.outputs.release-type }}
cascading-release: ${{ steps.context.outputs.cascading-release }}

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Install dependencies
run: dotnet restore --no-cache --verbosity normal
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --configuration Release --no-build

- name: 'Azure login'
uses: azure/docker-login@v1
with:
login-server: ${{ secrets.RAAEDGE_LOGIN_SERVER }}
username: ${{ secrets.RAAEDGE_ACR_USERNAME }}
password: ${{ secrets.RAAEDGE_ACR_PASSWORD }}

- name: Establish context
id: context
uses: dolittle/establish-context-action@v2
with:
prerelease-branches: ${{ env.PRERELEASE_BRANCHES }}

- name: Docker Build
if: ${{ steps.context.outputs.should-publish == 'false' }}
shell: bash
run: |
docker build --no-cache -f $GITHUB_WORKSPACE/Source/Dockerfile -t ${{ env.DOCKER_HUB_REPO }}:${{ github.sha }} .
- name: Increment version
id: increment-version
if: ${{ steps.context.outputs.should-publish == 'true' }}
uses: dolittle/increment-version-action@v2
with:
version: ${{ steps.context.outputs.current-version }}
release-type: ${{ steps.context.outputs.release-type }}

- name: Docker push
if: ${{ steps.context.outputs.should-publish == 'true' && env.DOCKER_HUB_REPO != '' }}
run: |
docker build --no-cache -f $GITHUB_WORKSPACE/Source/Dockerfile -t ${{ env.DOCKER_HUB_REPO }}:${{ steps.increment-version.outputs.next-version }} -t ${{ env.DOCKER_HUB_REPO }}:latest .
docker push ${{ env.DOCKER_HUB_REPO }}:${{ steps.increment-version.outputs.next-version }}
docker push ${{ env.DOCKER_HUB_REPO }}:latest
- name: Create GitHub Release
uses: dolittle/github-release-action@v2
if: ${{ steps.context.outputs.should-publish == 'true' }}
with:
cascading-release: ${{ steps.context.outputs.cascading-release }}
version: ${{ steps.increment-version.outputs.next-version }}
body: ${{ steps.context.outputs.pr-body }}
dotnet:
uses: RaaLabs/reusable-workflows/.github/workflows/dotnet-build.yml@main
with:
IMAGE_NAME: 'connectors-opcua'
secrets:
DOCKER_REGISTRY_LOGIN_SERVER: ${{ secrets.RAAEDGE_LOGIN_SERVER }}
DOCKER_REGISTRY_USERNAME: ${{ secrets.RAAEDGE_ACR_USERNAME }}
DOCKER_REGISTRY_PASSWORD: ${{ secrets.RAAEDGE_ACR_PASSWORD }}
NUGET_GITHUB_PACKAGES_TOKEN: ${{ secrets.NUGET_GITHUB_PACKAGES_TOKEN }}
NUGET_GITHUB_PACKAGES_USERNAME: ${{ secrets.NUGET_GITHUB_PACKAGES_USERNAME }}
43 changes: 6 additions & 37 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
@@ -1,45 +1,14 @@
name: Sonarcloud

env:
COVERAGE_FOLDER: Coverage
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

on:
push:
branches:
- '**'

jobs:
ci:
name: Code Coverage
runs-on: ubuntu-latest
outputs:
should-publish: ${{ steps.context.outputs.should-publish }}
current-version: ${{ steps.context.outputs.current-version }}
release-type: ${{ steps.context.outputs.release-type }}
cascading-release: ${{ steps.context.outputs.cascading-release }}

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- name: Install dependencies
run: dotnet restore --no-cache --verbosity normal
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test and report coverage
run: dotnet test --configuration Release --no-build /p:CollectCoverage=true /p:CoverletOutput=${{ github.workspace }}/${{ env.COVERAGE_FOLDER }}/ /p:MergeWith=${{ github.workspace }}/${{ env.COVERAGE_FOLDER }}/coverage/ /p:CoverletOutputFormat=opencover

- name: SonarScanner for .NET Core with pull request decoration support
uses: highbyte/[email protected]
with:
sonarProjectKey: RaaLabs_${{ github.event.repository.name }}
sonarProjectName: ${{ github.event.repository.name }}
sonarOrganization: raalabs
dotnetTestArguments: --logger trx --collect:"XPlat Code Coverage" -- DataCollectionRunSettings.DataCollectors.DataCollector.Configuration.Format=opencover
sonarBeginArguments: /d:sonar.cs.opencover.reportsPaths="**/TestResults/**/coverage.opencover.xml" -d:sonar.cs.vstest.reportsPaths="**/TestResults/*.trx"
sonarcloud:
uses: RaaLabs/reusable-workflows/.github/workflows/dotnet-sonarcloud.yml@main
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
NUGET_GITHUB_PACKAGES_TOKEN: ${{ secrets.NUGET_GITHUB_PACKAGES_TOKEN }}
NUGET_GITHUB_PACKAGES_USERNAME: ${{ secrets.NUGET_GITHUB_PACKAGES_USERNAME }}
9 changes: 8 additions & 1 deletion Source/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ COPY Source/ ./Source/

WORKDIR /app/Source

RUN --mount=type=secret,id=NUGET_GITHUB_PACKAGES_USERNAME \
--mount=type=secret,id=NUGET_GITHUB_PACKAGES_TOKEN \
dotnet nuget add source \
--username $(cat /run/secrets/NUGET_GITHUB_PACKAGES_USERNAME) \
--password $(cat /run/secrets/NUGET_GITHUB_PACKAGES_TOKEN) \
--store-password-in-clear-text --name "githubpackagesnuget" "https://nuget.pkg.github.com/RaaLabs/index.json"

RUN dotnet restore --runtime alpine-x64

RUN dotnet publish -c Release -o out --no-restore \
Expand All @@ -24,4 +31,4 @@ COPY --from=build-env /app/Source/config ./config
RUN adduser -Ds /bin/sh moduleuser
USER moduleuser

ENTRYPOINT ["./RaaLabs.Edge.Connectors.OPCUA"]
ENTRYPOINT ["./RaaLabs.Edge.Connectors.OPCUA"]
7 changes: 7 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>RaaLabs/reusable-workflows:default"
],
"reviewers": ["rafaelschlatter"]
}

0 comments on commit 5efecb3

Please sign in to comment.