Skip to content

Commit

Permalink
chore(ci): setup github actions and workflows
Browse files Browse the repository at this point in the history
setup CI/CD for kernel development
- added CodeQL for code scanning
- every pr is built as an image and is available for
  30days on https://oklinux.dev
- tagged and released on github for now

Signed-off-by: sevki <s@sevki.io>
  • Loading branch information
sevki committed Mar 15, 2024
1 parent 25497b7 commit 98eac9d
Show file tree
Hide file tree
Showing 20 changed files with 579 additions and 23 deletions.
140 changes: 140 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '44 8 * * 2'

jobs:
analyze:
name: Analyze
# Runner size impacts CodeQL analysis time. To learn more, please see:
# - https://gh.io/recommended-hardware-resources-for-running-codeql
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners
# Consider using larger runners for possible analysis time improvements.
runs-on: 'ubuntu-latest'
container:
image: debian:latest
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
permissions:
# required for all workflows
security-events: write

# only required for workflows in private repositories
actions: read
contents: read

strategy:
fail-fast: false
matrix:
language: [ 'c-cpp' ]
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Set up okLinux development environment
run: |
./deps
cd kernel
export CHROMEOS_KERNEL_FAMILY=termina
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


- name: Prepare kernel configuration
run: make olddefconfig

- name: Build kernel image
run: make -j$(nproc) bzImage
- name: clean up space
run: |
cd ../
apt-get remove \
bc \
bison \
build-essential \
clang \
cloud-image-utils \
expect \
flex \
g++ \
gcc \
git \
gh \
jq \
libavcodec-dev \
libavutil-dev \
libcap-dev \
libclang-dev \
libdbus-1-dev \
libdrm-dev \
libepoxy-dev \
libelf-dev \
libglib2.0-dev \
libguestfs-tools \
libslirp-dev \
libssl-dev \
libswscale-dev \
libva-dev \
libxext-dev \
lld \
make \
meson \
mypy \
nasm \
ncat \
ninja-build \
openssh-client \
pkg-config \
protobuf-compiler \
qemu-system-x86 \
rsync \
screen \
strace \
tmux -y
apt-get clean -y && apt-get autoremove -y && apt-get autoclean -y
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
33 changes: 33 additions & 0 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

name: Build Kernel Image
on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
container:
image: debian:latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up okLinux environment
if: ${{ steps.release.outputs.release_created }}
run: |
./deps
cd kernel
export CHROMEOS_KERNEL_FAMILY=termina
- name: Prepare kernel configuration
run: make olddefconfig
- name: Build kernel image
run: make -j$(nproc) bzImage
- uses: actions/upload-artifact@v4
with:
name: x86_64
path: arch/x86_64
51 changes: 51 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
container:
image: debian:latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Setup okLinux environment
run: |
./docdeps
/usr/bin/python3 -m venv sphinx
. sphinx/bin/activate
pip install -r ./Documentation/sphinx/requirements.txt
make htmldocs
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './Documentation/output'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
51 changes: 51 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Build PR
on:
pull_request:
branches:
- main

jobs:
build_kernel:
runs-on: ubuntu-latest
container:
image: debian:latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up okLinux environment
run: |
./deps
cd kernel
export CHROMEOS_KERNEL_FAMILY=termina
- name: Prepare kernel configuration
run: make olddefconfig

- name: Build kernel image
run: make -j$(nproc) bzImage
- uses: actions/upload-artifact@v4
with:
name: x86_64
path: arch/x86_64
- uses: actions/upload-artifact@v4
with:
name: bzImage
path: arch/x86_64/boot/bzImage
build_kernel_docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Setup okLinux environment
run: |
./docdeps
/usr/bin/python3 -m venv sphinx
. sphinx/bin/activate
pip install -r ./Documentation/sphinx/requirements.txt
make htmldocs
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './Documentation/output'
23 changes: 23 additions & 0 deletions .github/workflows/propose-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Propose Release

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
container:
image: debian:latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: google-github-actions/release-please-action@v4
id: release
with:
release-type: simple
37 changes: 37 additions & 0 deletions .github/workflows/publlsh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish Image

on:
push:
tags:
- "*"

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
container:
image: debian:latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up okLinux environment
if: ${{ steps.release.outputs.release_created }}
run: |
./deps
cd kernel
export CHROMEOS_KERNEL_FAMILY=termina
- name: Prepare kernel configuration
run: make olddefconfig
- name: Build kernel image
run: make -j$(nproc) bzImage
- uses: actions/upload-artifact@v4
with:
name: x86_64
path: arch/x86_64
- name: Upload Release Artifact
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ steps.release.outputs.tag_name }} ./arch/x86_64/boot/bzImage
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ modules.order
!.kunitconfig
!.mailmap
!.rustfmt.toml
!.github

#
# Generated include files
Expand Down
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "6.6.22"
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 1 addition & 1 deletion Documentation/filesystems/9p.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ Resources
=========

Protocol specifications are maintained on github:
http://ericvh.github.com/9p-rfc/
http://ericvh.github.io/9p-rfc/

9p client and server implementations are listed on
http://9p.cat-v.org/implementations
Expand Down
Binary file added Documentation/images/okLinux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion Documentation/sphinx/kerneldoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,11 @@ def run(self):
lineoffset = int(match.group(1)) - 1
# we must eat our comments since the upset the markup
else:
doc = env.srcdir + "/" + env.docname + ":" + str(self.lineno)
# /workspace/Documentation/sphinx/kerneldoc.py:141: RemovedInSphinx80Warning: Sphinx 8 will drop support for representing paths as strings. Use "pathlib.Path" or "os.fspath" instead.
# doc = env.srcdir + "/" + env.docname + ":" + str(self.lineno)
# FIXME: this is a hack to get the filename into the error message
# doc = env.srcdir + "/" + env.docname + ":" + str(self.lineno)
doc = os.path.join(env.srcdir, env.docname) + ":" + str(self.lineno)
result.append(line, doc + ": " + filename, lineoffset)
lineoffset += 1

Expand Down
4 changes: 2 additions & 2 deletions Documentation/sphinx/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# jinja2>=3.1 is not compatible with Sphinx<4.0
jinja2<3.1
Sphinx==2.4.4
jinja2==3.1.3
Sphinx==7.2.6
3 changes: 2 additions & 1 deletion Documentation/translations/zh_TW/dev-tools/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ Documentation/dev-tools/testing-overview.rst
.. toctree::
:maxdepth: 2

sparse


Todolist:

- sparse
- coccinelle
- kcov
- ubsan
Expand Down
Loading

0 comments on commit 98eac9d

Please sign in to comment.