-
Notifications
You must be signed in to change notification settings - Fork 69
50 lines (50 loc) · 2.25 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: build-and-run-mambo
run-name: Building and running MAMBO triggered by ${{ github.actor }} on ${{ github.ref }}
on:
push:
branches: [master]
pull_request:
types: [opened, synchronize, reopened]
jobs:
build-and-run-mambo:
strategy:
matrix:
os: [focal]
arch: [ {os: arm64, qemu: aarch64}, {os: riscv64, qemu: riscv64}, {os: armhf, qemu: arm} ]
fail-fast: false
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
path: mambo
submodules: true
- name: Set up host environment
run: |
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y debootstrap
sudo apt-get install -y qemu-user-static
sudo mkdir -p /tmp/chroot/
sudo chown root /bin/tar
sudo chmod u+s /bin/tar
- uses: actions/cache/restore@v4
id: cache
with:
path: /tmp/chroot/${{ matrix.arch.os }}
key: ${{ matrix.os }}.${{ matrix.arch.os }}
- name: Install and configure sysroot
if: steps.cache.outputs.cache-hit != 'true'
run: |
sudo debootstrap --arch=${{ matrix.arch.os }} --foreign ${{ matrix.os }} /tmp/chroot/${{ matrix.arch.os }} http://ports.ubuntu.com/ubuntu-ports
sudo cp /usr/bin/qemu-${{ matrix.arch.qemu }}-static /tmp/chroot/${{ matrix.arch.os }}/usr/bin/
sudo chroot /tmp/chroot/${{ matrix.arch.os }}/ /usr/bin/qemu-${{ matrix.arch.qemu }}-static /bin/bash -c '/debootstrap/debootstrap --second-stage'
- uses: actions/cache/save@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
path: /tmp/chroot/${{ matrix.arch.os }}
key: ${{ matrix.os }}.${{ matrix.arch.os }}
- name: Build and run MAMBO inside chroot
run: |
sudo cp -r $GITHUB_WORKSPACE/mambo /tmp/chroot/${{ matrix.arch.os }}/root
sudo chroot /tmp/chroot/${{ matrix.arch.os }}/ /usr/bin/qemu-${{ matrix.arch.qemu }}-static /bin/bash -c 'sudo apt-get update; sudo apt-get upgrade -y; sudo apt-get -y install build-essential libelf-dev ruby; cd /root/mambo/; make'
sudo chroot /tmp/chroot/${{ matrix.arch.os }}/ /usr/bin/qemu-${{ matrix.arch.qemu }}-static /bin/bash -c '/root/mambo/dbm /bin/ls'