Skip to content
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
12 changes: 7 additions & 5 deletions .github/actions/artifacts-restore/action.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
name: "Artifacts restore"
name: 'Artifacts restore'
description: 'Artifacts restore'
inputs:
dotnet-version:
description: 'The version of the dotnet'
default: '7.0.x'
runs:
using: "composite"
using: 'composite'
steps:
-
name: Use cached cake frosting
id: cache-cake
uses: actions/cache@v3.2.5
uses: actions/cache@v3
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Use cached tools
id: cache-tools
uses: actions/cache@v3.2.5
uses: actions/cache@v3
with:
path: tools
key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }}
Expand All @@ -27,6 +29,6 @@ runs:
path: ${{ github.workspace }}/dogfood
-
name: Setup .NET SDK
uses: actions/setup-dotnet@v3.0.3
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ inputs.dotnet-version }}
47 changes: 47 additions & 0 deletions .github/actions/docker-publish/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: 'Docker Publish'
description: 'Docker Publish Images'
inputs:
arch:
description: 'Docker architecture'
required: true
distro:
description: 'Linux Distro'
required: true
targetFramework:
description: '.net version'
required: true
docker_registry_username:
description: 'DockerHub Registry Username'
required: true
docker_registry_password:
description: 'DockerHub Registry Password'
required: true
github_registry_username:
description: 'GitHub Registry Username'
required: true
github_registry_password:
description: 'GitHub Registry Password'
required: true
runs:
using: 'composite'
steps:
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ inputs.docker_registry_username }}
password: ${{ inputs.docker_registry_password }}
-
name: '[Docker Publish] DockerHub'
shell: pwsh
run: dotnet run/docker.dll --target=DockerPublish --arch ${{ inputs.arch }} --docker_dotnetversion=${{ inputs.targetFramework }} --docker_distro=${{ inputs.distro }} --docker_registry dockerhub
-
name: Login to GitHub
uses: docker/login-action@v2
with:
username: ${{ inputs.github_registry_username }}
password: ${{ inputs.github_registry_password }}
-
name: '[Docker Publish] GitHub'
shell: pwsh
run: dotnet run/docker.dll --target=DockerPublish --arch ${{ inputs.arch }} --docker_dotnetversion=${{ inputs.targetFramework }} --docker_distro=${{ inputs.distro }} --docker_registry github
23 changes: 23 additions & 0 deletions .github/actions/docker-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'Docker Test'
description: 'Docker Test Images'
inputs:
arch:
description: 'Docker architecture'
default: 'amd64'
distro:
description: 'Linux Distro'
default: 'debian.11'
targetFramework:
description: '.net version'
default: '7.0'
runs:
using: 'composite'
steps:
-
name: '[Docker Build & Test] DockerHub'
shell: pwsh
run: dotnet run/docker.dll --target=DockerTest --arch ${{ inputs.arch }} --docker_dotnetversion=${{ inputs.targetFramework }} --docker_distro=${{ inputs.distro }} --docker_registry dockerhub
-
name: '[Docker Build & Test] GitHub'
shell: pwsh
run: dotnet run/docker.dll --target=DockerTest --arch ${{ inputs.arch }} --docker_dotnetversion=${{ inputs.targetFramework }} --docker_distro=${{ inputs.distro }} --docker_registry github
52 changes: 52 additions & 0 deletions .github/workflows/_artifacts_linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
on:
workflow_call:
inputs:
runner:
required: true
type: string
arch:
required: true
type: string

env:
DOTNET_INSTALL_DIR: "./.dotnet"

jobs:
artifacts:
name: ${{ matrix.distro }} - net${{ matrix.targetFramework }}
runs-on: ${{ inputs.runner }}
strategy:
matrix:
distro: [ alpine.3.15, alpine.3.16, alpine.3.17, centos.7, centos.stream.8, fedora.36, debian.10, debian.11, ubuntu.18.04, ubuntu.20.04, ubuntu.22.04 ]
targetFramework: [ '7.0', '6.0' ]
fail-fast: false

steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Restore State
uses: ./.github/actions/artifacts-restore
-
uses: actions/download-artifact@v3
name: Download nuget packages
with:
name: nuget
path: ${{ github.workspace }}/artifacts/packages/nuget
-
uses: actions/download-artifact@v3
name: Download native packages
with:
name: native-${{ runner.os }}
path: ${{ github.workspace }}/artifacts/packages/native
-
name: Setup QEMU
if: inputs.arch == 'arm64'
uses: docker/setup-qemu-action@v2
-
name: '[Test Artifacts]'
shell: pwsh
run: dotnet run/artifacts.dll --target=ArtifactsTest --arch ${{ inputs.arch }} --docker_dotnetversion=${{ matrix.targetFramework }} --docker_distro=${{ matrix.distro }}
31 changes: 31 additions & 0 deletions .github/workflows/_artifacts_windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
on:
workflow_call:

