diff --git a/.github/actions/build-deps-manifest/action.yml b/.github/actions/build-deps-manifest/action.yml new file mode 100644 index 0000000..d4d8cd9 --- /dev/null +++ b/.github/actions/build-deps-manifest/action.yml @@ -0,0 +1,36 @@ +name: 'Build Deps Manifest' +description: 'Docker Build Deps Images Manifest' +inputs: + docker_distro: + description: 'Linux Distro' + required: true + docker_registry: + description: 'Docker Registry' + required: true + docker_registry_name: + description: 'Docker Registry Name' + required: true + docker_registry_username: + description: 'Docker Registry Username' + required: true + docker_registry_password: + description: 'Docker Registry Password' + required: true + +runs: + using: 'composite' + steps: + - name: Login to ${{ inputs.docker_registry }} + if: ${{ env.PUSH_IMAGES == 'true' }} + uses: docker/login-action@v3 + with: + registry: ${{ inputs.docker_registry }} + username: ${{ inputs.docker_registry_username }} + password: ${{ inputs.docker_registry_password }} + - name: '[Build Docker Deps manifest] ${{ inputs.docker_registry }}' + shell: pwsh + run: | + dotnet run/build.dll ` + --target=DockerBuildDepsManifest ` + --docker_distro=${{ inputs.docker_distro }} --docker_registry=${{ inputs.docker_registry_name }} ` + --push_images=${{ env.PUSH_IMAGES }} --verbosity=diagnostic diff --git a/.github/actions/build-deps/action.yml b/.github/actions/build-deps/action.yml new file mode 100644 index 0000000..a6ab45e --- /dev/null +++ b/.github/actions/build-deps/action.yml @@ -0,0 +1,39 @@ +name: 'Build Deps' +description: 'Docker Build Deps Images' +inputs: + arch: + description: 'OS architecture' + required: true + docker_distro: + description: 'Linux Distro' + required: true + docker_registry: + description: 'Docker Registry' + required: true + docker_registry_name: + description: 'Docker Registry Name' + required: true + docker_registry_username: + description: 'Docker Registry Username' + required: true + docker_registry_password: + description: 'Docker Registry Password' + required: true + +runs: + using: 'composite' + steps: + - name: Login to ${{ inputs.docker_registry }} + if: ${{ env.PUSH_IMAGES == 'true' }} + uses: docker/login-action@v3 + with: + registry: ${{ inputs.docker_registry }} + username: ${{ inputs.docker_registry_username }} + password: ${{ inputs.docker_registry_password }} + - name: '[Build Docker Deps] ${{ inputs.docker_registry }}' + shell: pwsh + run: | + dotnet run/build.dll ` + --target=DockerBuildDeps --arch=${{ inputs.arch }} ` + --docker_distro=${{ inputs.docker_distro }} --docker_registry=${{ inputs.docker_registry_name }} ` + --push_images=${{ env.PUSH_IMAGES }} --verbosity=diagnostic diff --git a/.github/actions/build-images-manifest/action.yml b/.github/actions/build-images-manifest/action.yml new file mode 100644 index 0000000..f6430cf --- /dev/null +++ b/.github/actions/build-images-manifest/action.yml @@ -0,0 +1,43 @@ +name: 'Build Images Manifest' +description: 'Docker Build Images Manifest' +inputs: + dotnet_version: + description: '.net version' + required: true + dotnet_variant: + description: '.net variant' + required: true + docker_distro: + description: 'Linux Distro' + required: true + docker_registry: + description: 'Docker Registry' + required: true + docker_registry_name: + description: 'Docker Registry Name' + required: true + docker_registry_username: + description: 'Docker Registry Username' + required: true + docker_registry_password: + description: 'Docker Registry Password' + required: true + +runs: + using: 'composite' + steps: + - name: Login to ${{ inputs.docker_registry }} + if: ${{ env.PUSH_IMAGES == 'true' }} + uses: docker/login-action@v3 + with: + registry: ${{ inputs.docker_registry }} + username: ${{ inputs.docker_registry_username }} + password: ${{ inputs.docker_registry_password }} + - name: '[Build Docker images manifest] ${{ inputs.docker_registry }}' + shell: pwsh + run: | + dotnet run/build.dll ` + --target=DockerBuildImagesManifest ` + --dotnet_version=${{ inputs.dotnet_version }} --dotnet_variant=${{ inputs.dotnet_variant }} ` + --docker_distro=${{ inputs.docker_distro }} --docker_registry=${{ inputs.docker_registry_name }} ` + --push_images=${{ env.PUSH_IMAGES }} --verbosity=diagnostic diff --git a/.github/actions/build-images/action.yml b/.github/actions/build-images/action.yml new file mode 100644 index 0000000..eef3a1a --- /dev/null +++ b/.github/actions/build-images/action.yml @@ -0,0 +1,46 @@ +name: 'Build Images' +description: 'Docker Build Images' +inputs: + arch: + description: 'OS architecture' + required: true + dotnet_version: + description: '.net version' + required: true + dotnet_variant: + description: '.net variant' + required: true + docker_distro: + description: 'Linux Distro' + required: true + docker_registry: + description: 'Docker Registry' + required: true + docker_registry_name: + description: 'Docker Registry Name' + required: true + docker_registry_username: + description: 'Docker Registry Username' + required: true + docker_registry_password: + description: 'Docker Registry Password' + required: true + +runs: + using: 'composite' + steps: + - name: Login to ${{ inputs.docker_registry }} + if: ${{ env.PUSH_IMAGES == 'true' }} + uses: docker/login-action@v3 + with: + registry: ${{ inputs.docker_registry }} + username: ${{ inputs.docker_registry_username }} + password: ${{ inputs.docker_registry_password }} + - name: '[Build Docker images] ${{ inputs.docker_registry }}' + shell: pwsh + run: | + dotnet run/build.dll ` + --target=DockerBuildImages --arch=${{ inputs.arch }} ` + --dotnet_version=${{ inputs.dotnet_version }} --dotnet_variant=${{ inputs.dotnet_variant }} ` + --docker_distro=${{ inputs.docker_distro }} --docker_registry=${{ inputs.docker_registry_name }} ` + --push_images=${{ env.PUSH_IMAGES }} --verbosity=diagnostic diff --git a/.github/actions/docker-setup/action.yml b/.github/actions/docker-setup/action.yml new file mode 100644 index 0000000..7b75ceb --- /dev/null +++ b/.github/actions/docker-setup/action.yml @@ -0,0 +1,16 @@ +name: 'Docker Setup' +description: 'Setups the docker engine' + +runs: + using: 'composite' + steps: + - 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 diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 5824c65..4b73cff 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,27 +1,27 @@ version: 2 updates: -- package-ecosystem: dotnet-sdk - labels: - - "dependencies" - commit-message: - prefix: "(deps)" - directory: "/build" - schedule: - interval: daily -- package-ecosystem: nuget - labels: - - "dependencies" - commit-message: - prefix: "(deps)" - directory: "/build" - schedule: - interval: daily - open-pull-requests-limit: 10 -- package-ecosystem: github-actions - labels: - - "dependencies" - commit-message: - prefix: "(build deps)" - directory: "/" - schedule: - interval: daily + - package-ecosystem: dotnet-sdk + labels: + - "dependencies" + commit-message: + prefix: "(deps)" + directory: "/build" + schedule: + interval: daily + - package-ecosystem: nuget + labels: + - "dependencies" + commit-message: + prefix: "(deps)" + directory: "/build" + schedule: + interval: daily + open-pull-requests-limit: 10 + - package-ecosystem: github-actions + labels: + - "dependencies" + commit-message: + prefix: "(build deps)" + directory: "/" + schedule: + interval: daily diff --git a/.github/mergify.yml b/.github/mergify.yml index e1d8d1e..fe3e76e 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -1,21 +1,21 @@ pull_request_rules: - - name: Automatic approve on dependabot PR - conditions: - - author~=^dependabot(|-preview)\[bot\]$ - actions: - review: - type: APPROVE - - name: Automatic merge on dependabot PR after success CI - conditions: - - author~=^dependabot(|-preview)\[bot\]$ - - '#commits-behind=0' # Only merge up to date pull requests - - repository-full-name=GitTools/build-images # Don't auto-merge PRs in forks - actions: - merge: - - name: Thank contributor - conditions: - - merged - - -author~=^dependabot(|-preview)\[bot\]$ - actions: - comment: - message: "Thank you @{{author}} for your contribution!" + - name: Automatic approve on dependabot PR + conditions: + - author~=^dependabot(|-preview)\[bot\]$ + actions: + review: + type: APPROVE + - name: Automatic merge on dependabot PR after success CI + conditions: + - author~=^dependabot(|-preview)\[bot\]$ + - '#commits-behind=0' # Only merge up to date pull requests + - repository-full-name=GitTools/build-images # Don't auto-merge PRs in forks + actions: + merge: + - name: Thank contributor + conditions: + - merged + - -author~=^dependabot(|-preview)\[bot\]$ + actions: + comment: + message: "Thank you @{{author}} for your contribution!" diff --git a/.github/workflows/_build-deps-manifest.yml b/.github/workflows/_build-deps-manifest.yml new file mode 100644 index 0000000..dc69d2f --- /dev/null +++ b/.github/workflows/_build-deps-manifest.yml @@ -0,0 +1,50 @@ +on: + workflow_call: + inputs: + docker_distros: + required: true + type: string +env: + DOTNET_INSTALL_DIR: "./.dotnet" + DOTNET_ROLL_FORWARD: "Major" + PUSH_IMAGES: ${{ github.event_name != 'pull_request' && github.repository_owner == 'GitTools' }} + +jobs: + build_deps_manifests: + name: ${{ matrix.docker_distro }} + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + docker_distro: ${{ fromJson(inputs.docker_distros) }} + 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: ./.github/actions/docker-setup + - name: Publish image manifest to DockerHub + uses: ./.github/actions/build-deps-manifest + with: + docker_distro: ${{ matrix.docker_distro }} + docker_registry: docker.io + docker_registry_name: dockerhub + docker_registry_username: ${{ secrets.DOCKER_USERNAME }} + docker_registry_password: ${{ secrets.DOCKER_PASSWORD }} + - name: Publish image manifest to GitHub + uses: ./.github/actions/build-deps-manifest + with: + docker_distro: ${{ matrix.docker_distro }} + docker_registry: ghcr.io + docker_registry_name: github + docker_registry_username: ${{ github.repository_owner }} + docker_registry_password: ${{ secrets.DOCKER_GITHUB_TOKEN }} diff --git a/.github/workflows/_build-deps.yml b/.github/workflows/_build-deps.yml new file mode 100644 index 0000000..723c422 --- /dev/null +++ b/.github/workflows/_build-deps.yml @@ -0,0 +1,58 @@ +on: + workflow_call: + inputs: + runner: + required: true + type: string + arch: + required: true + type: string + docker_distros: + required: true + type: string +env: + DOTNET_INSTALL_DIR: "./.dotnet" + DOTNET_ROLL_FORWARD: "Major" + PUSH_IMAGES: ${{ github.event_name != 'pull_request' && github.repository_owner == 'GitTools' }} + +jobs: + build_deps: + name: ${{ matrix.docker_distro }} + runs-on: ${{ inputs.runner }} + strategy: + fail-fast: false + matrix: + docker_distro: ${{ fromJson(inputs.docker_distros) }} + 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: ./.github/actions/docker-setup + - name: Publish image to DockerHub + uses: ./.github/actions/build-deps + with: + arch: ${{ inputs.arch }} + docker_distro: ${{ matrix.docker_distro }} + docker_registry: docker.io + docker_registry_name: dockerhub + docker_registry_username: ${{ secrets.DOCKER_USERNAME }} + docker_registry_password: ${{ secrets.DOCKER_PASSWORD }} + - name: Publish image to GitHub + uses: ./.github/actions/build-deps + with: + arch: ${{ inputs.arch }} + docker_distro: ${{ matrix.docker_distro }} + docker_registry: ghcr.io + docker_registry_name: github + docker_registry_username: ${{ github.repository_owner }} + docker_registry_password: ${{ secrets.DOCKER_GITHUB_TOKEN }} diff --git a/.github/workflows/_build-images-manifest.yml b/.github/workflows/_build-images-manifest.yml new file mode 100644 index 0000000..9462f08 --- /dev/null +++ b/.github/workflows/_build-images-manifest.yml @@ -0,0 +1,65 @@ +on: + workflow_call: + inputs: + runner: + required: true + type: string + dotnet_variant: + required: true + type: string + dotnet_versions: + required: true + type: string + docker_distros: + required: true + type: string +env: + DOTNET_INSTALL_DIR: "./.dotnet" + DOTNET_ROLL_FORWARD: "Major" + PUSH_IMAGES: ${{ github.event_name != 'pull_request' && github.repository_owner == 'GitTools' }} + +jobs: + build_images_manifest: + name: ${{ matrix.docker_distro }} - net${{ matrix.dotnet_version }} + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + docker_distro: ${{ fromJson(inputs.docker_distros) }} + dotnet_version: ${{ fromJson(inputs.dotnet_versions) }} + + 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: ./.github/actions/docker-setup + - name: Publish image manifest to DockerHub + uses: ./.github/actions/build-images-manifest + with: + dotnet_variant: ${{ inputs.dotnet_variant }} + dotnet_version: ${{ matrix.dotnet_version }} + docker_distro: ${{ matrix.docker_distro }} + docker_registry: docker.io + docker_registry_name: dockerhub + docker_registry_username: ${{ secrets.DOCKER_USERNAME }} + docker_registry_password: ${{ secrets.DOCKER_PASSWORD }} + - name: Publish image manifest to GitHub + uses: ./.github/actions/build-images-manifest + with: + dotnet_variant: ${{ inputs.dotnet_variant }} + dotnet_version: ${{ matrix.dotnet_version }} + docker_distro: ${{ matrix.docker_distro }} + docker_registry: ghcr.io + docker_registry_name: github + docker_registry_username: ${{ github.repository_owner }} + docker_registry_password: ${{ secrets.DOCKER_GITHUB_TOKEN }} diff --git a/.github/workflows/_build-images.yml b/.github/workflows/_build-images.yml new file mode 100644 index 0000000..f08e9d1 --- /dev/null +++ b/.github/workflows/_build-images.yml @@ -0,0 +1,70 @@ +on: + workflow_call: + inputs: + runner: + required: true + type: string + arch: + required: true + type: string + dotnet_variant: + required: true + type: string + dotnet_versions: + required: true + type: string + docker_distros: + required: true + type: string +env: + DOTNET_INSTALL_DIR: "./.dotnet" + DOTNET_ROLL_FORWARD: "Major" + PUSH_IMAGES: ${{ github.event_name != 'pull_request' && github.repository_owner == 'GitTools' }} + +jobs: + build_images: + name: ${{ matrix.docker_distro }} - net${{ matrix.dotnet_version }} + runs-on: ${{ inputs.runner }} + strategy: + fail-fast: false + matrix: + docker_distro: ${{ fromJson(inputs.docker_distros) }} + dotnet_version: ${{ fromJson(inputs.dotnet_versions) }} + + 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: ./.github/actions/docker-setup + - name: Publish image to DockerHub + uses: ./.github/actions/build-images + with: + arch: ${{ inputs.arch }} + dotnet_variant: ${{ inputs.dotnet_variant }} + dotnet_version: ${{ matrix.dotnet_version }} + docker_distro: ${{ matrix.docker_distro }} + docker_registry: docker.io + docker_registry_name: dockerhub + docker_registry_username: ${{ secrets.DOCKER_USERNAME }} + docker_registry_password: ${{ secrets.DOCKER_PASSWORD }} + - name: Publish image to GitHub + uses: ./.github/actions/build-images + with: + arch: ${{ inputs.arch }} + dotnet_variant: ${{ inputs.dotnet_variant }} + dotnet_version: ${{ matrix.dotnet_version }} + docker_distro: ${{ matrix.docker_distro }} + docker_registry: ghcr.io + docker_registry_name: github + docker_registry_username: ${{ github.repository_owner }} + docker_registry_password: ${{ secrets.DOCKER_GITHUB_TOKEN }} diff --git a/.github/workflows/build-deps.yml b/.github/workflows/build-deps.yml index 7fe989e..d9ec02a 100644 --- a/.github/workflows/build-deps.yml +++ b/.github/workflows/build-deps.yml @@ -1,169 +1,66 @@ -name: Build Deps - -on: - workflow_dispatch: - push: - branches: - - main - - 'feature/*' - - pull_request: - branches: - - main - schedule: - - cron: "0 11 * * 1,4" - -jobs: - prepare: - name: Prepare Build - runs-on: ubuntu-24.04 - outputs: - dockerDistros: ${{ steps.set_matrix.outputs.dockerDistros }} - 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_deps: - name: Build Deps (${{ matrix.arch }} - ${{ matrix.distro }}) - 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) }} - 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] DockerHub' - shell: pwsh - run: | - dotnet run/build.dll ` - --target=DockerBuildDeps --arch=${{ matrix.arch }} ` - --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] GitHub' - shell: pwsh - run: | - dotnet run/build.dll ` - --target=DockerBuildDeps --arch=${{ matrix.arch }} ` - --dotnet_distro=${{ matrix.distro }} --docker_registry=github ` - --push_images=${{env.PUSH_IMAGES}} --verbosity=diagnostic - - build_deps_manifests: - name: Build Deps Manifests (${{ matrix.distro }}) - needs: [ prepare, build_deps ] - env: - PUSH_IMAGES: ${{github.event_name != 'pull_request' && github.repository_owner == 'GitTools'}} - runs-on: ubuntu-24.04 - strategy: - matrix: - distro: ${{ fromJson(needs.prepare.outputs.dockerDistros) }} - 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 manifests] DockerHub' - shell: pwsh - run: | - dotnet run/build.dll ` - --target=DockerBuildDepsManifest ` - --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 manifests] GitHub' - shell: pwsh - run: | - dotnet run/build.dll ` - --target=DockerBuildDepsManifest ` - --dotnet_distro=${{ matrix.distro }} --docker_registry=github ` - --push_images=${{env.PUSH_IMAGES}} --verbosity=diagnostic +name: Build Deps + +on: + workflow_dispatch: + push: + branches: + - main + - 'feature/*' + + pull_request: + branches: + - main + schedule: + - cron: "0 11 * * 1,4" + +jobs: + prepare: + name: Prepare Build + runs-on: ubuntu-24.04 + outputs: + dockerDistros: ${{ steps.set_matrix.outputs.dockerDistros }} + 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_deps: + name: Build Deps (${{ matrix.arch }}) + secrets: inherit + needs: [ prepare ] + strategy: + fail-fast: false + matrix: + include: + - arch: amd64 + runner: ubuntu-24.04 + - arch: arm64 + runner: ubuntu-24.04-arm + uses: ./.github/workflows/_build-deps.yml + with: + runner: ${{ matrix.runner }} + arch: ${{ matrix.arch }} + docker_distros: ${{ needs.prepare.outputs.dockerDistros }} + + build_deps_manifests: + name: Build Deps Manifests + secrets: inherit + needs: [ prepare, build_deps ] + uses: ./.github/workflows/_build-deps-manifest.yml + with: + docker_distros: ${{ needs.prepare.outputs.dockerDistros }} diff --git a/.github/workflows/build-images.yml b/.github/workflows/build-images.yml index 2909a6c..35ef1a6 100644 --- a/.github/workflows/build-images.yml +++ b/.github/workflows/build-images.yml @@ -14,12 +14,10 @@ jobs: 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' }} + if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} steps: - name: Checkout uses: actions/checkout@v4 - with: - ref: ${{ github.event.workflow_run.head_branch }} - name: Cache cake frosting id: cache-cake uses: actions/cache@v4 @@ -38,144 +36,41 @@ jobs: run: dotnet run/build.dll --target=SetMatrix build_images: - name: Build Images (${{ matrix.arch }} - ${{ matrix.distro }}) (${{ matrix.version }} - ${{ matrix.variant }}) + name: Build Images (${{ matrix.dotnet_variant }} - ${{ matrix.arch }}) + secrets: inherit needs: [ prepare ] - env: - PUSH_IMAGES: ${{github.event_name != 'pull_request' && github.repository_owner == 'GitTools'}} - runs-on: ${{ matrix.runner }} strategy: + fail-fast: false matrix: + dotnet_variant: ${{ fromJson(needs.prepare.outputs.dotnetVariants) }} 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 - with: - ref: ${{ github.event.workflow_run.head_branch }} - - 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 + uses: ./.github/workflows/_build-images.yml + with: + runner: ${{ matrix.runner }} + arch: ${{ matrix.arch }} + dotnet_variant: ${{ matrix.dotnet_variant }} + dotnet_versions: ${{ needs.prepare.outputs.dotnetVersions }} + docker_distros: ${{ needs.prepare.outputs.dockerDistros }} build_images_manifest: - name: Build Images (${{ matrix.distro }}) (${{ matrix.version }} - ${{ matrix.variant }}) + name: Build Images Manifest (${{ matrix.dotnet_variant }}) + secrets: inherit needs: [ prepare, build_images ] - env: - PUSH_IMAGES: ${{github.event_name != 'pull_request' && github.repository_owner == 'GitTools'}} - runs-on: ubuntu-24.04 strategy: - matrix: - distro: ${{ fromJson(needs.prepare.outputs.dockerDistros) }} - version: ${{ fromJson(needs.prepare.outputs.dotnetVersions) }} - variant: ${{ fromJson(needs.prepare.outputs.dotnetVariants) }} fail-fast: false + matrix: + dotnet_variant: ${{ fromJson(needs.prepare.outputs.dotnetVariants) }} - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.workflow_run.head_branch }} - - 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=DockerBuildImagesManifest ` - --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=DockerBuildImagesManifest ` - --dotnet_version=${{ matrix.version }} --dotnet_variant=${{ matrix.variant }} ` - --dotnet_distro=${{ matrix.distro }} --docker_registry=github ` - --push_images=${{env.PUSH_IMAGES}} --verbosity=diagnostic + uses: ./.github/workflows/_build-images-manifest.yml + with: + runner: ${{ matrix.runner }} + dotnet_variant: ${{ matrix.dotnet_variant }} + dotnet_versions: ${{ needs.prepare.outputs.dotnetVersions }} + docker_distros: ${{ needs.prepare.outputs.dockerDistros }} diff --git a/build/.run/DockerBuild (runtime).run.xml b/build/.run/DockerBuild (runtime).run.xml index 517cbe0..a415063 100644 --- a/build/.run/DockerBuild (runtime).run.xml +++ b/build/.run/DockerBuild (runtime).run.xml @@ -1,7 +1,7 @@