From 49057f53063175a0e2431804ec5b019951ea2c4b Mon Sep 17 00:00:00 2001 From: blackroad Date: Sat, 14 Mar 2026 16:40:35 -0500 Subject: [PATCH] =?UTF-8?q?Add=20CI=20workflow=20=E2=80=94=20BlackRoad=20O?= =?UTF-8?q?S?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/ci.yml | 72 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .gitea/workflows/ci.yml diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml new file mode 100644 index 0000000..5ace733 --- /dev/null +++ b/.gitea/workflows/ci.yml @@ -0,0 +1,72 @@ +# BlackRoad OS — Pave Tomorrow. +# Universal Linter — auto-detects language +name: Lint & Format + +on: + push: + branches: [main] + pull_request: + +jobs: + detect: + runs-on: ubuntu-latest + outputs: + has_js: ${{ steps.check.outputs.has_js }} + has_py: ${{ steps.check.outputs.has_py }} + has_sh: ${{ steps.check.outputs.has_sh }} + has_go: ${{ steps.check.outputs.has_go }} + steps: + - uses: actions/checkout@v4 + - id: check + run: | + echo "has_js=$(test -f package.json && echo true || echo false)" >> $GITHUB_OUTPUT + echo "has_py=$(test -f requirements.txt -o -f setup.py -o -f pyproject.toml && echo true || echo false)" >> $GITHUB_OUTPUT + echo "has_sh=$(find . -name '*.sh' -maxdepth 3 | head -1 | grep -q . && echo true || echo false)" >> $GITHUB_OUTPUT + echo "has_go=$(test -f go.mod && echo true || echo false)" >> $GITHUB_OUTPUT + + js-lint: + needs: detect + if: needs.detect.outputs.has_js == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '20' + - run: npm ci + - run: npx eslint . --max-warnings 0 || true + - run: npx prettier --check . 2>/dev/null || true + + py-lint: + needs: detect + if: needs.detect.outputs.has_py == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.12' + - run: pip install flake8 black + - run: flake8 . --max-line-length 120 --count --show-source + - run: black --check . + + sh-lint: + needs: detect + if: needs.detect.outputs.has_sh == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: sudo apt-get install -y shellcheck + - run: find . -name '*.sh' -exec shellcheck {} + + + go-lint: + needs: detect + if: needs.detect.outputs.has_go == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: 'stable' + - run: go vet ./... + - run: test -z "$(gofmt -l .)"