This commit is contained in:
Ben Grande 2023-11-06 15:18:59 +00:00
parent f345ebc8a1
commit 6fb526768f
No known key found for this signature in database
GPG Key ID: 00C64E14F51F9E56
7 changed files with 73 additions and 35 deletions

23
.github/workflows/main.yaml vendored Normal file

@ -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 }}

@ -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

@ -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]

@ -1 +0,0 @@
Ben Grande <ben.grande.b@gmail.com>

@ -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

@ -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) } }

@ -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}"