Skip to content

Update build.yml

Update build.yml #33

Workflow file for this run

name: Lint Check
on:
pull_request:
push:
branches: main
paths:
- 'lxc/**'
- '.github/workflows/check.yml'
- 'kernelsu/**'
- 'tests/*.ts'
jobs:
yaml-check:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Check yaml
run: cd tests && bun run index.ts
- name: Clean Workspace
run: bun run tests/clean.ts
js-check:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependence
run: cd tests && yarn install
- name: Check js
run: cd tests && npm run lint
sh-check:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
lint: [shellcheck, shfmt]
steps:
- uses: actions/checkout@v4
- name: ShellCheck lint
if: matrix.lint == 'shellcheck'
uses: ludeeus/action-shellcheck@2.0.0
- name: shfmt lint
if: matrix.lint == 'shfmt'
run: |
export HOST_ARCH=$(dpkg --print-architecture)
case ${HOST_ARCH} in
armv7* | armv8l | armhf | arm) aria2c https://github.com/mvdan/sh/releases/download/v3.9.0/shfmt_v3.9.0_linux_arm -o shfmt ;;
i*86 | x86) aria2c https://github.com/mvdan/sh/releases/download/v3.9.0/shfmt_v3.9.0_linux_x86 -o shfmt ;;
amd64 | x86_64) aria2c https://github.com/mvdan/sh/releases/download/v3.9.0/shfmt_v3.9.0_linux_amd64 -o shfmt ;;
aarch64 | arm64) aria2c https://github.com/mvdan/sh/releases/download/v3.9.0/shfmt_v3.9.0_linux_arm64 -o shfmt ;;
*) echo "Unknow cpu architecture for this device !" && exit 1 ;;
esac
chmod 755 -R ./shfmt
./shfmt -w -i 2 $(find -name *.sh)