Skip to content

Commit

Permalink
feat: Build for amd64 and arm64 using depot.dev
Browse files Browse the repository at this point in the history
  • Loading branch information
vfusco committed Aug 14, 2023
1 parent 7c12f36 commit b1a19d0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 45 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.git*
linux-*.elf
linux*.bin
linux*.tar.xz
linux*.ext2
configs
README.md
work
67 changes: 22 additions & 45 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,81 +1,58 @@
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

- 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:
registry: ghcr.io
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: |
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 }}

0 comments on commit b1a19d0

Please sign in to comment.