|
1 | 1 | name: Build
|
2 | 2 | on: [push]
|
3 |
| -env: |
4 |
| - TOOLCHAIN_REPOSITORY: cartesi/toolchain |
5 |
| - TOOLCHAIN_VERSION: 0.15.0 |
6 |
| - CACHE_DIR: /home/runner/work/image-rootfs/image-rootfs/cache |
7 |
| -permissions: |
8 |
| - id-token: write |
9 |
| - packages: write |
10 |
| - contents: read |
11 | 3 | jobs:
|
12 | 4 | build:
|
13 |
| - runs-on: ubuntu-22.04 |
| 5 | + runs-on: ubuntu-latest |
14 | 6 | steps:
|
15 |
| - - uses: actions/checkout@v3 |
| 7 | + - name: Install libarchive-tools |
| 8 | + run: | |
| 9 | + export DEBIAN_FRONTEND=noninteractive |
| 10 | + sudo apt-get update |
| 11 | + sudo apt-get install -y --no-install-recommends build-essential autoconf automake libarchive-dev libarchive-tools pandoc |
| 12 | +
|
| 13 | + # Building from source cause the provided debian package is for Debian Bookworm |
| 14 | + - name: Download, build and install xgenext2fs |
| 15 | + run: | |
| 16 | + wget https://github.com/cartesi/genext2fs/archive/refs/tags/v1.5.6.tar.gz |
| 17 | + echo "34bfc26a037def23b85b676912462a3d126a87ef15c66c212b3500650da44f9e v1.5.6.tar.gz" | sha256sum -c - |
| 18 | + tar -xzf v1.5.6.tar.gz |
| 19 | + cd genext2fs-1.5.6 |
| 20 | + ./autogen.sh |
| 21 | + ./configure |
| 22 | + make |
| 23 | + sudo make install |
| 24 | + rm -rf genext2fs-1.5.6 v1.5.6.tar.gz |
| 25 | + - uses: actions/checkout@v4 |
16 | 26 | with:
|
17 | 27 | submodules: recursive
|
18 |
| - fetch-depth: 0 # fetch tags |
19 | 28 |
|
20 |
| - - name: Copy default Buildroot and Busybox config |
21 |
| - run: make init-config |
| 29 | + - name: Set up QEMU |
| 30 | + uses: docker/setup-qemu-action@v3 |
22 | 31 |
|
23 |
| - - name: Resolve rootfs filename from Makefile |
24 |
| - run: echo ROOTFS_FILENAME="$(make rootfs-filename)" >> $GITHUB_ENV |
| 32 | + - name: Buildx setup |
| 33 | + uses: docker/setup-buildx-action@v3 |
25 | 34 |
|
26 |
| - - name: Docker meta |
27 |
| - id: docker_meta |
28 |
| - uses: docker/metadata-action@v4 |
29 |
| - with: |
30 |
| - images: | |
31 |
| - ghcr.io/${{ github.repository_owner }}/rootfs |
32 |
| - docker.io/${{ github.repository_owner }}/rootfs,enable=${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/v') }} |
33 |
| - tags: | |
34 |
| - type=ref,event=branch |
35 |
| - type=semver,pattern={{version}} |
36 |
| -
|
37 |
| - - name: Login to GitHub Container Registry |
38 |
| - uses: docker/login-action@v2 |
39 |
| - with: |
40 |
| - registry: ghcr.io |
41 |
| - username: ${{ github.actor }} |
42 |
| - password: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + - name: Build rootfs.ext2 artifact |
| 36 | + run: make build |
43 | 37 |
|
44 |
| - - name: Login to Docker Hub |
45 |
| - uses: docker/login-action@v2 |
| 38 | + - name: Upload artifacts |
| 39 | + uses: actions/upload-artifact@v4 |
46 | 40 | with:
|
47 |
| - username: ${{ secrets.DOCKER_USERNAME }} |
48 |
| - password: ${{ secrets.DOCKER_PASSWORD }} |
49 |
| - |
50 |
| - - name: Set up Depot CLI |
51 |
| - uses: depot/setup-action@v1 |
52 |
| - |
53 |
| - - name: Create distribution details |
54 |
| - run: make os-release |
55 |
| - |
56 |
| - - name: Build docker image |
57 |
| - uses: depot/build-push-action@v1 |
58 |
| - with: |
59 |
| - context: . |
60 |
| - platforms: linux/amd64,linux/arm64 |
61 |
| - tags: cartesi/rootfs:devel |
62 |
| - push: false |
63 |
| - load: true |
64 |
| - build-args: | |
65 |
| - TOOLCHAIN_REPOSITORY=${{ env.TOOLCHAIN_REPOSITORY }} |
66 |
| - TOOLCHAIN_VERSION=${{ env.TOOLCHAIN_VERSION }} |
67 |
| - ROOTFS_FILENAME=${{ env.ROOTFS_FILENAME }} |
68 |
| - cache-from: type=gha,scope=regular |
69 |
| - cache-to: type=gha,mode=max,scope=regular |
70 |
| - project: ${{ vars.DEPOT_PROJECT }} |
71 |
| - |
72 |
| - - name: Export rootfs.ext2 artifact |
73 |
| - run: make copy |
74 |
| - |
75 |
| - - name: Export download cache |
76 |
| - run: make copy-br2-dl-cache CACHE_DIR=${{ env.CACHE_DIR }} |
| 41 | + if-no-files-found: error |
| 42 | + path: | |
| 43 | + rootfs.ext2 |
77 | 44 |
|
78 | 45 | - uses: softprops/action-gh-release@v1
|
79 | 46 | if: startsWith(github.ref, 'refs/tags/v')
|
80 | 47 | with:
|
81 | 48 | prerelease: true
|
82 |
| - files: rootfs-*.ext2 |
| 49 | + files: rootfs.ext2 |
83 | 50 | env:
|
84 | 51 | GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
|
85 |
| - |
86 |
| - - name: Push docker image |
87 |
| - uses: depot/build-push-action@v1 |
88 |
| - with: |
89 |
| - context: . |
90 |
| - platforms: linux/amd64,linux/arm64 |
91 |
| - tags: ${{ steps.docker_meta.outputs.tags }} |
92 |
| - push: true |
93 |
| - load: false |
94 |
| - build-args: | |
95 |
| - TOOLCHAIN_REPOSITORY=${{ env.TOOLCHAIN_REPOSITORY }} |
96 |
| - TOOLCHAIN_VERSION=${{ env.TOOLCHAIN_VERSION }} |
97 |
| - cache-from: type=gha,scope=regular |
98 |
| - cache-to: type=gha,mode=max,scope=regular |
99 |
| - project: ${{ vars.DEPOT_PROJECT }} |
0 commit comments