From 2209b7347028edf73362e409b8ca746215f5943f Mon Sep 17 00:00:00 2001 From: fosslinux Date: Wed, 15 Mar 2023 17:06:44 +1100 Subject: [PATCH 1/5] Strip out Cirrus CI --- .cirrus.expect | 15 ----------- .cirrus.yml | 70 -------------------------------------------------- 2 files changed, 85 deletions(-) delete mode 100755 .cirrus.expect delete mode 100644 .cirrus.yml diff --git a/.cirrus.expect b/.cirrus.expect deleted file mode 100755 index 9a9ee41..0000000 --- a/.cirrus.expect +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/expect - -# SPDX-FileCopyrightText: 2021 fosslinux -# -# SPDX-License-Identifier: GPL-3.0-or-later - -set timeout -1 - -spawn python3 rootfs.py --qemu-cmd qemu-system-x86_64 --qemu-ram 3500 -expect { - "not syncing: Attempted to kill init" {} - "Bootstrapping completed." {} -} -send -- "\x01" -send -- "x" diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index f8c8e04..0000000 --- a/.cirrus.yml +++ /dev/null @@ -1,70 +0,0 @@ -# SPDX-FileCopyrightText: 2021 fosslinux -# SPDX-FileCopyrightText: 2021 Andrius Štikonas -# -# SPDX-License-Identifier: GPL-3.0-or-later - -pylint_task: - container: - image: debian:bullseye - deps_script: - - apt-get -y update - - apt-get -y dist-upgrade - - apt-get -y install python3-pip python3-requests - - apt-get -y clean - - pip3 install pylint - check_script: - - pylint rootfs.py sysa.py sysc.py lib/utils.py lib/sysgeneral.py lib/tmpdir.py --disable=duplicate-code - -shell_lint_task: - container: - image: debian:stable - deps_script: - - apt-get -y update - - apt-get -y dist-upgrade - - apt-get -y install shellcheck - - apt-get -y clean - check_script: - - shellcheck sysa/run.sh sysa/run2.sh sysb/init sysb/run.sh sysc/init sysc/run.sh sysa/helpers.sh download-distfiles.sh - -reuse_lint_task: - container: - image: debian:stable - deps_script: - - apt-get -y update - - apt-get -y dist-upgrade - - apt-get -y install python3-pip git - - apt-get -y clean - - pip3 install reuse - check_script: - - reuse lint - -# XXX: Takes too long right now -#run_task: -# timeout_in: 180m -# container: -# image: potyarkin/molecule:host-kvm -# kvm: true -# cpu: 2 -# memory: 4G -# # Required background services -# dbus_background_script: -# - mkdir -p /var/run/dbus -# - /usr/bin/dbus-daemon --system --nofork --nopidfile -# virtlogd_background_script: -# - /usr/sbin/virtlogd -# libvirtd_background_script: -# - sleep 2 && /usr/sbin/libvirtd -# iptables_legacy_script: -# - update-alternatives --set iptables /usr/sbin/iptables-legacy -# deps_script: -# - apt-get -y update -# - apt-get -y dist-upgrade -# - apt-get -y install sudo git cpio linux-image-4.19.0-16-amd64 expect wget -# - apt-get -y clean -# submodule_script: -# - git submodule update --init --recursive -# kernel_script: -# - cp /boot/vmlinuz-4.19.0-16-amd64 ./kernel -# run_script: -# - ./.cirrus.expect | tee -a /tmp/run.log -# - grep -q 'Bootstrapping completed.' /tmp/run.log From 81000c8075806d7aa9101aa866658e216cea70ae Mon Sep 17 00:00:00 2001 From: fosslinux Date: Wed, 15 Mar 2023 17:18:34 +1100 Subject: [PATCH 2/5] Add GH actions for linters --- .github/workflows/lint.yml | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..dac1ca1 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,42 @@ +# SPDX-FileCopyrightText: 2023 fosslinux +# +# SPDX-License-Identifier: GPL-3.0-or-later + +name: Linters + +on: + workflow_dispatch: + pull_request: + push: + +jobs: + pylint: + name: Lint Python files + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Install pylint + run: sudo pip3 install pylint + - name: pylint + run: pylint rootfs.py sysa.py sysc.py lib/utils.py lib/sysgeneral.py lib/tmpdir.py --disable=duplicate-code + + shellcheck: + name: Lint shell files + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: shellcheck + run: shellcheck sysa/run.sh sysa/run2.sh sysb/init sysb/run.sh sysc/init sysc/run.sh sysa/helpers.sh download-distfiles.sh + + reuse: + name: Lint reuse information + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v3 + - name: Install reuse + run: sudo pip3 install reuse + - name: reuse + run: reuse lint From bca80e53d013e39ce3668872293f3759f227334e Mon Sep 17 00:00:00 2001 From: fosslinux Date: Wed, 15 Mar 2023 17:20:49 +1100 Subject: [PATCH 3/5] Temporarily silence a (not-new) warning from pylint --- sysa.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sysa.py b/sysa.py index 7aa57a8..e495f2a 100755 --- a/sysa.py +++ b/sysa.py @@ -7,6 +7,7 @@ # SPDX-FileCopyrightText: 2021-23 fosslinux import os +# pylint: disable=deprecated-module from distutils.dir_util import copy_tree import shutil import tarfile From 99566357601a4f6d549aa7bb2bc11a6b2721ab1d Mon Sep 17 00:00:00 2001 From: fosslinux Date: Wed, 15 Mar 2023 17:46:11 +1100 Subject: [PATCH 4/5] Run bwrap live-bootstrap on GH actions --- .github/workflows/bwrap.yml | 50 +++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .github/workflows/bwrap.yml diff --git a/.github/workflows/bwrap.yml b/.github/workflows/bwrap.yml new file mode 100644 index 0000000..0d764b4 --- /dev/null +++ b/.github/workflows/bwrap.yml @@ -0,0 +1,50 @@ +# SPDX-FileCopyrightText: 2023 fosslinux +# +# SPDX-License-Identifier: GPL-3.0-or-later + +name: Run under bubblewrap + +on: + workflow_dispatch: + pull_request: + push: + +jobs: + run: + name: Run under bubblewrap + runs-on: ubuntu-latest + steps: + - name: Install bubblewrap + run: sudo apt install bubblewrap + - name: Checkout repo + uses: actions/checkout@v3 + with: + submodules: recursive + - name: Query cache for sources + id: cache + uses: actions/cache/restore@v3 + with: + path: | + sysa/distfiles + sysc/distfiles + key: cache-${{ hashFiles('sys*/*/sources') }} + - name: Get sources + if: steps.cache.outputs.cache-hit != 'true' + run: ./download-distfiles.sh + - name: Cache sources + if: steps.cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v3 + with: + path: | + sysa/distfiles + sysc/distfiles + key: cache-${{ hashFiles('sys*/*/sources') }} + - name: Run bootstrap + id: bootstrap + run: ./rootfs.py --bwrap --external-sources --preserve + - name: Archive created packages + if: steps.bootstrap.conclusion == 'success' + uses: actions/upload-artifact@v3 + with: + name: packages + path: tmp/sysa/sysc_image/usr/src/repo/** From 60dc725221f4deb2cb6c638d5a664051cbec0fa5 Mon Sep 17 00:00:00 2001 From: fosslinux Date: Thu, 16 Mar 2023 19:09:13 +1100 Subject: [PATCH 5/5] Only run on master branch --- .github/workflows/bwrap.yml | 2 ++ .github/workflows/lint.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/bwrap.yml b/.github/workflows/bwrap.yml index 0d764b4..92cb662 100644 --- a/.github/workflows/bwrap.yml +++ b/.github/workflows/bwrap.yml @@ -8,6 +8,8 @@ on: workflow_dispatch: pull_request: push: + branches: + - master jobs: run: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index dac1ca1..639d3d3 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,6 +8,8 @@ on: workflow_dispatch: pull_request: push: + branches: + - master jobs: pylint: