From b012abc3ed3304fa8203f299d1665d2183aeb4eb Mon Sep 17 00:00:00 2001 From: Job79 Date: Mon, 29 Dec 2025 17:09:24 +0100 Subject: [PATCH] ci: move ci to job v2 --- .gitea/workflows/build.yaml | 111 +++++++++++++++++++++++++++++++++++ .gitea/workflows/fedora.yaml | 68 --------------------- .gitea/workflows/other.yaml | 58 ++++++++---------- 3 files changed, 136 insertions(+), 101 deletions(-) create mode 100644 .gitea/workflows/build.yaml delete mode 100644 .gitea/workflows/fedora.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..f174244 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,111 @@ +name: Build containers +on: + workflow_dispatch: + push: + branches: ["main"] + paths: ["containers/**", ".gitea/workflows/build.yaml"] + pull_request: + branches: ["main"] + paths: ["containers/**", ".gitea/workflows/build.yaml"] + +jobs: + changes: + runs-on: job-v2 + outputs: + any_change: ${{ steps.filter.outputs.workflow == 'true' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'}} + fedora: ${{ steps.filter.outputs.fedora == 'true' }} + php: ${{ steps.filter.outputs.php == 'true' }} + rust: ${{ steps.filter.outputs.rust == 'true' }} + dotnet: ${{ steps.filter.outputs.dotnet == 'true' }} + steps: + - uses: actions/checkout@v4 + - uses: https://github.com/dorny/paths-filter@v3 + id: filter + with: + filters: | + workflow: ['.gitea/workflows/build.yaml'] + fedora: ['containers/fedora/**'] + php: ['containers/php/**'] + rust: ['containers/rust/**'] + dotnet: ['containers/dotnet/**'] + + base-image: + needs: [changes] + if: ${{ needs.changes.outputs.fedora == 'true' || needs.changes.outputs.any_change == 'true' }} + runs-on: job-v2 + steps: + - uses: actions/checkout@v4 + - name: Log in + uses: redhat-actions/podman-login@v1 + with: + registry: git.plabble.org + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + - name: Build + id: build + uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef + with: + image: maurice/fedora + tags: ${{ github.ref_name }} + context: ./containers/fedora + containerfiles: ./containers/fedora/Containerfile + - name: Push + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build.outputs.image }} + tags: ${{ steps.build.outputs.tags }} + registry: git.plabble.org + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + extra-args: | + --compression-format=zstd + --compression-level=12 + + dependent-images: + needs: [changes, base-image] + if: always() && needs.changes.result == 'success' && (needs.base-image.result == 'success' || needs.base-image.result == 'skipped') + runs-on: job-v2 + strategy: + fail-fast: false + matrix: + container: [php, rust, dotnet] + steps: + - name: Check if build needed + id: check + run: | + if [[ "${{ matrix.container }}" == "php" && "${{ needs.changes.outputs.php }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi + if [[ "${{ matrix.container }}" == "rust" && "${{ needs.changes.outputs.rust }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi + if [[ "${{ matrix.container }}" == "dotnet" && "${{ needs.changes.outputs.dotnet }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi + if [[ "${{ needs.changes.outputs.any_change }}" == "true" ]]; then echo "run=true" >> $GITHUB_OUTPUT; fi + - name: Clone repo + if: steps.check.outputs.run == 'true' + uses: actions/checkout@v4 + - name: Log in + if: steps.check.outputs.run == 'true' + uses: redhat-actions/podman-login@v1 + with: + registry: git.plabble.org + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + - name: Build + id: build + if: steps.check.outputs.run == 'true' + uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef + with: + image: maurice/${{ matrix.container }} + tags: ${{ github.ref_name }} + context: ./containers/${{ matrix.container }} + containerfiles: ./containers/${{ matrix.container }}/Containerfile + build-args: TAG=${{ github.ref_name }} + - name: Push + if: steps.check.outputs.run == 'true' + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build.outputs.image }} + tags: ${{ steps.build.outputs.tags }} + registry: git.plabble.org + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + extra-args: | + --compression-format=zstd + --compression-level=12 diff --git a/.gitea/workflows/fedora.yaml b/.gitea/workflows/fedora.yaml deleted file mode 100644 index 5cd58a5..0000000 --- a/.gitea/workflows/fedora.yaml +++ /dev/null @@ -1,68 +0,0 @@ -name: Build container -on: - workflow_dispatch: # This makes the workflow manually triggered - push: - branches: ["main"] - paths: - - "containers/fedora/**" - - "containers/dotnet/**" - - "containers/rust/**" - - "containers/php/**" - - ".gitea/workflows/fedora.yaml" - pull_request: - branches: ["main"] - -jobs: - fedora-build: - runs-on: job-latest - steps: - - name: Clone repo - uses: actions/checkout@v4 - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Registry - uses: docker/login-action@v3 - with: - registry: git.plabble.org - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_TOKEN }} - - - name: Build and push Fedora container - uses: docker/build-push-action@v5 - with: - context: ./containers/fedora - file: ./containers/fedora/Containerfile - push: true - tags: git.plabble.org/maurice/fedora:${{ github.ref_name }} - build-args: TAG=${{ github.ref_name }} - outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true - - - name: Build and push Rust container - uses: docker/build-push-action@v5 - with: - context: ./containers/rust - file: ./containers/rust/Containerfile - push: true - tags: git.plabble.org/maurice/rust:${{ github.ref_name }} - build-args: TAG=${{ github.ref_name }} - outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true - - - name: Build and push PHP container - uses: docker/build-push-action@v5 - with: - context: ./containers/php - file: ./containers/php/Containerfile - push: true - tags: git.plabble.org/maurice/php:${{ github.ref_name }} - build-args: TAG=${{ github.ref_name }} - outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true - - - name: Build and push C# container - uses: docker/build-push-action@v5 - with: - context: ./containers/dotnet - file: ./containers/dotnet/Containerfile - push: true - tags: git.plabble.org/maurice/dotnet:${{ github.ref_name }} - build-args: TAG=${{ github.ref_name }} - outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true diff --git a/.gitea/workflows/other.yaml b/.gitea/workflows/other.yaml index 3828eb6..bab6cfc 100644 --- a/.gitea/workflows/other.yaml +++ b/.gitea/workflows/other.yaml @@ -1,48 +1,40 @@ name: Build optional dev containers on: - workflow_dispatch: # This makes the workflow manually triggered + workflow_dispatch: jobs: fedora-build: - runs-on: job-latest + runs-on: job-v2 + strategy: + max-parallel: 1 + matrix: + container: [rider, android] steps: - name: Clone repo uses: actions/checkout@v4 - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Login to Registry - uses: docker/login-action@v3 + - name: Log in + uses: redhat-actions/podman-login@v1 with: registry: git.plabble.org username: ${{ secrets.REGISTRY_USERNAME }} password: ${{ secrets.REGISTRY_TOKEN }} - - - name: Build and push Rider container - uses: docker/build-push-action@v5 + - name: Build ${{ matrix.container }} container + id: build_image + uses: job79/buildah-build@65b3793a1370c1ccd74a5c0d090d70eb9637a4ef with: - context: ./containers/rider - file: ./containers/rider/Containerfile - push: true - tags: git.plabble.org/maurice/rider:${{ github.ref_name }} + image: maurice/${{ matrix.container }} + tags: ${{ github.ref_name }} + context: ./containers/${{ matrix.container }} + containerfiles: ./containers/${{ matrix.container }}/Containerfile build-args: TAG=${{ github.ref_name }} - outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true - - - name: Build and push Android Studio container - uses: docker/build-push-action@v5 + - name: Push ${{ matrix.container }} container + uses: redhat-actions/push-to-registry@v2 with: - context: ./containers/android - file: ./containers/android/Containerfile - push: true - tags: git.plabble.org/maurice/android:${{ github.ref_name }} - build-args: TAG=${{ github.ref_name }} - outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true - - # - name: Build and push Flutter container - # uses: docker/build-push-action@v5 - # with: - # context: ./containers/flutter - # file: ./containers/flutter/Containerfile - # push: true - # tags: git.plabble.org/maurice/flutter:${{ github.ref_name }} - # build-args: TAG=${{ github.ref_name }} - # outputs: type=image,oci-mediatypes=true,compression=zstd,compression-level=3,force-compression=true \ No newline at end of file + image: ${{ steps.build_image.outputs.image }} + tags: ${{ steps.build_image.outputs.tags }} + registry: git.plabble.org + username: ${{ secrets.REGISTRY_USERNAME }} + password: ${{ secrets.REGISTRY_TOKEN }} + extra-args: | + --compression-format=zstd + --compression-level=12