feat(debian): enable cache in CI #22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Debian Packages | |
| on: [push] | |
| jobs: | |
| debian-build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - runner: ubuntu-24.04 | |
| arch: amd64 | |
| # - runner: ubuntu-24.04-arm | |
| # arch: arm64 | |
| # - runner: ubuntu-24.04-riscv | |
| # arch: riscv64 | |
| runs-on: ${{ matrix.runner }} | |
| name: Debian Build | |
| permissions: | |
| packages: write | |
| contents: read | |
| steps: | |
| - name: Checkout machine emulator source code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| submodules: recursive | |
| - name: Setup up Docker Buildx | |
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 | |
| - name: Make builder container image | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 | |
| with: | |
| context: debian | |
| file: debian/Dockerfile | |
| platforms: linux/${{ matrix.arch }} | |
| tags: cartesi/deb-builder-${{ matrix.arch }} | |
| load: true | |
| push: false | |
| cache-from: type=gha,scope=${{ matrix.arch }} | |
| cache-to: type=gha,scope=${{ matrix.arch }},mode=max | |
| - name: Restore cached packages | |
| uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: cdn/apt | |
| key: apt-packages-${{ matrix.arch }}-${{ github.sha }} | |
| restore-keys: | | |
| apt-packages-${{ matrix.arch }}- | |
| - name: Build packages | |
| working-directory: debian | |
| run: | | |
| make cartesi-machine-linux-image.deb TARGET_ARCH=${{ matrix.arch }} | |
| - name: Export builder container image | |
| run: docker save cartesi/deb-builder-${{ matrix.arch }} | gzip > /tmp/deb-builder-${{ matrix.arch }}.tar.gz | |
| - name: Upload builder container image | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: image-deb-builder-${{ matrix.arch }} | |
| path: /tmp/deb-builder-${{ matrix.arch }}.tar.gz | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 | |
| with: | |
| name: artifacts-apt-${{ matrix.arch }} | |
| path: cdn/apt |