From b1a19d093935db2f5c0c36315d44a49936866683 Mon Sep 17 00:00:00 2001 From: Victor Fusco <1221933+vfusco@users.noreply.github.com> Date: Sat, 12 Aug 2023 13:11:38 -0300 Subject: [PATCH] feat: Build for amd64 and arm64 using depot.dev --- .dockerignore | 2 ++ .github/workflows/main.yml | 67 +++++++++++++------------------------- 2 files changed, 24 insertions(+), 45 deletions(-) diff --git a/.dockerignore b/.dockerignore index 08c292e..a215e73 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,6 +1,8 @@ .git* +linux-*.elf linux*.bin linux*.tar.xz +linux*.ext2 configs README.md work diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1685604..4c3746e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,19 +1,14 @@ name: Build on: [push] -<<<<<<< HEAD -======= -env: - KERNEL_VERSION: 5.15.63-ctsi-2 - RISCV_PK_VERSION: 1.0.0-ctsi-1 - TOOLCHAIN_REPOSITORY: cartesi/toolchain - TOOLCHAIN_VERSION: 0.15.0 ->>>>>>> cc77330 (feat!: Update toolchain version to v0.15.0) +permissions: + id-token: write + packages: write + contents: read jobs: build: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v3 -<<<<<<< HEAD - name: Retrieve environment variables run: make env >> $GITHUB_ENV @@ -21,39 +16,23 @@ jobs: - name: Copy default Cartesi Linux config run: make cartesi-linux-config - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 -======= ->>>>>>> cc77330 (feat!: Update toolchain version to v0.15.0) - - - name: Set up Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v2 - - name: Docker meta id: docker_meta uses: docker/metadata-action@v4 with: - images: ${{ github.repository_owner }}/linux-kernel + images: | + ghcr.io/${{ github.repository_owner }}/linux-kernel + docker.io/${{ github.repository_owner }}/linux-kernel,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/v') }} tags: | type=ref,event=branch type=semver,pattern={{version}} -<<<<<<< HEAD - - name: Login to GHCR -======= - name: Login to Docker Hub ->>>>>>> cc77330 (feat!: Update toolchain version to v0.15.0) uses: docker/login-action@v2 with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} -<<<<<<< HEAD - - name: Download dependencies - run: make download -======= - name: Login to GitHub Container Registry uses: docker/login-action@v2 with: @@ -61,21 +40,19 @@ jobs: username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Download linux and riscv-pk - run: make checksum + - name: Download dependencies + run: make download - - name: Copy default Cartesi Linux config - run: make cartesi-linux-config ->>>>>>> cc77330 (feat!: Update toolchain version to v0.15.0) + - name: Set up Depot CLI + uses: depot/setup-action@v1 - name: Build docker image id: docker_build - uses: docker/build-push-action@v4 + uses: depot/build-push-action@v1 with: context: . - builder: ${{ steps.buildx.outputs.name }} - platforms: linux/amd64 - tags: ${{ steps.docker_meta.outputs.tags }} + platforms: linux/amd64,linux/arm64 + tags: cartesi/linux-kernel:devel push: false load: true build-args: | @@ -86,9 +63,10 @@ jobs: RISCV_PK_VERSION=${{ env.RISCV_PK_VERSION }} cache-from: type=gha,scope=regular cache-to: type=gha,mode=max,scope=regular + project: ${{ vars.DEPOT_PROJECT }} - - name: Export artifacts - run: make copy IMG=`echo "${{ steps.docker_meta.outputs.tags }}" | head -1 | cut -d "," -f 1 | xargs` + - name: Export linux.bin artifact + run: make copy - name: Upload artifacts uses: actions/upload-artifact@v3 @@ -106,12 +84,10 @@ jobs: - name: Push docker image id: docker_push - uses: docker/build-push-action@v4 - if: ${{ startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/develop') }} + uses: depot/build-push-action@v1 with: context: . - builder: ${{ steps.buildx.outputs.name }} - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 tags: ${{ steps.docker_meta.outputs.tags }} push: true load: false @@ -123,3 +99,4 @@ jobs: RISCV_PK_VERSION=${{ env.RISCV_PK_VERSION }} cache-from: type=gha,scope=regular cache-to: type=gha,mode=max,scope=regular + project: ${{ vars.DEPOT_PROJECT }}