Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GitHub workflow files #1224

Merged
merged 4 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 20 additions & 12 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
version: 2
updates:
- package-ecosystem: nuget
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- dependencies
- "pr: dependency-update"
ignore:
- dependency-name: YamlDotNet
versions:
- 11.1.0
- package-ecosystem: nuget
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
labels:
- dependencies
- "pr: dependency-update"
ignore:
- dependency-name: YamlDotNet
versions:
- 11.1.0

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
labels:
- dependencies
- "pr: dependency-update"
67 changes: 33 additions & 34 deletions .github/workflows/ci_analyze.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,34 @@
# Reenable when it supports .net 8
### Build and tests all pushes, also code coverage
name: 🔍 CI Analyze sources
on:
push:
branches:
- main

jobs:
sonarscanner:
name: 🔍 SonarScanner
environment: CI - analyze environment
runs-on: ubuntu-latest
steps:
- name: 📤 Checkout the repository
uses: actions/checkout@main
with:
# Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0

#### Build and tests all pushes, also code coverage
# name: 🔍 CI Analyze sources
# on:
# push:
# branches:
# - main
# jobs:
# sonarscanner:
# name: 🔍 SonarScanner
# environment: CI - analyze environment
# runs-on: ubuntu-latest
# steps:
# - name: 📤 Checkout the repository
# uses: actions/checkout@main
# with:
# # Shallow clones should be disabled for a better relevancy of analysis
# fetch-depth: 0
#
# - name: 🔍 Analyze code
# uses: highbyte/[email protected]
# env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# sonarOrganization: net-daemon
# sonarProjectKey: net-daemon_netdaemon
# sonarProjectName: netdaemon
# dotnetTestArguments: --logger trx /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
# sonarBeginArguments: >-
# /d:sonar.inclusions="**/src/**"
# /d:sonar.test.inclusions="**/tests/**"
# /d:sonar.cs.xunit.reportsPaths="**/tests/**/TestResults/*.trx"
# /d:sonar.cs.opencover.reportsPaths="**/tests/**/coverage.opencover.xml"
- name: 🔍 Analyze code
uses: highbyte/[email protected]
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
sonarOrganization: net-daemon
sonarProjectKey: net-daemon_netdaemon
sonarProjectName: netdaemon
dotnetTestArguments: --logger trx /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
sonarBeginArguments: >-
/d:sonar.inclusions="**/src/**"
/d:sonar.test.inclusions="**/tests/**"
/d:sonar.cs.xunit.reportsPaths="**/tests/**/TestResults/*.trx"
/d:sonar.cs.opencover.reportsPaths="**/tests/**/coverage.opencover.xml"
5 changes: 3 additions & 2 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ jobs:
uses: actions/checkout@main

- name: 🥅 Install .Net 9
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'

- name: 🔍 Enable problem matchers
run: echo "::add-matcher::.github/matchers/dotnet.json"

Expand Down Expand Up @@ -59,7 +60,7 @@ jobs:
path-to-lcov: ${{github.workspace}}/codecover.info

- name: 📨 Publish coverage to codecov
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
flags: unittests # optional
name: codecov-umbrella # optional
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/push_docker_addon_manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,35 @@ jobs:
steps:
- name: 📤 Checkout the repository
uses: actions/checkout@main

- name: 📆 Set version number
run: |
sed -i '/ private const string Version = /c\ private const string Version = "feature build";' ${{github.workspace}}/src/Runtime/NetDaemon.Runtime/Internal/NetDaemonRuntime.cs
sed -i '/ io.hass.version=/c\ io.hass.version="feature" \\' ${{github.workspace}}/Dockerfile.AddOn

- name: 📎 Set up QEMU
uses: docker/setup-qemu-action@v3

- name: 🔧 Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: 🧰 Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: 🔓 Login to Docker hub
uses: docker/login-action@v1.10.0
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: 🔓 Login to GitHub Container Registry
uses: docker/login-action@v1.10.0
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: 🛠️ Run Buildx
run: |
docker buildx build \
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/push_docker_manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,36 @@ jobs:
steps:
- name: 📤 Checkout the repository
uses: actions/checkout@main

- name: 📆 Set version number
run: |
echo setting source version: feature-${{ github.event.inputs.tag }}
sed -i '/ private const string Version = /c\ private const string Version = "feature-${{ github.event.inputs.tag }}";' ${{github.workspace}}/src/Runtime/NetDaemon.Runtime/Internal/NetDaemonRuntime.cs
sed -i '/ io.hass.version=/c\ io.hass.version="feature-${{ github.event.inputs.tag }}"' ${{github.workspace}}/Dockerfile.AddOn

- name: 📎 Set up QEMU
uses: docker/setup-qemu-action@v3

- name: 🔧 Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: 🧰 Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: 🔓 Login to Docker hub
uses: docker/login-action@v1.10.0
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: 🔓 Login to GitHub Container Registry
uses: docker/login-action@v1.10.0
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: 🛠️ Run Buildx
run: |
docker buildx build \
Expand All @@ -50,37 +56,44 @@ jobs:
--compress \
--tag "netdaemon/netdaemon4:feature-${{ github.event.inputs.tag }}" \
--tag "ghcr.io/net-daemon/netdaemon4:feature-${{ github.event.inputs.tag }}"

