Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# web + desktop packages
packages/app/ @adamdotdevin
packages/tauri/ @adamdotdevin
packages/desktop/src-tauri/ @brendonovich
packages/desktop/ @adamdotdevin
# https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners#example-of-a-codeowners-file
# This is a comment.
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in
# the repo.
* @johnko
6 changes: 6 additions & 0 deletions .github/git-has-uncommited-changes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -euxo pipefail

git version

git diff --exit-code
34 changes: 34 additions & 0 deletions .github/helm-dep.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
set -ex

if git diff --name-only | grep lab/renovatebotwrapper; then

cd ./lab/renovatebotwrapper

helm repo add argo https://argoproj.github.io/argo-helm
helm repo add coredns https://coredns.github.io/helm
helm repo add istio https://istio-release.storage.googleapis.com/charts
helm repo add jetstack https://charts.jetstack.io
helm repo add metrics-server https://kubernetes-sigs.github.io/metrics-server/
helm repo add mojo2600 https://mojo2600.github.io/pihole-kubernetes/
helm repo add openfaas https://openfaas.github.io/faas-netes/
helm repo add traefik https://traefik.github.io/charts

# to fetch versions that Chart.lock has defined
helm dep build

cd ./charts

# clean chart sources since files could have been deleted upstream
for i in $(find . -maxdepth 1 -name '*.tgz' -print0 | xargs -0 --max-procs=1 --verbose -I{} tar tf {} 2>/dev/null | cut -f1 -d/ | sort -u); do
if [ -d ./"$i"/ ]; then
rm -fr ./"$i"/
fi
done

# extract chart sources
find . -maxdepth 1 -name '*.tgz' -print0 | xargs -0 --max-procs=1 --verbose -I{} tar xvf {}

rm -v ./*.tgz

fi
42 changes: 42 additions & 0 deletions .github/pre-commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -euxo pipefail

ANY_ERROR=false

set +e

if type tofu &>/dev/null; then
bash -ex .github/opentofu-fmt.sh
# shellcheck disable=SC2181
[[ $? -ne 0 ]] && ANY_ERROR=true
bash -ex .github/opentofu-validate.sh
# shellcheck disable=SC2181
[[ $? -ne 0 ]] && ANY_ERROR=true
fi

if type terraform &>/dev/null; then
bash -ex .github/terraform-fmt.sh
# shellcheck disable=SC2181
[[ $? -ne 0 ]] && ANY_ERROR=true
bash -ex .github/terraform-validate.sh
# shellcheck disable=SC2181
[[ $? -ne 0 ]] && ANY_ERROR=true
fi

if type shellcheck &>/dev/null; then
bash -ex .github/shellcheck.sh
# shellcheck disable=SC2181
[[ $? -ne 0 ]] && ANY_ERROR=true
fi

if type shfmt &>/dev/null; then
bash -ex .github/shfmt.sh
# shellcheck disable=SC2181
[[ $? -ne 0 ]] && ANY_ERROR=true
fi

set -e

if [[ "true" == "$ANY_ERROR" ]]; then
exit 1
fi
14 changes: 14 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"allowedCommands": [
"/bin/bash .github/helm-dep.sh"
],
"extends": [
"github>johnko/renovate-config"
],
"postUpgradeTasks": {
"commands": [
"/bin/bash .github/helm-dep.sh"
],
"executionMode": "branch"
}
}
9 changes: 9 additions & 0 deletions .github/setup-git-pre-commit-hooks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -euxo pipefail

SCRIPT_DIR=$(dirname "$0")
pushd "$SCRIPT_DIR"

if [[ -e ./pre-commit.sh ]] && [[ -d ../.git/hooks ]]; then
install -m 700 ./pre-commit.sh ../.git/hooks/pre-commit
fi
42 changes: 42 additions & 0 deletions .github/shellcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env bash
set -exo pipefail

# when running in CI and shellcheck doesn't exist, install it
if [[ "true" == "$CI" ]]; then
if ! type shellcheck &>/dev/null; then
SUDO=''
if type sudo &>/dev/null; then
SUDO=sudo
fi
if type brew &>/dev/null; then
brew install shellcheck
elif type snap &>/dev/null; then
INSTALL_COMMAND="snap install shellcheck"
# shellcheck disable=SC2086
$INSTALL_COMMAND || $SUDO $INSTALL_COMMAND
elif type apt &>/dev/null; then
SUDO=''
if type sudo &>/dev/null; then
SUDO=sudo
fi
INSTALL_COMMAND="apt install --yes shellcheck"
# shellcheck disable=SC2086
$INSTALL_COMMAND || $SUDO $INSTALL_COMMAND
fi
fi
fi
set -u

shellcheck --version

set +e

# git submodule status | awk '{print "-a -not -path **/"$2"/**"}' | tr "\n" " " | sed "s,\*\*/,'*/,g" | sed "s,/\*\*,/*',g" ; echo "\\"

