Skip to content

Commit

Permalink
renamed DockerBuild -> DockerBuildImages
Browse files Browse the repository at this point in the history
  • Loading branch information
arturcic committed Jan 20, 2025
1 parent 070557a commit 28171d0
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 112 deletions.
218 changes: 109 additions & 109 deletions .github/workflows/build.yml → .github/workflows/build-images.yml
Original file line number Diff line number Diff line change
@@ -1,109 +1,109 @@
name: Build

on:
workflow_dispatch:
workflow_run:
workflows: [ Build Deps ]
types:
- completed
jobs:
prepare:
name: Prepare Build
runs-on: ubuntu-24.04
outputs:
dockerDistros: ${{ steps.set_matrix.outputs.dockerDistros }}
dotnetVersions: ${{ steps.set_matrix.outputs.dotnetVersions }}
dotnetVariants: ${{ steps.set_matrix.outputs.dotnetVariants }}
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache cake frosting
id: cache-cake
uses: actions/cache@v4
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
global-json-file: build/global.json
- name: '[Prepare]'
if: steps.cache-cake.outputs.cache-hit != 'true'
run: dotnet build build/CI.sln --configuration=Release
- name: '[Matrix]'
id: set_matrix
run: dotnet run/build.dll --target=SetMatrix

build:
name: Build (${{ matrix.arch }} - ${{ matrix.distro }}) (${{ matrix.version }} - ${{ matrix.variant }})
needs: [ prepare ]
env:
PUSH_IMAGES: ${{github.event_name != 'pull_request' && github.repository_owner == 'GitTools'}}
runs-on: ${{ matrix.runner }}
strategy:
matrix:
arch: [ amd64, arm64 ]
runner: [ ubuntu-24.04, ubuntu-24.04-arm ]
distro: ${{ fromJson(needs.prepare.outputs.dockerDistros) }}
version: ${{ fromJson(needs.prepare.outputs.dotnetVersions) }}
variant: ${{ fromJson(needs.prepare.outputs.dotnetVariants) }}
exclude:
- runner: ubuntu-24.04-arm
arch: amd64
- runner: ubuntu-24.04
arch: arm64
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use cached cake frosting
id: cache-cake
uses: actions/cache@v4
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
global-json-file: build/global.json
- name: Set up Docker
uses: docker/setup-docker-action@v4
with:
daemon-config: '{ "features": { "containerd-snapshotter": true } }'
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: 'latest'
driver-opts: 'image=moby/buildkit:buildx-stable-1'
install: true
- name: Login to DockerHub
if: success() && env.PUSH_IMAGES == 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: '[Build Docker images]'
shell: pwsh
run: |
dotnet run/build.dll `
--target=DockerBuild --arch=${{ matrix.arch }} `
--dotnet_version=${{ matrix.version }} --dotnet_variant=${{ matrix.variant }} `
--dotnet_distro=${{ matrix.distro }} --docker_registry=dockerhub `
--push_images=${{env.PUSH_IMAGES}} --verbosity=diagnostic
- name: Login to GitHub Container Registry
if: success() && env.PUSH_IMAGES == 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_GITHUB_TOKEN }}
- name: '[Build Docker images]'
shell: pwsh
run: |
dotnet run/build.dll `
--target=DockerBuild --arch=${{ matrix.arch }} `
--dotnet_version=${{ matrix.version }} --dotnet_variant=${{ matrix.variant }} `
--dotnet_distro=${{ matrix.distro }} --docker_registry=github `
--push_images=${{env.PUSH_IMAGES}} --verbosity=diagnostic
name: Build

on:
workflow_dispatch:
workflow_run:
workflows: [ Build Deps ]
types:
- completed
jobs:
prepare:
name: Prepare Build
runs-on: ubuntu-24.04
outputs:
dockerDistros: ${{ steps.set_matrix.outputs.dockerDistros }}
dotnetVersions: ${{ steps.set_matrix.outputs.dotnetVersions }}
dotnetVariants: ${{ steps.set_matrix.outputs.dotnetVariants }}
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache cake frosting
id: cache-cake
uses: actions/cache@v4
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
global-json-file: build/global.json
- name: '[Prepare]'
if: steps.cache-cake.outputs.cache-hit != 'true'
run: dotnet build build/CI.sln --configuration=Release
- name: '[Matrix]'
id: set_matrix
run: dotnet run/build.dll --target=SetMatrix

build:
name: Build (${{ matrix.arch }} - ${{ matrix.distro }}) (${{ matrix.version }} - ${{ matrix.variant }})
needs: [ prepare ]
env:
PUSH_IMAGES: ${{github.event_name != 'pull_request' && github.repository_owner == 'GitTools'}}
runs-on: ${{ matrix.runner }}
strategy:
matrix:
arch: [ amd64, arm64 ]
runner: [ ubuntu-24.04, ubuntu-24.04-arm ]
distro: ${{ fromJson(needs.prepare.outputs.dockerDistros) }}
version: ${{ fromJson(needs.prepare.outputs.dotnetVersions) }}
variant: ${{ fromJson(needs.prepare.outputs.dotnetVariants) }}
exclude:
- runner: ubuntu-24.04-arm
arch: amd64
- runner: ubuntu-24.04
arch: arm64
fail-fast: false

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use cached cake frosting
id: cache-cake
uses: actions/cache@v4
with:
path: run
key: run-${{ runner.os }}-${{ hashFiles('./build/**') }}
- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
global-json-file: build/global.json
- name: Set up Docker
uses: docker/setup-docker-action@v4
with:
daemon-config: '{ "features": { "containerd-snapshotter": true } }'
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: 'latest'
driver-opts: 'image=moby/buildkit:buildx-stable-1'
install: true
- name: Login to DockerHub
if: success() && env.PUSH_IMAGES == 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: '[Build Docker images]'
shell: pwsh
run: |
dotnet run/build.dll `
--target=DockerBuildImages --arch=${{ matrix.arch }} `
--dotnet_version=${{ matrix.version }} --dotnet_variant=${{ matrix.variant }} `
--dotnet_distro=${{ matrix.distro }} --docker_registry=dockerhub `
--push_images=${{env.PUSH_IMAGES}} --verbosity=diagnostic
- name: Login to GitHub Container Registry
if: success() && env.PUSH_IMAGES == 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_GITHUB_TOKEN }}
- name: '[Build Docker images]'
shell: pwsh
run: |
dotnet run/build.dll `
--target=DockerBuildImages --arch=${{ matrix.arch }} `
--dotnet_version=${{ matrix.version }} --dotnet_variant=${{ matrix.variant }} `
--dotnet_distro=${{ matrix.distro }} --docker_registry=github `
--push_images=${{env.PUSH_IMAGES}} --verbosity=diagnostic
2 changes: 1 addition & 1 deletion build/CI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sln", "sln", "{FBAD8CD3-87BB-4EC8-B467-58328E304F9B}"
ProjectSection(SolutionItems) = preProject
Directory.Build.props = Directory.Build.props
..\.github\workflows\build.yml = ..\.github\workflows\build.yml
..\.github\workflows\build-images.yml = ..\.github\workflows\build-images.yml
..\.github\workflows\build-deps.yml = ..\.github\workflows\build-deps.yml
global.json = global.json
EndProjectSection
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

namespace Build;

[TaskName(nameof(DockerBuild))]
[TaskName(nameof(DockerBuildImages))]
[TaskDescription("Builds the docker images")]
public sealed class DockerBuild : DockerBaseTask
public sealed class DockerBuildImages : DockerBaseTask
{
public override void Run(BuildContext context)
{
Expand Down

0 comments on commit 28171d0

Please sign in to comment.