diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml new file mode 100644 index 0000000..7047a35 --- /dev/null +++ b/.github/workflows/main.yaml @@ -0,0 +1,23 @@ +# SPDX-FileCopyrightText: 2023 Benjamin Grande M. S. <ben.grande.b@gmail.com> +# +# SPDX-License-Identifier: GPL-3.0-or-later + +--- +name: pre-commit + +# yamllint disable-line rule:truthy +on: [pull_request, push] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0 + + - name: Install dependencies + run: apt update -y && apt install -y gitlint + - name: Gitlint + # yamllint disable-line rule:line-length + run: gitlint --debug --commits ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }} diff --git a/.gitlint b/.gitlint index 59be55b..20e43a0 100644 --- a/.gitlint +++ b/.gitlint @@ -14,7 +14,7 @@ ignore-squash-commits=false fail-without-commits=true regex-style-search=true debug=false -contrib=contrib-title-conventional-commits,contrib-body-requires-signed-off-by,contrib-allowed-authors +contrib=contrib-title-conventional-commits,contrib-body-requires-signed-off-by [title-max-length] line-length=50 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 07367a8..9b418a5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,6 @@ repos: - id: gitlint name: gitlint language: python - #additional_dependencies: ["./gitlint-core[trusted-deps]"] entry: gitlint args: [--staged, --msg-filename] stages: [commit-msg] diff --git a/AUTHORS.md b/AUTHORS.md deleted file mode 100644 index 59d5fb9..0000000 --- a/AUTHORS.md +++ /dev/null @@ -1 +0,0 @@ -Ben Grande <ben.grande.b@gmail.com> diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index fa94694..452645b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,20 +1,65 @@ # Contributing - ## Table of Contents * [Respect](#respect) +* [Environment](#environment) + * [Requirements](#requirements) + * [Lint](#lint) * [Format](#format) * [File naming](#file-naming) * [State ID](#state-id) * [Readme](#readme) - * [Qube naming](#qube-naming) + * [Qube preferences](#qube-preferences) * [Qrexec](#qrexec) ## Respect Be respectful towards peers. +## Environment + +You will need to setup you development environment before you start +contributing. You will need Qubes OS R4 or higher. + +### Requirements + +The following are the packages you need to install: + +General: +- git + +For writing: +- editorconfig +- editorconfig plugin for your editor + +For linting: +- pre-commit +- gitlint +- salt-lint +- shellcheck +- reuse + +For building RPMs: +- dnf +- rpm +- rpmlint + +### Lint + +Lint before you commit, please... else you will have to fix after the PR has +already been sent. + +Install the local hooks: +```sh +pre-commit install -t pre-commit -t commit-msg +``` + +To run pre-commit linters: +```sh +pre-commit run +``` + ## Format ### File naming diff --git a/_modules/qvm_tags.py b/_modules/qvm_tags.py deleted file mode 100644 index 7189772..0000000 --- a/_modules/qvm_tags.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python3 -## TOOD: test usability - -# SPDX-FileCopyrightText: 2016 Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> -# SPDX-FileCopyrightText: 2019 Brian C. Duggan <https://gist.github.com/bcduggan> -# SPDX-FileCopyrightText: 2023 Gonzalo Bulnes Guilpain <gon.bulnes@fastmail.com> -# -# SPDX-License-Identifier: GPL-3.0-or-later - -admin_available = True -try: - import qubesadmin - import qubesadmin.vm -except ImportError: - admin_available = False - - -def __virtual__(): - return admin_available - - -def ext_pillar(minion_id, pillar, *args, **kwargs): - app = qubesadmin.Qubes() - try: - vm = app.domains[minion_id] - except KeyError: - return {} - - return {'qubes': { 'tags': list(vm.tags) } } diff --git a/scripts/spec-build.sh b/scripts/spec-build.sh index d8a96cc..1b8d878 100755 --- a/scripts/spec-build.sh +++ b/scripts/spec-build.sh @@ -26,7 +26,8 @@ spec_gen="./scripts/spec-gen.sh" "${spec_gen}" "${project}" sudo dnf build-dep "${spec}" rpmlint "${spec}" -rpmdev-setuptree +mkdir -p ~/rpmbuild/BUILD ~/rpmbuild/BUILDROOT ~/rpmbuild/RPMS \ + ~/rpmbuild/SOURCES ~/rpmbuild/SPECS ~/rpmbuild/SRPMS cp -r "${group}/${project}" ~/rpmbuild/BUILD/"${group}-${project}" cp -r "${group}/${project}" ~/rpmbuild/SOURCES/"${group}-${project}" rpmbuild -ba "${spec}"