jobs:
artifacts:
name: ${{ matrix.package }}
runs-on: windows-latest
strategy:
matrix:
package: [ Executable, MsBuildFull ]
fail-fast: false

steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Restore State
uses: ./.github/actions/artifacts-restore
-
uses: actions/download-artifact@v3
name: Download nuget packages
with:
name: nuget
path: ${{ github.workspace }}/artifacts/packages/nuget
-
name: '[Test Artifacts]'
shell: pwsh
run: dotnet run/artifacts.dll --target=Artifacts${{ matrix.package }}Test
45 changes: 45 additions & 0 deletions .github/workflows/_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
on:
workflow_call:

jobs:
build:
name: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]

runs-on: ${{ matrix.os }}
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Restore State
uses: ./.github/actions/artifacts-restore
-
name: '[Build]'
shell: pwsh
run: dotnet run/build.dll --target=Package
-
name: 'Upload nuget packages'
uses: actions/upload-artifact@v3
if: matrix.os == 'windows-latest'
with:
name: nuget
path: ${{ github.workspace }}/artifacts/packages/nuget
-
name: 'Upload native packages'
uses: actions/upload-artifact@v3
if: matrix.os == 'windows-latest'
with:
name: native-${{ runner.os }}
path: ${{ github.workspace }}/artifacts/packages/native/*.zip
-
name: 'Upload native packages'
uses: actions/upload-artifact@v3
if: matrix.os != 'windows-latest'
with:
name: native-${{ runner.os }}
path: ${{ github.workspace }}/artifacts/packages/native/*.tar.gz
62 changes: 62 additions & 0 deletions .github/workflows/_docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
on:
workflow_call:
inputs:
runner:
required: true
type: string
arch:
required: true
type: string

env:
DOTNET_INSTALL_DIR: "./.dotnet"

jobs:
docker:
name: ${{ matrix.distro }} - net${{ matrix.targetFramework }}
runs-on: ${{ inputs.runner }}
strategy:
matrix:
distro: [ alpine.3.15, alpine.3.16, alpine.3.17, centos.7, centos.stream.8, fedora.36, debian.10, debian.11, ubuntu.18.04, ubuntu.20.04, ubuntu.22.04 ]
targetFramework: [ '7.0', '6.0' ]
fail-fast: false

steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Restore State
uses: ./.github/actions/artifacts-restore
-
uses: actions/download-artifact@v3
name: Download nuget packages
with:
name: nuget
path: ${{ github.workspace }}/artifacts/packages/nuget
-
name: Setup QEMU
if: inputs.arch == 'arm64'
uses: docker/setup-qemu-action@v2
-
name: Docker Test
if: success() && github.event_name == 'pull_request' || github.repository_owner != 'GitTools'
uses: ./.github/actions/docker-test
with:
arch: ${{ inputs.arch }}
distro: ${{ matrix.distro }}
targetFramework: ${{ matrix.targetFramework }}
-
name: Docker Publish
if: success() && github.event_name != 'pull_request' && github.repository_owner == 'GitTools' && github.ref_name == 'main'
uses: ./.github/actions/docker-publish
with:
arch: ${{ inputs.arch }}
distro: ${{ matrix.distro }}
targetFramework: ${{ matrix.targetFramework }}
docker_registry_username: ${{ secrets.DOCKER_USERNAME }}
docker_registry_password: ${{ secrets.DOCKER_PASSWORD }}
github_registry_username: ${{ github.repository_owner }}
github_registry_password: ${{ secrets.DOCKER_GITHUB_TOKEN }}
41 changes: 41 additions & 0 deletions .github/workflows/_prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
on:
workflow_call:

jobs:
prepare:
name: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]

runs-on: ${{ matrix.os }}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Cache cake frosting
id: cache-cake
uses: actions/cache@v3
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
-
name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
-
name: '[Prepare]'
if: steps.cache-cake.outputs.cache-hit != 'true'
run: dotnet build build/CI.sln --configuration=Release
-
name: '[DogFood]'
shell: pwsh
run: dotnet run/build.dll --target=BuildPrepare
-
name: 'Upload gitversion tool'
uses: actions/upload-artifact@v3
with:
name: tool
path: ${{ github.workspace }}/dogfood
34 changes: 34 additions & 0 deletions .github/workflows/_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
on:
workflow_call:

jobs:
publish:
name: ${{ matrix.taskName }}
runs-on: windows-latest
strategy:
matrix:
taskName: [ NuGet, Chocolatey ]
fail-fast: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
CHOCOLATEY_API_KEY: ${{ secrets.CHOCOLATEY_API_KEY }}
steps:
-
name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Restore State
uses: ./.github/actions/artifacts-restore
-
uses: actions/download-artifact@v3
name: Download nuget packages
with:
name: nuget
path: ${{ github.workspace }}/artifacts/packages/nuget
-
name: '[Publish]'
shell: pwsh
run: dotnet run/publish.dll --target=Publish${{ matrix.taskName }}
Loading