Skip to content

Commit

Permalink
gh action
Browse files Browse the repository at this point in the history
Signed-off-by: Hajime Tazaki <thehajime@gmail.com>
  • Loading branch information
thehajime committed Sep 10, 2024
1 parent 5b16b67 commit 21486f2
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 0 deletions.
Binary file added .github/workflows/busybox
Binary file not shown.
108 changes: 108 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
on:
push:
branches:
- '**'
pull_request:
branches:
- master

jobs:
tests:
runs-on: ${{ matrix.runs_on }}
strategy:
fail-fast: false
matrix:
include:
- displayTargetName: ubuntu-22.04
os: unix
runs_on: ubuntu-22.04
shell: bash
defconfig: defconfig
- displayTargetName: ubuntu-22.04 (nommu)
os: unix
runs_on: ubuntu-22.04
shell: bash
defconfig: x86_64_nommu_defconfig
timeout-minutes: 100
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
USE_CCACHE: 1

defaults:
run:
shell: ${{ matrix.shell }}

steps:
- name: Set env
shell: bash
run: |
echo "/usr/lib/ccache/bin:/usr/lib/ccache:${{ github.workspace }}/bin" >> $GITHUB_PATH
echo "export PATH=/usr/lib/ccache/bin:/usr/lib/ccache:${{ github.workspace }}/bin:$PATH" >> $HOME/.bashrc
- name: Checkout
uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-ccache-build-${{ github.sha }}
restore-keys: ${{ runner.os }}-ccache-build-
- name: Install packages
if: runner.os == 'Linux'
run: |
sudo apt update -y
sudo apt install -y ccache libseccomp-dev
- name: Build
run: |
make ARCH=um ${{ matrix.defconfig }}
make -j8 ARCH=um
- name: Log in to docker.io
uses: docker/login-action@v3.2.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: image for test
run: |
container_id=$(docker create kollerr/alpine-test:latest)
docker export $container_id > alpine.tar
docker rm $container_id
mnt=$(mktemp -d)
dd if=/dev/zero of=alpine.ext4 bs=1 count=0 seek=1G
sudo chmod og+wr "alpine.ext4"
yes | mkfs."ext4" "alpine.ext4"
mount "alpine.ext4" $mnt
tar -xf alpine.tar -C $mnt
mknod -m 666 $mnt/dev/null c 1 3
mknod -m 666 $mnt/dev/zero c 1 5
mknod -m 666 $mnt/dev/ptmx c 5 2
mknod -m 666 $mnt/dev/tty c 5 0
mknod -m 444 $mnt/dev/random c 1 8
mknod -m 444 $mnt/dev/urandom c 1 9
cp .github/workflow/busybox $mnt/bin/busybox
cp .github/workflow/init.sh $mnt/
umount $mnt
- name: Tests
run: |
./vmlinux ubd0=./alpine.ext4 rw mem=1024m loglevel=8 init=/init.sh uname -a
- name: Save test results
uses: actions/upload-artifact@v2
if: success() || failure()
with:
name: test-results-${{ matrix.displayTargetName }}
path: /tmp/junit/*.xml

checkpatch:
runs-on: ubuntu-22.04
name: checkpatch
steps:
- name: Checkout
with:
fetch-depth: 0
uses: actions/checkout@v2
- name: Install pip dependencies
run: sudo pip install ply GitPython
- name: Check coding style
run: |
git format-patch -o p1 v6.10
for f in `ls p1/*` ; do cat $f | scripts/checkpatch.pl --summary-file --ignore COMMIT_MESSAGE --ignore FILE_PATH_CHANGES - && true ; done
14 changes: 14 additions & 0 deletions .github/workflows/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

mount proc /proc -t proc
/sbin/ifconfig lo 127.0.0.1 up
/sbin/ifconfig eth0 10.0.0.2 up
/sbin/ip route add default via 10.0.0.1 dev eth0
/entropy 100000

export PATH=/home:/sbin:/usr/sbin:/bin:/usr/bin

# hanging
#export PS1="\[$(tput bold)\]\[$(tput setaf 4)\][\[$(tput setaf 5)\]\u\[$(tput setaf 4)\]@\[$(tput setaf 5)\]\h \[$(tput setaf 2)\]\W\[$(tput setaf 4)\]]\\$ \[$(tput sgr0)\]"

exec "$@"

0 comments on commit 21486f2

Please sign in to comment.