diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6ca2c6..f2c2963 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,13 +97,13 @@ jobs: uses: actions/cache@v4 with: path: tmp/build-cache-${{ runner.arch }} - key: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildx-${{ github.sha }} - restore-keys: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildx + key: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildxz-${{ github.sha }} + restore-keys: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildxz enableCrossOsArchive: true - name: Change docker to a cache-able driver run: | docker buildx create --driver docker-container --use - bundle exec rake build:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,dest=tmp/build-cache-new" + bundle exec rake build:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" - name: Show docker images run: docker images - name: Update and prune docker buildx layer cache diff --git a/.github/workflows/publish-images.yml b/.github/workflows/publish-images.yml index 61b6039..d6ebad8 100644 --- a/.github/workflows/publish-images.yml +++ b/.github/workflows/publish-images.yml @@ -1,106 +1,784 @@ -name: Publish docker images to GHCR -concurrency: - group: "${{github.workflow}}-${{github.ref}}" - cancel-in-progress: true +# This file is generated. Please edit publish-images.yml.erb instead! + + +name: Weekly publish docker images to GHCR on: workflow_dispatch: schedule: - cron: "0 3 * * 3" # At 03:00 on Wednesday # https://crontab.guru/#0_3_*_*_3 -jobs: - build: - name: build native + +concurrency: + group: "${{github.workflow}}-${{github.ref}}" + cancel-in-progress: true + +jobs: + + aarch64-linux-musl: + name: "build aarch64-linux-musl ${{ matrix.os }}" + needs: common-7f790bc6d2444edacd5337c9048dae13842eb9ff + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-aarch64-linux-musl-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-aarch64-linux-musl + ${{ runner.os }}-on-${{ runner.arch }}-common-7f790bc6d2444edacd5337c9048dae13842eb9ff + enableCrossOsArchive: true + - name: Build the image layers aarch64-linux-musl on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:aarch64-linux-musl RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + common-7f790bc6d2444edacd5337c9048dae13842eb9ff: + name: "build common-7f790bc6d2444edacd5337c9048dae13842eb9ff ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-common-7f790bc6d2444edacd5337c9048dae13842eb9ff-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-common-7f790bc6d2444edacd5337c9048dae13842eb9ff + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers common-7f790bc6d2444edacd5337c9048dae13842eb9ff on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:common-7f790bc6d2444edacd5337c9048dae13842eb9ff RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + arm-linux-musl: + name: "build arm-linux-musl ${{ matrix.os }}" + needs: common-7f790bc6d2444edacd5337c9048dae13842eb9ff + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-arm-linux-musl-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-arm-linux-musl + ${{ runner.os }}-on-${{ runner.arch }}-common-7f790bc6d2444edacd5337c9048dae13842eb9ff + enableCrossOsArchive: true + - name: Build the image layers arm-linux-musl on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:arm-linux-musl RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x86-linux-musl: + name: "build x86-linux-musl ${{ matrix.os }}" + needs: common-7f790bc6d2444edacd5337c9048dae13842eb9ff + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x86-linux-musl-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x86-linux-musl + ${{ runner.os }}-on-${{ runner.arch }}-common-7f790bc6d2444edacd5337c9048dae13842eb9ff + enableCrossOsArchive: true + - name: Build the image layers x86-linux-musl on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x86-linux-musl RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x86_64-linux-musl: + name: "build x86_64-linux-musl ${{ matrix.os }}" + needs: common-7f790bc6d2444edacd5337c9048dae13842eb9ff + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x86_64-linux-musl-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x86_64-linux-musl + ${{ runner.os }}-on-${{ runner.arch }}-common-7f790bc6d2444edacd5337c9048dae13842eb9ff + enableCrossOsArchive: true + - name: Build the image layers x86_64-linux-musl on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x86_64-linux-musl RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + arm64-darwin: + name: "build arm64-darwin ${{ matrix.os }}" + needs: common-d1f437046b79903f679102aadd5269e80f584d09 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-arm64-darwin-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-arm64-darwin + ${{ runner.os }}-on-${{ runner.arch }}-common-d1f437046b79903f679102aadd5269e80f584d09 + enableCrossOsArchive: true + - name: Build the image layers arm64-darwin on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:arm64-darwin RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + common-d1f437046b79903f679102aadd5269e80f584d09: + name: "build common-d1f437046b79903f679102aadd5269e80f584d09 ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-common-d1f437046b79903f679102aadd5269e80f584d09-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-common-d1f437046b79903f679102aadd5269e80f584d09 + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers common-d1f437046b79903f679102aadd5269e80f584d09 on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:common-d1f437046b79903f679102aadd5269e80f584d09 RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x86_64-darwin: + name: "build x86_64-darwin ${{ matrix.os }}" + needs: common-d1f437046b79903f679102aadd5269e80f584d09 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x86_64-darwin-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x86_64-darwin + ${{ runner.os }}-on-${{ runner.arch }}-common-d1f437046b79903f679102aadd5269e80f584d09 + enableCrossOsArchive: true + - name: Build the image layers x86_64-darwin on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x86_64-darwin RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + aarch64-linux-gnu: + name: "build aarch64-linux-gnu ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-aarch64-linux-gnu-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-aarch64-linux-gnu + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers aarch64-linux-gnu on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:aarch64-linux-gnu RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + common-8c26987a5e78ace67587139520ec4d44e00a8f54: + name: "build common-8c26987a5e78ace67587139520ec4d44e00a8f54 ${{ matrix.os }}" + needs: common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + ${{ runner.os }}-on-${{ runner.arch }}-common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 + enableCrossOsArchive: true + - name: Build the image layers common-8c26987a5e78ace67587139520ec4d44e00a8f54 on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:common-8c26987a5e78ace67587139520ec4d44e00a8f54 RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + aarch64-mingw-ucrt: + name: "build aarch64-mingw-ucrt ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-aarch64-mingw-ucrt-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-aarch64-mingw-ucrt + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers aarch64-mingw-ucrt on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:aarch64-mingw-ucrt RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + arm-linux-gnu: + name: "build arm-linux-gnu ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-arm-linux-gnu-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-arm-linux-gnu + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers arm-linux-gnu on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:arm-linux-gnu RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x64-mingw-ucrt: + name: "build x64-mingw-ucrt ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x64-mingw-ucrt-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x64-mingw-ucrt + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers x64-mingw-ucrt on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x64-mingw-ucrt RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x64-mingw32: + name: "build x64-mingw32 ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x64-mingw32-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x64-mingw32 + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers x64-mingw32 on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x64-mingw32 RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x86-linux-gnu: + name: "build x86-linux-gnu ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x86-linux-gnu-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x86-linux-gnu + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers x86-linux-gnu on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x86-linux-gnu RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x86-mingw32: + name: "build x86-mingw32 ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x86-mingw32-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x86-mingw32 + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers x86-mingw32 on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x86-mingw32 RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x86_64-linux-gnu: + name: "build x86_64-linux-gnu ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x86_64-linux-gnu-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x86_64-linux-gnu + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers x86_64-linux-gnu on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x86_64-linux-gnu RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0: + name: "build common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 ${{ matrix.os }}" + + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 + ${{ runner.os }}-on-${{ runner.arch }}- + enableCrossOsArchive: true + - name: Build the image layers common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + jruby: + name: "build jruby ${{ matrix.os }}" + needs: common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 strategy: fail-fast: false matrix: os: - ubuntu-latest - ubuntu-24.04-arm - platform: - - aarch64-linux-gnu - - aarch64-linux-musl - - aarch64-mingw-ucrt - - arm-linux-gnu - - arm-linux-musl - - arm64-darwin - - jruby - - x64-mingw-ucrt - - x64-mingw32 - - x86-linux-gnu - - x86-linux-musl - - x86-mingw32 - - x86_64-darwin - - x86_64-linux-gnu - - x86_64-linux-musl runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 with: - ruby-version: "3.3" + ruby-version: "3.4" bundler-cache: true - name: Fetch docker buildx layer cache uses: actions/cache@v4 with: path: tmp/build-cache-${{ runner.arch }} - key: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildx-${{ github.sha }} - restore-keys: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildx + key: ${{ runner.os }}-on-${{ runner.arch }}-jruby-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-jruby + ${{ runner.os }}-on-${{ runner.arch }}-common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 enableCrossOsArchive: true - - name: Change docker to a cache-able driver + - name: Build the image layers jruby on ${{ runner.arch }} run: | + # Change docker to a cache-able driver docker buildx create --driver docker-container --use - bundle exec rake build:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,dest=tmp/build-cache-new" - - name: Show docker images - run: docker images + bundle exec rake build:jruby RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" - name: Update and prune docker buildx layer cache run: | rm -rf tmp/build-cache-${{ runner.arch }} mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + push: name: push - needs: build + needs: [aarch64-linux-gnu,aarch64-linux-musl,aarch64-mingw-ucrt,arm-linux-gnu,arm-linux-musl,arm64-darwin,x64-mingw-ucrt,x64-mingw32,x86-linux-gnu,x86-linux-musl,x86-mingw32,x86_64-darwin,x86_64-linux-gnu,x86_64-linux-musl,jruby] strategy: fail-fast: false matrix: platform: + - aarch64-linux-gnu + - aarch64-linux-musl + - aarch64-mingw-ucrt + - arm-linux-gnu + - arm-linux-musl + - arm64-darwin - - jruby + - x64-mingw-ucrt + - x64-mingw32 + - x86-linux-gnu + - x86-linux-musl + - x86-mingw32 + - x86_64-darwin + - x86_64-linux-gnu + - x86_64-linux-musl - runs-on: ubuntu-latest + + - jruby + + runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@v4 - - name: Use X64 cache from primary pipeline + + - name: Use X64 cache from tree pipeline of ${{ matrix.platform }} uses: actions/cache/restore@v4 with: path: tmp/build-cache-X64 - key: ${{ runner.os }}-on-X64-${{ matrix.platform }}-buildx-${{ github.sha }} - restore-keys: ${{ runner.os }}-on-X64-${{ matrix.platform }}-buildx + key: ${{ runner.os }}-on-X64-${{ matrix.platform }}-${{ github.sha }} + restore-keys: ${{ runner.os }}-on-X64-${{ matrix.platform }} enableCrossOsArchive: true - - name: Use ARM64 cache from primary pipeline + - name: Use ARM64 cache from tree pipeline of ${{ matrix.platform }} uses: actions/cache/restore@v4 with: path: tmp/build-cache-ARM64 - key: ${{ runner.os }}-on-ARM64-${{ matrix.platform }}-buildx-${{ github.sha }} - restore-keys: ${{ runner.os }}-on-ARM64-${{ matrix.platform }}-buildx + key: ${{ runner.os }}-on-ARM64-${{ matrix.platform }}-${{ github.sha }} + restore-keys: ${{ runner.os }}-on-ARM64-${{ matrix.platform }} enableCrossOsArchive: true fail-on-cache-miss: true + - uses: ruby/setup-ruby@v1 with: - ruby-version: "3.3" + ruby-version: "3.4" bundler-cache: true - uses: docker/login-action@v3 with: @@ -110,7 +788,7 @@ jobs: - name: Use cache and push docker image env: RCD_IMAGE_VERSION: snapshot - RCD_DOCKER_BUILD: docker buildx build --cache-from=type=local,src=tmp/build-cache-X64 --cache-from=type=local,src=tmp/build-cache-ARM64 --cache-to=type=local,dest=tmp/build-cache-new + RCD_DOCKER_BUILD: docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-X64 --cache-from=type=local,compression=zstd,src=tmp/build-cache-ARM64 run: | docker buildx create --driver docker-container --use - bundle exec rake release:${{matrix.platform}} + bundle exec rake release:${{ matrix.platform }} diff --git a/.github/workflows/publish-images.yml.erb b/.github/workflows/publish-images.yml.erb new file mode 100644 index 0000000..940cb53 --- /dev/null +++ b/.github/workflows/publish-images.yml.erb @@ -0,0 +1,118 @@ +<%= "# This file is generated. Please edit publish-images.yml.erb instead!" %> + +<% if release %> +name: Release docker images to GHCR +# +# This workflow assumes the maintainer has chosen the appropriate tag in the workflow dispatch UI. +# +on: + workflow_dispatch: + inputs: + tag: + description: "Tag name to release" + required: true + +<% else %> +name: Weekly publish docker images to GHCR +on: + workflow_dispatch: + schedule: + - cron: "0 3 * * 3" # At 03:00 on Wednesday # https://crontab.guru/#0_3_*_*_3 +<% end %> + +concurrency: + group: "${{github.workflow}}-${{github.ref}}" + cancel-in-progress: true + +jobs: +<% parallel_docker_build.tree_deps.to_a.flatten.uniq.each do |tree_dep| + dockerfile = parallel_docker_build.final_deps.invert[tree_dep] + job = dockerfile ? dockerfile[/[-\w]+$/] : tree_dep +%> + <%= job %>: + name: "build <%= job %> ${{ matrix.os }}" + <%= need = parallel_docker_build.tree_deps[tree_dep]; "needs: #{need}" if need %> + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 +<% if release %> + with: + ref: ${{ inputs.tag }} +<% end %> + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-<%= job %>-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-<%= job %> + ${{ runner.os }}-on-${{ runner.arch }}-<%= need %> + enableCrossOsArchive: true + - name: Build the image layers <%= job %> on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:<%= job %> RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} +<% end %> + + push: + name: push + needs: [<%= parallel_docker_build.final_deps.keys.map{|a| a[/[-\w]+$/] }.join(",") %>] + strategy: + fail-fast: false + matrix: + platform: +<% parallel_docker_build.final_deps.each do |dockerfile, _| %> + - <%= dockerfile[/[-\w]+$/] %> +<% end %> + runs-on: ubuntu-24.04-arm + steps: + - uses: actions/checkout@v4 + + - name: Use X64 cache from tree pipeline of ${{ matrix.platform }} + uses: actions/cache/restore@v4 + with: + path: tmp/build-cache-X64 + key: ${{ runner.os }}-on-X64-${{ matrix.platform }}-${{ github.sha }} + restore-keys: ${{ runner.os }}-on-X64-${{ matrix.platform }} + enableCrossOsArchive: true + - name: Use ARM64 cache from tree pipeline of ${{ matrix.platform }} + uses: actions/cache/restore@v4 + with: + path: tmp/build-cache-ARM64 + key: ${{ runner.os }}-on-ARM64-${{ matrix.platform }}-${{ github.sha }} + restore-keys: ${{ runner.os }}-on-ARM64-${{ matrix.platform }} + enableCrossOsArchive: true + fail-on-cache-miss: true + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + - uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{github.actor}} + password: ${{secrets.GITHUB_TOKEN}} + - name: Use cache and push docker image + env: + RCD_IMAGE_VERSION: snapshot + RCD_DOCKER_BUILD: docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-X64 --cache-from=type=local,compression=zstd,src=tmp/build-cache-ARM64 + run: | + docker buildx create --driver docker-container --use + bundle exec rake release:${{ matrix.platform }} diff --git a/.github/workflows/release-images.yml b/.github/workflows/release-images.yml index 07a1c53..a3822c1 100644 --- a/.github/workflows/release-images.yml +++ b/.github/workflows/release-images.yml @@ -1,114 +1,847 @@ +# This file is generated. Please edit publish-images.yml.erb instead! + + name: Release docker images to GHCR +# +# This workflow assumes the maintainer has chosen the appropriate tag in the workflow dispatch UI. +# +on: + workflow_dispatch: + inputs: + tag: + description: "Tag name to release" + required: true + + + concurrency: group: "${{github.workflow}}-${{github.ref}}" cancel-in-progress: true -# -# This workflow assumes the maintainer has chosen the appropriate tag in the workflow dispatch UI. -# -on: - workflow_dispatch: - inputs: - tag: - description: "Tag name to release" - required: true +jobs: + + aarch64-linux-musl: + name: "build aarch64-linux-musl ${{ matrix.os }}" + needs: common-7f790bc6d2444edacd5337c9048dae13842eb9ff + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-aarch64-linux-musl-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-aarch64-linux-musl + ${{ runner.os }}-on-${{ runner.arch }}-common-7f790bc6d2444edacd5337c9048dae13842eb9ff + enableCrossOsArchive: true + - name: Build the image layers aarch64-linux-musl on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:aarch64-linux-musl RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + common-7f790bc6d2444edacd5337c9048dae13842eb9ff: + name: "build common-7f790bc6d2444edacd5337c9048dae13842eb9ff ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-common-7f790bc6d2444edacd5337c9048dae13842eb9ff-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-common-7f790bc6d2444edacd5337c9048dae13842eb9ff + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers common-7f790bc6d2444edacd5337c9048dae13842eb9ff on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:common-7f790bc6d2444edacd5337c9048dae13842eb9ff RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + arm-linux-musl: + name: "build arm-linux-musl ${{ matrix.os }}" + needs: common-7f790bc6d2444edacd5337c9048dae13842eb9ff + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-arm-linux-musl-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-arm-linux-musl + ${{ runner.os }}-on-${{ runner.arch }}-common-7f790bc6d2444edacd5337c9048dae13842eb9ff + enableCrossOsArchive: true + - name: Build the image layers arm-linux-musl on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:arm-linux-musl RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x86-linux-musl: + name: "build x86-linux-musl ${{ matrix.os }}" + needs: common-7f790bc6d2444edacd5337c9048dae13842eb9ff + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x86-linux-musl-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x86-linux-musl + ${{ runner.os }}-on-${{ runner.arch }}-common-7f790bc6d2444edacd5337c9048dae13842eb9ff + enableCrossOsArchive: true + - name: Build the image layers x86-linux-musl on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x86-linux-musl RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x86_64-linux-musl: + name: "build x86_64-linux-musl ${{ matrix.os }}" + needs: common-7f790bc6d2444edacd5337c9048dae13842eb9ff + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x86_64-linux-musl-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x86_64-linux-musl + ${{ runner.os }}-on-${{ runner.arch }}-common-7f790bc6d2444edacd5337c9048dae13842eb9ff + enableCrossOsArchive: true + - name: Build the image layers x86_64-linux-musl on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x86_64-linux-musl RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + arm64-darwin: + name: "build arm64-darwin ${{ matrix.os }}" + needs: common-d1f437046b79903f679102aadd5269e80f584d09 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-arm64-darwin-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-arm64-darwin + ${{ runner.os }}-on-${{ runner.arch }}-common-d1f437046b79903f679102aadd5269e80f584d09 + enableCrossOsArchive: true + - name: Build the image layers arm64-darwin on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:arm64-darwin RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + common-d1f437046b79903f679102aadd5269e80f584d09: + name: "build common-d1f437046b79903f679102aadd5269e80f584d09 ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-common-d1f437046b79903f679102aadd5269e80f584d09-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-common-d1f437046b79903f679102aadd5269e80f584d09 + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers common-d1f437046b79903f679102aadd5269e80f584d09 on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:common-d1f437046b79903f679102aadd5269e80f584d09 RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x86_64-darwin: + name: "build x86_64-darwin ${{ matrix.os }}" + needs: common-d1f437046b79903f679102aadd5269e80f584d09 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x86_64-darwin-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x86_64-darwin + ${{ runner.os }}-on-${{ runner.arch }}-common-d1f437046b79903f679102aadd5269e80f584d09 + enableCrossOsArchive: true + - name: Build the image layers x86_64-darwin on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x86_64-darwin RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + aarch64-linux-gnu: + name: "build aarch64-linux-gnu ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-aarch64-linux-gnu-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-aarch64-linux-gnu + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers aarch64-linux-gnu on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:aarch64-linux-gnu RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + common-8c26987a5e78ace67587139520ec4d44e00a8f54: + name: "build common-8c26987a5e78ace67587139520ec4d44e00a8f54 ${{ matrix.os }}" + needs: common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + ${{ runner.os }}-on-${{ runner.arch }}-common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 + enableCrossOsArchive: true + - name: Build the image layers common-8c26987a5e78ace67587139520ec4d44e00a8f54 on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:common-8c26987a5e78ace67587139520ec4d44e00a8f54 RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + aarch64-mingw-ucrt: + name: "build aarch64-mingw-ucrt ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-aarch64-mingw-ucrt-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-aarch64-mingw-ucrt + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers aarch64-mingw-ucrt on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:aarch64-mingw-ucrt RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + arm-linux-gnu: + name: "build arm-linux-gnu ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 -jobs: - build: - name: "build ${{ inputs.tag }} ${{ matrix.platform }}" + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-arm-linux-gnu-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-arm-linux-gnu + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers arm-linux-gnu on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:arm-linux-gnu RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x64-mingw-ucrt: + name: "build x64-mingw-ucrt ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x64-mingw-ucrt-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x64-mingw-ucrt + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers x64-mingw-ucrt on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x64-mingw-ucrt RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x64-mingw32: + name: "build x64-mingw32 ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x64-mingw32-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x64-mingw32 + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers x64-mingw32 on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x64-mingw32 RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x86-linux-gnu: + name: "build x86-linux-gnu ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x86-linux-gnu-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x86-linux-gnu + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers x86-linux-gnu on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x86-linux-gnu RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x86-mingw32: + name: "build x86-mingw32 ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x86-mingw32-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x86-mingw32 + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers x86-mingw32 on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x86-mingw32 RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + x86_64-linux-gnu: + name: "build x86_64-linux-gnu ${{ matrix.os }}" + needs: common-8c26987a5e78ace67587139520ec4d44e00a8f54 + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-x86_64-linux-gnu-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-x86_64-linux-gnu + ${{ runner.os }}-on-${{ runner.arch }}-common-8c26987a5e78ace67587139520ec4d44e00a8f54 + enableCrossOsArchive: true + - name: Build the image layers x86_64-linux-gnu on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:x86_64-linux-gnu RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0: + name: "build common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 ${{ matrix.os }}" + + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.4" + bundler-cache: true + + - name: Fetch docker buildx layer cache + uses: actions/cache@v4 + with: + path: tmp/build-cache-${{ runner.arch }} + key: ${{ runner.os }}-on-${{ runner.arch }}-common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 + ${{ runner.os }}-on-${{ runner.arch }}- + enableCrossOsArchive: true + - name: Build the image layers common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 on ${{ runner.arch }} + run: | + # Change docker to a cache-able driver + docker buildx create --driver docker-container --use + bundle exec rake build:common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" + - name: Update and prune docker buildx layer cache + run: | + rm -rf tmp/build-cache-${{ runner.arch }} + mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + + jruby: + name: "build jruby ${{ matrix.os }}" + needs: common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 strategy: fail-fast: false matrix: os: - ubuntu-latest - ubuntu-24.04-arm - platform: - - aarch64-linux-gnu - - aarch64-linux-musl - - aarch64-mingw-ucrt - - arm-linux-gnu - - arm-linux-musl - - arm64-darwin - - jruby - - x64-mingw-ucrt - - x64-mingw32 - - x86-linux-gnu - - x86-linux-musl - - x86-mingw32 - - x86_64-darwin - - x86_64-linux-gnu - - x86_64-linux-musl runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 + + with: + ref: ${{ inputs.tag }} + - uses: ruby/setup-ruby@v1 with: - ruby-version: "3.3" + ruby-version: "3.4" bundler-cache: true - name: Fetch docker buildx layer cache uses: actions/cache@v4 with: path: tmp/build-cache-${{ runner.arch }} - key: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildx-${{ github.sha }} - restore-keys: ${{ runner.os }}-on-${{ runner.arch }}-${{ matrix.platform }}-buildx + key: ${{ runner.os }}-on-${{ runner.arch }}-jruby-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-on-${{ runner.arch }}-jruby + ${{ runner.os }}-on-${{ runner.arch }}-common-8a6d86116e9a9ffad5888a4a8b7fbee50535dbe0 enableCrossOsArchive: true - - name: Change docker to a cache-able driver + - name: Build the image layers jruby on ${{ runner.arch }} run: | + # Change docker to a cache-able driver docker buildx create --driver docker-container --use - bundle exec rake build:${{ matrix.platform }} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,dest=tmp/build-cache-new" - - name: Show docker images - run: docker images + bundle exec rake build:jruby RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-${{ runner.arch }} --cache-to=type=local,compression=zstd,dest=tmp/build-cache-new" - name: Update and prune docker buildx layer cache run: | rm -rf tmp/build-cache-${{ runner.arch }} mv tmp/build-cache-new tmp/build-cache-${{ runner.arch }} + push: - needs: build - name: "push ${{ inputs.tag }} ${{ matrix.platform }}" + name: push + needs: [aarch64-linux-gnu,aarch64-linux-musl,aarch64-mingw-ucrt,arm-linux-gnu,arm-linux-musl,arm64-darwin,x64-mingw-ucrt,x64-mingw32,x86-linux-gnu,x86-linux-musl,x86-mingw32,x86_64-darwin,x86_64-linux-gnu,x86_64-linux-musl,jruby] strategy: fail-fast: false matrix: platform: + - aarch64-linux-gnu + - aarch64-linux-musl + - aarch64-mingw-ucrt + - arm-linux-gnu + - arm-linux-musl + - arm64-darwin - - jruby + - x64-mingw-ucrt + - x64-mingw32 + - x86-linux-gnu + - x86-linux-musl + - x86-mingw32 + - x86_64-darwin + - x86_64-linux-gnu + - x86_64-linux-musl - runs-on: ubuntu-latest + + - jruby + + runs-on: ubuntu-24.04-arm steps: - uses: actions/checkout@v4 - with: - ref: ${{ inputs.tag }} - - name: Use X64 cache from primary pipeline + + - name: Use X64 cache from tree pipeline of ${{ matrix.platform }} uses: actions/cache/restore@v4 with: path: tmp/build-cache-X64 - key: ${{ runner.os }}-on-X64-${{ matrix.platform }}-buildx-${{ github.sha }} - restore-keys: ${{ runner.os }}-on-X64-${{ matrix.platform }}-buildx + key: ${{ runner.os }}-on-X64-${{ matrix.platform }}-${{ github.sha }} + restore-keys: ${{ runner.os }}-on-X64-${{ matrix.platform }} enableCrossOsArchive: true - - name: Use ARM64 cache from primary pipeline + - name: Use ARM64 cache from tree pipeline of ${{ matrix.platform }} uses: actions/cache/restore@v4 with: path: tmp/build-cache-ARM64 - key: ${{ runner.os }}-on-ARM64-${{ matrix.platform }}-buildx-${{ github.sha }} - restore-keys: ${{ runner.os }}-on-ARM64-${{ matrix.platform }}-buildx + key: ${{ runner.os }}-on-ARM64-${{ matrix.platform }}-${{ github.sha }} + restore-keys: ${{ runner.os }}-on-ARM64-${{ matrix.platform }} enableCrossOsArchive: true fail-on-cache-miss: true + - uses: ruby/setup-ruby@v1 with: - ruby-version: "3.3" + ruby-version: "3.4" bundler-cache: true - uses: docker/login-action@v3 with: @@ -117,7 +850,8 @@ jobs: password: ${{secrets.GITHUB_TOKEN}} - name: Use cache and push docker image env: - RCD_DOCKER_BUILD: docker buildx build --cache-from=type=local,src=tmp/build-cache-X64 --cache-from=type=local,src=tmp/build-cache-ARM64 --cache-to=type=local,dest=tmp/build-cache-new + RCD_IMAGE_VERSION: snapshot + RCD_DOCKER_BUILD: docker buildx build --cache-from=type=local,compression=zstd,src=tmp/build-cache-X64 --cache-from=type=local,compression=zstd,src=tmp/build-cache-ARM64 run: | docker buildx create --driver docker-container --use - bundle exec rake release:${{matrix.platform}} + bundle exec rake release:${{ matrix.platform }} diff --git a/Dockerfile.mri.erb b/Dockerfile.mri.erb index ba8656f..a7b489f 100644 --- a/Dockerfile.mri.erb +++ b/Dockerfile.mri.erb @@ -12,6 +12,65 @@ RUN apt-get -y update && \ apt-get install -y autoconf cmake pkg-config zlib1g-dev libreadline-dev libsqlite0-dev libssl-dev libyaml-dev libffi-dev && \ rm -rf /var/lib/apt/lists/* +## +## install rbenv and ruby-build +## +RUN groupadd -r rubyuser && useradd -r -g rubyuser -G sudo -p "" --create-home rubyuser + +ENV RBENV_ROOT=/usr/local/rbenv + +# chown after running `rbenv init` because that command creates some subdirectories +RUN git clone https://github.com/rbenv/rbenv.git ${RBENV_ROOT} && \ + git clone https://github.com/rbenv/ruby-build.git ${RBENV_ROOT}/plugins/ruby-build && \ + \ + echo "export RBENV_ROOT=/usr/local/rbenv" >> /etc/rubybashrc && \ + echo "export PATH=$RBENV_ROOT/bin:\$PATH" >> /etc/rubybashrc && \ + $RBENV_ROOT/bin/rbenv init - --no-rehash bash >> /etc/rubybashrc && \ + echo "source /etc/rubybashrc" >> /etc/bashrc && \ + echo "source /etc/rubybashrc" >> /etc/bash.bashrc && \ + \ + chown -R rubyuser:rubyuser ${RBENV_ROOT} && \ + find ${RBENV_ROOT} -type d -print0 | sudo xargs -0 chmod g+sw +ENV BASH_ENV=/etc/rubybashrc + + +## +## set up rake-compiler and install bootstrap rubies +## +USER rubyuser + +ENV RBENV_RUBIES="3.1.7 3.4.5" + +# Install the bootstrap rubies +RUN bash -c " \ + echo 'gem: --no-ri --no-rdoc --no-document' >> ~/.gemrc && \ + export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \ + for v in ${RBENV_RUBIES} ; do \ + rbenv install \$v -- --disable-install-doc ; \ + done && \ + find ${RBENV_ROOT} -type d -print0 | sudo xargs -0 chmod g+w \ +" + +# Install rake-compiler and patch it to build and install static libraries for Linux rubies +COPY build/patches /home/rubyuser/patches +RUN bash -c " \ + for v in ${RBENV_RUBIES} ; do \ + rbenv shell \$v && \ + gem install rake-compiler -v1.2.9 && \ + cd ${RBENV_ROOT}/versions/\$v/lib/ruby/gems/*/gems/rake-compiler-1.2.9 && \ + for patch in /home/rubyuser/patches/rake-compiler-1.2.9/*.patch ; do \ + patch -p1 < \$patch ; \ + done \ + done \ +" + +# Install rake-compiler's cross rubies in global dir instead of /root +RUN sudo mkdir -p /usr/local/rake-compiler && \ + sudo chown rubyuser.rubyuser /usr/local/rake-compiler && \ + ln -s /usr/local/rake-compiler ~/.rake-compiler + +USER root + ## ## Install cross compilers ## @@ -80,64 +139,8 @@ RUN git clone --branch=cross_platform https://github.com/markmentovai/bootstrap_ rm -rf bootstrap_cmds <% end %> - -## -## install rbenv and ruby-build -## -RUN groupadd -r rubyuser && useradd -r -g rubyuser -G sudo -p "" --create-home rubyuser - -ENV RBENV_ROOT=/usr/local/rbenv - -# chown after running `rbenv init` because that command creates some subdirectories -RUN git clone https://github.com/rbenv/rbenv.git ${RBENV_ROOT} && \ - git clone https://github.com/rbenv/ruby-build.git ${RBENV_ROOT}/plugins/ruby-build && \ - \ - echo "export RBENV_ROOT=/usr/local/rbenv" >> /etc/rubybashrc && \ - echo "export PATH=$RBENV_ROOT/bin:\$PATH" >> /etc/rubybashrc && \ - $RBENV_ROOT/bin/rbenv init - --no-rehash bash >> /etc/rubybashrc && \ - echo "source /etc/rubybashrc" >> /etc/bashrc && \ - echo "source /etc/rubybashrc" >> /etc/bash.bashrc && \ - \ - chown -R rubyuser:rubyuser ${RBENV_ROOT} && \ - find ${RBENV_ROOT} -type d -print0 | sudo xargs -0 chmod g+sw -ENV BASH_ENV=/etc/rubybashrc - - -## -## set up rake-compiler and install bootstrap rubies -## USER rubyuser -ENV RBENV_RUBIES="3.1.7 3.4.5" - -# Install the bootstrap rubies -RUN bash -c " \ - echo 'gem: --no-ri --no-rdoc --no-document' >> ~/.gemrc && \ - export CFLAGS='-s -O3 -fno-fast-math -fPIC' && \ - for v in ${RBENV_RUBIES} ; do \ - rbenv install \$v -- --disable-install-doc ; \ - done && \ - find ${RBENV_ROOT} -type d -print0 | sudo xargs -0 chmod g+w \ -" - -# Install rake-compiler and patch it to build and install static libraries for Linux rubies -COPY build/patches /home/rubyuser/patches -RUN bash -c " \ - for v in ${RBENV_RUBIES} ; do \ - rbenv shell \$v && \ - gem install rake-compiler -v1.2.9 && \ - cd ${RBENV_ROOT}/versions/\$v/lib/ruby/gems/*/gems/rake-compiler-1.2.9 && \ - for patch in /home/rubyuser/patches/rake-compiler-1.2.9/*.patch ; do \ - patch -p1 < \$patch ; \ - done \ - done \ -" - -# Install rake-compiler's cross rubies in global dir instead of /root -RUN sudo mkdir -p /usr/local/rake-compiler && \ - sudo chown rubyuser.rubyuser /usr/local/rake-compiler && \ - ln -s /usr/local/rake-compiler ~/.rake-compiler - <% # # Build ruby versions with ruby2_keywords using ruby-3.x diff --git a/Rakefile b/Rakefile index b974dd5..dbedb71 100644 --- a/Rakefile +++ b/Rakefile @@ -11,7 +11,7 @@ RakeCompilerDock::GemHelper.install_tasks def build_mri_images(platforms, host_platforms, output: ) plats = host_platforms.map(&:first).join(",") platforms.each do |platform, _| - sdf = "tmp/docker/Dockerfile.mri.#{platform}.#{host_platforms.first[1]}" + sdf = "tmp/docker/Dockerfile.mri.#{platform}" image_name = RakeCompilerDock::Starter.container_image_name(platform: platform) RakeCompilerDock.docker_build(sdf, tag: image_name, platform: plats, output: output) @@ -25,7 +25,7 @@ end def build_jruby_images(host_platforms, output: ) image_name = RakeCompilerDock::Starter.container_image_name(rubyvm: "jruby") plats = host_platforms.map(&:first).join(",") - sdf = "tmp/docker/Dockerfile.jruby.#{host_platforms.first[1]}" + sdf = "tmp/docker/Dockerfile.jruby" RakeCompilerDock.docker_build(sdf, tag: image_name, platform: plats, output: output) end @@ -48,32 +48,33 @@ platforms = [ ] host_platforms = [ - # tuple is [docker platform, rake task, RUBY_PLATFORM matcher] - ["linux/amd64", "x86", /^x86_64|^x64|^amd64/], - ["linux/arm64", "arm", /^aarch64|arm64/], + # tuple is [docker platform, RUBY_PLATFORM matcher] + ["linux/amd64", /^x86_64|^x64|^amd64/], + ["linux/arm64", /^aarch64|arm64/], ] -local_platform = host_platforms.find { |_,_,reg| reg =~ RUBY_PLATFORM } or +local_platform = host_platforms.find { |_,reg| reg =~ RUBY_PLATFORM } or raise("RUBY_PLATFORM #{RUBY_PLATFORM} is not supported as host") -namespace :build do - - mkdir_p "tmp/docker" +mkdir_p "tmp/docker" - docker_platform, rake_platform, _ = local_platform - platforms.each do |platform, target| - sdf = "tmp/docker/Dockerfile.mri.#{platform}.#{rake_platform}" - df = ERB.new(File.read("Dockerfile.mri.erb"), trim_mode: ">").result(binding) - File.write(sdf, df) - CLEAN.include(sdf) - end - sdf = "tmp/docker/Dockerfile.jruby.#{rake_platform}" - df = File.read("Dockerfile.jruby") +docker_platform, _ = local_platform +platforms.each do |platform, target| + sdf = "tmp/docker/Dockerfile.mri.#{platform}" + df = ERB.new(File.read("Dockerfile.mri.erb"), trim_mode: ">").result(binding) File.write(sdf, df) + CLEAN.include(sdf) +end +sdf = "tmp/docker/Dockerfile.jruby" +df = File.read("Dockerfile.jruby") +File.write(sdf, df) - RakeCompilerDock::ParallelDockerBuild.new(platforms.map{|pl, _| "tmp/docker/Dockerfile.mri.#{pl}.#{rake_platform}" } + ["tmp/docker/Dockerfile.jruby.#{rake_platform}"], workdir: "tmp/docker", task_prefix: "common-#{rake_platform}-", platform: docker_platform) +parallel_docker_build = RakeCompilerDock::ParallelDockerBuild.new(platforms.map{|pl, _| "tmp/docker/Dockerfile.mri.#{pl}" } + ["tmp/docker/Dockerfile.jruby"], workdir: "tmp/docker", task_prefix: "common-") + +namespace :build do + parallel_docker_build.define_rake_tasks platform: docker_platform platforms.each do |platform, target| - sdf = "tmp/docker/Dockerfile.mri.#{platform}.#{rake_platform}" + sdf = "tmp/docker/Dockerfile.mri.#{platform}" # Load image after build on local platform only desc "Build and load image for platform #{platform} on #{docker_platform}" @@ -83,7 +84,7 @@ namespace :build do multitask :images => platform end - sdf = "tmp/docker/Dockerfile.jruby.#{rake_platform}" + sdf = "tmp/docker/Dockerfile.jruby" # Load image after build on local platform only desc "Build and load image for JRuby on #{docker_platform}" task :jruby => sdf do @@ -128,6 +129,48 @@ namespace :release do desc "Push all docker images on #{host_pl}" multitask :images => platform end + + desc "Show download sizes of the release images" + task :sizes do + require "yaml" + + ths = platforms.map do |pl, _| + image_name = RakeCompilerDock::Starter.container_image_name(platform: pl) + Thread.new do + [ pl, + IO.popen("docker manifest inspect #{image_name} -v", &:read) + ] + end + end + + hlayers = Hash.new{|h,k| h[k] = {} } + isize_sums = Hash.new{|h,k| h[k] = 0 } + + ths.map(&:value).each do |pl, ystr| + y = YAML.load(ystr) + y = [y] unless y.is_a?(Array) + y.each do |img| + next unless img + host_pl = "#{img.dig("Descriptor", "platform", "architecture")}-#{ + img.dig("Descriptor", "platform", "os")}" + next if host_pl=="unknown-unknown" + lays = img.dig("OCIManifest", "layers") || img.dig("SchemaV2Manifest", "layers") + isize = lays.map do |lay| + hlayers[host_pl][lay["digest"]] = lay["size"] + end.sum + isize_sums[host_pl] += isize + puts format("%-15s %-20s:%12d MB", host_pl, pl, isize/1024/1024) + end + end + puts "----------" + isize_sums.each do |host_pl, isize| + puts format("%-15s %-20s:%12d MB", host_pl, "all-separate", isize/1024/1024) + end + hlayers.each do |host_pl, layers| + asize = layers.values.sum + puts format("%-15s %-20s:%12d MB", host_pl, "all-combined", asize/1024/1024) + end + end end namespace :prepare do @@ -172,3 +215,16 @@ task :update_lists do EOT end end + +desc "Update CI publish workflows from erb" +namespace :ci do + task :update_workflows do + erb = ERB.new(File.read(".github/workflows/publish-images.yml.erb")) + sdf = ".github/workflows/publish-images.yml" + release = false + File.write(sdf, erb.result(binding)) + sdf = ".github/workflows/release-images.yml" + release = true + File.write(sdf, erb.result(binding)) + end +end diff --git a/build/parallel_docker_build.rb b/build/parallel_docker_build.rb index 4858f35..2922f38 100644 --- a/build/parallel_docker_build.rb +++ b/build/parallel_docker_build.rb @@ -36,7 +36,11 @@ def docker_build(filename, tag: nil, output: false, platform: ) class ParallelDockerBuild include Rake::DSL - def initialize(dockerfiles, workdir: "tmp/docker", inputdir: ".", task_prefix: "common-", platform: "local") + attr_reader :file_deps + attr_reader :tree_deps + attr_reader :final_deps + + def initialize(dockerfiles, workdir: "tmp/docker", inputdir: ".", task_prefix: "common-") FileUtils.mkdir_p(workdir) files = parse_dockerfiles(dockerfiles, inputdir) @@ -45,8 +49,11 @@ def initialize(dockerfiles, workdir: "tmp/docker", inputdir: ".", task_prefix: " vcs = find_commons(files) # pp vcs - define_common_tasks(vcs, workdir, task_prefix) - @platform = platform + @file_deps = {} + @tree_deps = {} + @final_deps = {} + + write_docker_files(vcs, workdir, task_prefix) end # Read given dockerfiles from inputdir and split into a list of commands. @@ -100,27 +107,45 @@ def find_commons(files, vmask=nil, li=0) end.compact.to_h end - # Write intermediate dockerfiles to workdir and define rake tasks - # - # The rake tasks are named after the dockerfiles given to #new . - # This also adds dependant intermediate tasks as prerequisites. - def define_common_tasks(vcs, workdir, task_prefix, plines=[]) + # Write intermediate dockerfiles to workdir and fill properties + def write_docker_files(vcs, workdir, task_prefix, plines=[]) vcs.map do |files, (lines, nvcs)| fn = "#{task_prefix}#{Digest::SHA1.hexdigest(files.join)}" - File.write(File.join(workdir, fn), (plines + lines).join) - task fn do - RakeCompilerDock.docker_build(File.join(workdir, fn), platform: @platform) + wfn = File.join(workdir, fn) + File.write(wfn, (plines + lines).join) + @file_deps[fn] = wfn + + files.each do |file| + @final_deps[file] = fn end - nfn = define_common_tasks(nvcs, workdir, task_prefix, plines + lines) + nfn = write_docker_files(nvcs, workdir, task_prefix, plines + lines) nfn.each do |file| - task file => fn - end - files.each do |file| - task file => fn + @tree_deps[file] = fn end fn end end + + # Define rake tasks for building common docker files + # + # The rake tasks are named after the dockerfiles given to #new . + # This also adds dependant intermediate tasks as prerequisites. + def define_rake_tasks(**build_options) + file_deps.each do |fn, wfn| + # p file_deps: {fn => wfn} + task fn do + RakeCompilerDock.docker_build(wfn, **build_options) + end + end + tree_deps.each do |file, prereq| + # p tree_deps: {file => prereq} + task file => prereq + end + final_deps.each do |file, prereq| + # p final_deps: {file => prereq} + task file => prereq + end + end end end diff --git a/test/test_parallel_docker_build.rb b/test/test_parallel_docker_build.rb index 318fa2d..1bdfb73 100644 --- a/test/test_parallel_docker_build.rb +++ b/test/test_parallel_docker_build.rb @@ -44,7 +44,7 @@ def teardown def test_tasks Dir.chdir(@tmpdir) do - RakeCompilerDock::ParallelDockerBuild.new(%w[ File0 File1 File2 File3 ], task_prefix: "y") + RakeCompilerDock::ParallelDockerBuild.new(%w[ File0 File1 File2 File3 ], task_prefix: "y").define_rake_tasks end assert_operator Rake::Task["File0"].prerequisites, :include?, hd("File0File1")