deploy_docker_addon:
name: 📦 Deploy to Docker add-on with tag
runs-on: ubuntu-latest
environment: CI - release environment
steps:
- name: 📤 Checkout the repository
uses: actions/checkout@main

- name: 📆 Set version number
run: |
echo setting source version: feature-${{ github.event.inputs.tag }}
sed -i '/ private const string Version = /c\ private const string Version = "feature-${{ github.event.inputs.tag }}";' ${{github.workspace}}/src/Runtime/NetDaemon.Runtime/Internal/NetDaemonRuntime.cs
sed -i '/ io.hass.version=/c\ io.hass.version="feature-${{ github.event.inputs.tag }}"' ${{github.workspace}}/Dockerfile.AddOn

- name: 📎 Set up QEMU
uses: docker/setup-qemu-action@v3

- name: 🔧 Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: 🧰 Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: 🔓 Login to Docker hub
uses: docker/login-action@v1.10.0
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: 🔓 Login to GitHub Container Registry
uses: docker/login-action@v1.10.0
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: 🛠️ Run Buildx
run: |
docker buildx build \
Expand Down
20 changes: 16 additions & 4 deletions .github/workflows/push_docker_prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,36 @@ jobs:
steps:
- name: 📤 Checkout the repository
uses: actions/checkout@main

- name: 📆 Set version number
run: |
echo setting source version: ${{ github.event.inputs.pre }}
sed -i '/ private const string Version = /c\ private const string Version = "${{ github.event.inputs.pre }}";' ${{github.workspace}}/src/Runtime/NetDaemon.Runtime/Internal/NetDaemonRuntime.cs
sed -i '/ io.hass.version=/c\ io.hass.version="${{ github.event.inputs.pre }}"' ${{github.workspace}}/Dockerfile.AddOn

- name: 📎 Set up QEMU
uses: docker/setup-qemu-action@v3

- name: 🔧 Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: 🧰 Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: 🔓 Login to Docker hub
uses: docker/login-action@v1.10.0
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: 🔓 Login to GitHub Container Registry
uses: docker/login-action@v1.10.0
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: 🛠️ Run Buildx
run: |
docker buildx build \
Expand All @@ -55,6 +61,7 @@ jobs:
--compress \
--tag "netdaemon/netdaemon5:${{ github.event.inputs.pre }}" \
--tag "ghcr.io/net-daemon/netdaemon5:${{ github.event.inputs.pre }}"

deploy_docker_addon:
name: 📦 Deploy to Docker add-on with tag
runs-on: ubuntu-latest
Expand All @@ -67,25 +74,30 @@ jobs:
echo setting source version: {{ github.event.inputs.pre }}
sed -i '/ private const string Version = /c\ private const string Version = "feature-${{ github.event.inputs.pre }}";' ${{github.workspace}}/src/Runtime/NetDaemon.Runtime/Internal/NetDaemonRuntime.cs
sed -i '/ io.hass.version=/c\ io.hass.version="feature-${{ github.event.inputs.pre }}"' ${{github.workspace}}/Dockerfile.AddOn

- name: 📎 Set up QEMU
uses: docker/setup-qemu-action@v3

- name: 🔧 Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3

- name: 🧰 Available platforms
run: echo ${{ steps.buildx.outputs.platforms }}

- name: 🔓 Login to Docker hub
uses: docker/login-action@v1.10.0
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}

- name: 🔓 Login to GitHub Container Registry
uses: docker/login-action@v1.10.0
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: 🛠️ Run Buildx
run: |
docker buildx build \
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/push_nuget_prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,19 @@ jobs:
echo "version=$datepre.$newpost" >> $GITHUB_OUTPUT
# Get the build number
echo "build=$(git rev-list $(git rev-list --tags --no-walk --max-count=1)..HEAD --count)" >> $GITHUB_OUTPUT

- name: 🥅 Install .Net 9
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: '9.0.x'
# dotnet-quality: 'preview'

- name: 🔖 Set version number
run: |
sed -i "/ private const string Version = /c\ private const string Version = \"${{ steps.version.outputs.version }}-${{ github.event.inputs.pre }}-${{ steps.version.outputs.build }}\";" ${{github.workspace}}/src/Runtime/NetDaemon.Runtime/Internal/NetDaemonRuntime.cs

- name: 🎁 Pack
run: dotnet pack NetDaemon.sln --configuration Release -p:PackageVersion=${{ steps.version.outputs.version }}-${{ github.event.inputs.pre }}-${{ steps.version.outputs.build }} -p:Version=${{ steps.version.outputs.version }}-${{ github.event.inputs.pre }}-${{ steps.version.outputs.build }}

- name: 📨 Push to nuget
run: dotnet nuget push **/*.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
2 changes: 1 addition & 1 deletion .github/workflows/release_drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
echo "version=$datepre.$newpost" >> $GITHUB_OUTPUT

- name: 🏃 Run Release Drafter
uses: release-drafter/release-drafter@v5
uses: release-drafter/release-drafter@v6
with:
tag: ${{ steps.version.outputs.version }}
name: ${{ steps.version.outputs.version }}
Expand Down
Loading
Loading