name: Extract syscalls/error numbers
on:
push:
branches: [test-ci]
schedule:
- cron: '0 0 * * 0'
workflow_dispatch: {}
defaults:
run:
shell: bash
jobs:
extract-nrs:
name: Extract syscalls
strategy:
fail-fast: false
continue-on-error: false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build Linux kernel headers
run: |
set -e
cd ${{ runner.temp }}
git clone --depth=1 git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux
make headers
for arch in arm64 arm mips powerpc sparc x86; do
make ARCH="${arch}" archheaders
done
- name: Download FreeBSD/macOS syscalls.master and errno.h
run: |
set -e
wget https://github.com/freebsd/freebsd-src/raw/main/sys/kern/syscalls.master -O ${{ runner.temp }}/freebsd-syscalls.master
wget https://github.com/freebsd/freebsd-src/raw/main/sys/sys/errno.h -O ${{ runner.temp }}/freebsd-errno.h
wget https://github.com/apple/darwin-xnu/raw/main/bsd/kern/syscalls.master -O ${{ runner.temp }}/macos-syscalls.master
wget https://github.com/apple/darwin-xnu/raw/main/bsd/sys/errno.h -O ${{ runner.temp }}/macos-errno.h
- name: Build new syscall/error number files
run: |
set -e
cd tools
python3 nr_from_src.py ${{ runner.temp }}/linux
python3 eno_from_src.py ${{ runner.temp }}/linux
python3 bsd_nr_from_src.py ${{ runner.temp }}/freebsd-syscalls.master freebsd
python3 bsd_eno_from_src.py ${{ runner.temp }}/freebsd-errno.h freebsd
python3 bsd_nr_from_src.py ${{ runner.temp }}/macos-syscalls.master macos
python3 bsd_eno_from_src.py ${{ runner.temp }}/macos-errno.h macos
- name: Check for changes
run: |
if [ -n "$(git status --porcelain=v1)" ]; then
echo 'has_changes=true' >>$GITHUB_ENV
fi
- name: Push changes
if: ${{ env.has_changes == 'true' }}
run: |
set -e
git add .
git config user.name ${{ github.repository_owner }}
git config user.email ${{ github.repository_owner }}@users.noreply.github.com
git commit -m "nr: update based on kernel sources"
git push --force https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git HEAD:syscalls-auto