diff --git a/.github/workflows/build/action.yml b/.github/workflows/build/action.yml new file mode 100644 index 0000000..43eb442 --- /dev/null +++ b/.github/workflows/build/action.yml @@ -0,0 +1,13 @@ +name: build + +runs: + using: composite + + steps: + - name: Install dependencies + shell: bash + run: pip install pre-commit + + - name: Lint + shell: bash + run: pre-commit run --all diff --git a/.github/workflows/gerrit.yml b/.github/workflows/gerrit.yml new file mode 100644 index 0000000..906027a --- /dev/null +++ b/.github/workflows/gerrit.yml @@ -0,0 +1,38 @@ +name: gerrit checks + +on: + workflow_dispatch: + inputs: + ref: + type: string + gerrit-ref: + type: string + change: + type: string + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: lineageos-infra/fetch-gerrit-change@main + with: + gerrit-ref: ${{ inputs.gerrit-ref }} + ref: ${{ inputs.ref }} + + - name: Check if build/action.yml exists + id: check + run: | + if [ -f ./.github/workflows/build/action.yml ]; then + echo "run=1" >> "$GITHUB_OUTPUT" + fi + + - name: Build + if: ${{ steps.check.outputs.run }} + uses: ./.github/workflows/build + + - uses: lineageos-infra/gerrit-vote@main + if: ${{ steps.check.outputs.run && always() }} + with: + auth: ${{ secrets.GERRIT_VOTE_CREDS }} + change: ${{ inputs.change }} + ref: ${{ inputs.ref }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..a685326 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,15 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks + rev: v2.15.0 + hooks: + - id: pretty-format-kotlin + args: [--autofix, --ktfmt, --ktfmt-style=kotlinlang]