mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-04-20 12:18:00 +03:00
Compare commits
4 Commits
b3a0f52824
...
4174eafd6b
| Author | SHA1 | Date | |
|---|---|---|---|
| 4174eafd6b | |||
| 09221fd611 | |||
| b3153fcc49 | |||
| 312cfe9b41 |
@@ -9,34 +9,37 @@ name: Matrix CI
|
|||||||
|
|
||||||
on: [push, pull_request] # yamllint disable-line rule:truthy
|
on: [push, pull_request] # yamllint disable-line rule:truthy
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
yamllint:
|
prek:
|
||||||
name: yamllint
|
name: Run prek hooks
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Check out
|
|
||||||
uses: actions/checkout@v6
|
|
||||||
- name: Run yamllint
|
|
||||||
uses: frenck/action-yamllint@v1.5.0
|
|
||||||
ansible-lint:
|
|
||||||
name: ansible-lint
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: docker.io/archlinux:base-devel
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
# git must be installed before checkout so it does a proper clone
|
||||||
|
# (with .git directory) instead of a tarball download.
|
||||||
|
- name: Install git
|
||||||
|
run: pacman -Sy --noconfirm git
|
||||||
|
|
||||||
- name: Check out
|
- name: Check out
|
||||||
uses: actions/checkout@v6
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Run ansible-lint
|
- name: Restore prek cache
|
||||||
uses: ansible/ansible-lint@v26.3.0
|
uses: actions/cache@v5
|
||||||
with:
|
with:
|
||||||
args: "roles/custom"
|
path: var/prek
|
||||||
setup_python: "true"
|
key: arch-prek-v1-${{ hashFiles('.pre-commit-config.yaml') }}
|
||||||
working_directory: ""
|
|
||||||
requirements_file: requirements.yml
|
- name: Install dependencies
|
||||||
precommit:
|
run: pacman -S --noconfirm --needed just mise python
|
||||||
name: Run pre-commit
|
|
||||||
runs-on: ubuntu-latest
|
- name: Run prek hooks
|
||||||
steps:
|
run: |
|
||||||
- name: Checkout code
|
# The checkout action sets safe.directory using its own bundled
|
||||||
uses: actions/checkout@v6
|
# git, which is separate from the pacman-installed git that prek uses.
|
||||||
- name: Run pre-commit
|
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||||
uses: pre-commit/action@v3.0.1
|
just prek-run-on-all
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
.python-version
|
.python-version
|
||||||
.idea/
|
.idea/
|
||||||
.direnv/
|
.direnv/
|
||||||
|
/var/
|
||||||
|
|
||||||
# ignore roles pulled by ansible-galaxy
|
# ignore roles pulled by ansible-galaxy
|
||||||
/roles/galaxy/*
|
/roles/galaxy/*
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
---
|
---
|
||||||
default_install_hook_types: [pre-push]
|
|
||||||
|
|
||||||
exclude: "LICENSES/"
|
exclude: "^(LICENSES/|var/)"
|
||||||
|
|
||||||
# See: https://pre-commit.com/hooks.html
|
# See: https://pre-commit.com/hooks.html
|
||||||
repos:
|
repos:
|
||||||
@@ -24,3 +23,10 @@ repos:
|
|||||||
rev: v6.2.0
|
rev: v6.2.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: reuse
|
- id: reuse
|
||||||
|
- repo: https://github.com/ansible/ansible-lint
|
||||||
|
rev: v26.3.0
|
||||||
|
hooks:
|
||||||
|
- id: ansible-lint
|
||||||
|
files: '^roles/custom/'
|
||||||
|
args: ['roles/custom']
|
||||||
|
pass_filenames: false
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
devShells.default = mkShell {
|
devShells.default = mkShell {
|
||||||
buildInputs = [
|
buildInputs = [
|
||||||
just
|
just
|
||||||
|
mise
|
||||||
ansible
|
ansible
|
||||||
];
|
];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
|
|||||||
@@ -4,6 +4,11 @@
|
|||||||
#
|
#
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
# mise (dev tool version manager)
|
||||||
|
mise_data_dir := env("MISE_DATA_DIR", justfile_directory() / "var/mise")
|
||||||
|
mise_trusted_config_paths := justfile_directory() / "mise.toml"
|
||||||
|
prek_home := env("PREK_HOME", justfile_directory() / "var/prek")
|
||||||
|
|
||||||
# Shows help
|
# Shows help
|
||||||
default:
|
default:
|
||||||
@{{ just_executable() }} --list --justfile "{{ justfile() }}"
|
@{{ just_executable() }} --list --justfile "{{ justfile() }}"
|
||||||
@@ -39,9 +44,39 @@ update-playbook-only:
|
|||||||
@git pull -q
|
@git pull -q
|
||||||
@-git stash pop -q
|
@-git stash pop -q
|
||||||
|
|
||||||
# Runs ansible-lint against all roles in the playbook
|
# Invokes mise with the project-local data directory
|
||||||
lint:
|
mise *args: _ensure_mise_data_directory
|
||||||
ansible-lint
|
#!/bin/sh
|
||||||
|
export MISE_DATA_DIR="{{ mise_data_dir }}"
|
||||||
|
export MISE_TRUSTED_CONFIG_PATHS="{{ mise_trusted_config_paths }}"
|
||||||
|
export MISE_YES=1
|
||||||
|
export PREK_HOME="{{ prek_home }}"
|
||||||
|
mise {{ args }}
|
||||||
|
|
||||||
|
# Runs prek (pre-commit hooks manager) with the given arguments
|
||||||
|
prek *args: _ensure_mise_tools_installed
|
||||||
|
@{{ just_executable() }} --justfile "{{ justfile() }}" mise exec -- prek {{ args }}
|
||||||
|
|
||||||
|
# Runs pre-commit hooks on staged files
|
||||||
|
prek-run-on-staged *args: _ensure_mise_tools_installed
|
||||||
|
@{{ just_executable() }} --justfile "{{ justfile() }}" prek run {{ args }}
|
||||||
|
|
||||||
|
# Runs pre-commit hooks on all files
|
||||||
|
prek-run-on-all *args: _ensure_mise_tools_installed
|
||||||
|
@{{ just_executable() }} --justfile "{{ justfile() }}" prek run --all-files {{ args }}
|
||||||
|
|
||||||
|
# Installs the git pre-commit hook
|
||||||
|
prek-install-git-pre-commit-hook: _ensure_mise_tools_installed
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
set -eu
|
||||||
|
{{ just_executable() }} --justfile "{{ justfile() }}" mise exec -- prek install
|
||||||
|
hook="{{ justfile_directory() }}/.git/hooks/pre-commit"
|
||||||
|
# The installed git hook runs later under Git, outside this just/mise environment.
|
||||||
|
# Injecting PREK_HOME keeps prek's cache under var/prek instead of a global home dir,
|
||||||
|
# which is more predictable and works better in sandboxed tools like Codex/OpenCode.
|
||||||
|
if [ -f "$hook" ] && ! grep -q '^export PREK_HOME=' "$hook"; then
|
||||||
|
sed -i '2iexport PREK_HOME="{{ prek_home }}"' "$hook"
|
||||||
|
fi
|
||||||
|
|
||||||
# Runs the playbook with --tags=install-all,ensure-matrix-users-created,start and optional arguments
|
# Runs the playbook with --tags=install-all,ensure-matrix-users-created,start and optional arguments
|
||||||
install-all *extra_args: (run-tags "install-all,ensure-matrix-users-created,start" extra_args)
|
install-all *extra_args: (run-tags "install-all,ensure-matrix-users-created,start" extra_args)
|
||||||
@@ -84,3 +119,12 @@ stop-group group *extra_args:
|
|||||||
# Rebuilds the mautrix-meta-instagram Ansible role using the mautrix-meta-messenger role as a source
|
# Rebuilds the mautrix-meta-instagram Ansible role using the mautrix-meta-messenger role as a source
|
||||||
rebuild-mautrix-meta-instagram:
|
rebuild-mautrix-meta-instagram:
|
||||||
/bin/bash "{{ justfile_directory() }}/bin/rebuild-mautrix-meta-instagram.sh" "{{ justfile_directory() }}/roles/custom"
|
/bin/bash "{{ justfile_directory() }}/bin/rebuild-mautrix-meta-instagram.sh" "{{ justfile_directory() }}/roles/custom"
|
||||||
|
|
||||||
|
# Internal - ensures var/mise and var/prek directories exist
|
||||||
|
_ensure_mise_data_directory:
|
||||||
|
@mkdir -p "{{ mise_data_dir }}"
|
||||||
|
@mkdir -p "{{ prek_home }}"
|
||||||
|
|
||||||
|
# Internal - ensures mise tools are installed
|
||||||
|
_ensure_mise_tools_installed: _ensure_mise_data_directory
|
||||||
|
@{{ just_executable() }} --justfile "{{ justfile() }}" mise install --quiet
|
||||||
|
|||||||
Reference in New Issue
Block a user