find . -type f \( -name '*.sh' -o -name '*.envrc' \) \
-a -not -path '*/.terraform/modules/*' \
\
-a -not -path '*/.bash-git-prompt/*' -a -not -path '*/.zsh/kube-ps1/*' -a -not -path '*/.zsh/pure/*' -a -not -path '*/.zsh/zsh-colored-man-pages/*' -a -not -path '*/.zsh/zsh-command-time/*' -a -not -path '*/docker-files/squid/ref/docker-squid-cache-all/*' -a -not -path '*/docker-files/squid/ref/squid-in-a-can/*' -a -not -path '*/docker-files/squid/ref/squid-npm/*' \
\
-a -not -name 'macos-homebrew.sh' \
-print0 | xargs -0 --max-procs=2 --verbose -I{} shellcheck --check-sourced --external-sources {}
47 changes: 47 additions & 0 deletions .github/shfmt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/usr/bin/env bash
set -exo pipefail

# when running in CI and shfmt doesn't exist, install it
if [[ "true" == "$CI" ]]; then
if ! type shfmt &>/dev/null; then
SUDO=''
if type sudo &>/dev/null; then
SUDO=sudo
fi
if type brew &>/dev/null; then
brew install shfmt
elif type snap &>/dev/null; then
INSTALL_COMMAND="snap install shfmt"
# shellcheck disable=SC2086
$INSTALL_COMMAND || $SUDO $INSTALL_COMMAND
elif type go &>/dev/null; then
if [[ ! -d "$HOME/bin" ]]; then
mkdir -p "$HOME/bin"
fi
export GOBIN="$HOME/bin"
export PATH="$GOBIN:$PATH"
go install mvdan.cc/sh/v3/cmd/[email protected]
ls -l "$GOBIN/shfmt"
elif type apt &>/dev/null; then
SUDO=''
if type sudo &>/dev/null; then
SUDO=sudo
fi
INSTALL_COMMAND="apt install --yes shfmt"
# shellcheck disable=SC2086
$INSTALL_COMMAND || $SUDO $INSTALL_COMMAND
fi
fi
fi
set -u

shfmt --version

# Diff with
shfmt --diff --simplify --indent 2 --case-indent ./
find . -type f -name '*.envrc' -print0 | xargs -0 --max-procs=2 --verbose -I{} shfmt --diff --simplify --indent 2 --case-indent {}

# Fix with
# shfmt --write --simplify --indent 2 --case-indent ./
# find . -type f -name '*.envrc' -print0 | xargs -0 --max-procs=2 --verbose -I{} shfmt --write --simplify --indent 2 --case-indent {}
# bash -ex ./.github/git-has-uncommited-changes.sh
43 changes: 43 additions & 0 deletions .github/workflows/renovate-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# THIS FILE'S LICENSE:
# Copyright 2020 WhiteSource Ltd

# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

# The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
preset:
container:
image: ghcr.io/renovatebot/renovate:42.1.3
# github hosted runners are running as `1001:127` (ubuntu:docker)
options: -u 1001:0 --group-add 1000 --group-add 12021 --group-add 127
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
show-progress: false
- name: testing ${{ matrix.file }}
run: |
if [ -e ${{ matrix.file }}.json ]; then
renovate-config-validator ${{ matrix.file }}.json
fi
strategy:
matrix:
file:
- .github/renovate
- default
timeout-minutes: 10
name: renovate-config
on:
pull_request:
paths:
- .github/renovate.json
- .github/workflows/renovate-config.yml
- default.json
permissions:
contents: read
26 changes: 26 additions & 0 deletions .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
call-workflow:
secrets: inherit
uses: johnko/renovate-config/.github/workflows/renovate-shared.yml@main
with:
logLevel: ${{ inputs.logLevel }}
overrideSchedule: ${{ inputs.overrideSchedule == 'true' && 'true' || '' }}
name: Renovate
on:
schedule:
- cron: 30 12 * * SUN,SAT # UTC
workflow_dispatch:
inputs:
logLevel:
default: info
description: Override default log level
required: false
type: string
overrideSchedule:
default: "false"
description: Override all schedules
required: false
type: string
32 changes: 32 additions & 0 deletions .github/workflows/shell-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
show-progress: false
- name: Test with shellcheck
run: |
bash -ex .github/shellcheck.sh
timeout-minutes: 10
shfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
show-progress: false
- name: Apply shfmt and find unformatted files
run: |
bash -ex .github/shfmt.sh
timeout-minutes: 10
name: shell-checks
on:
pull_request:
paths:
- .github/shellcheck.sh
- .github/shfmt.sh
- .github/workflows/shell-checks.yml
- '**.sh'
23 changes: 23 additions & 0 deletions .github/workflows/yaml-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
concurrency:
cancel-in-progress: true
group: ${{ github.workflow }}-${{ github.ref }}
jobs:
yq-pretty:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
show-progress: false
- name: Apply yq --prettyPrint and find unformatted files
run: |
bash -ex .github/yq-pretty.sh
timeout-minutes: 10
name: yaml-checks
on:
pull_request:
paths:
- .github/git-has-uncommited-changes.sh
- .github/workflows/yaml-checks.yml
- .github/yq-pretty.sh
- '**.yaml'
- '**.yml'
8 changes: 8 additions & 0 deletions .github/yq-pretty.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euxo pipefail

yq --version

find . -type f \( -name '*.yaml' -o -name '*.yml' \) -not -path '*/lab/charts/*' -not -path '*/lab/traefik/*' -not -path '*/docker-files/squid/ref/*' -print0 | xargs -0 --max-procs=2 --verbose -I{} yq --exit-status --inplace --no-colors --prettyPrint 'sort_keys(..)' {}

bash -ex ./.github/git-has-uncommited-changes.sh
Loading