Add qualitycontrol.

This commit is contained in:
Greyscale 2024-05-18 18:15:29 +02:00
parent 3e1587aca0
commit 8d48c84341
15 changed files with 215 additions and 1 deletions

6
.actrc Normal file
View file

@ -0,0 +1,6 @@
--use-new-action-cache
--platform self-hosted=ghcr.io/catthehacker/ubuntu:act-latest
--platform ubuntu-latest=ghcr.io/catthehacker/ubuntu:act-latest
--platform ubuntu-22.04=ghcr.io/catthehacker/ubuntu:act-22.04
--platform ubuntu-20.04=ghcr.io/catthehacker/ubuntu:act-20.04
--platform ubuntu-18.04=ghcr.io/catthehacker/ubuntu:act-18.04

57
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,57 @@
name: Test
permissions: read-all
on:
push:
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
test-from-env:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.
- name: Verify Date
run: |
echo "DATE: $DATE"
echo "TODAY: $(date +'%Y-%m-%d')"
if [ "$DATE" != "$(date +'%Y-%m-%d')" ]; then
echo "DATE is not today's date"
exit 1
fi
- name: Verify TIME within 10 seconds of now
run: |
echo "TIME: $TIME"
echo "NOW: $(date +'%H:%M:%S')"
if [ $(date -d "$TIME" +%s) -lt $(date -d "now - 10 seconds" +%s) ] || [ $(date -d "$TIME" +%s) -gt $(date -d "now + 10 seconds" +%s) ]; then
echo "TIME is not within 10 seconds of now"
exit 1
fi
test-from-output:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: date
uses: ./.
- name: Verify Date
run: |
echo "DATE: ${{ steps.date.outputs.date }}"
echo "TODAY: $(date +'%Y-%m-%d')"
if [ "${{ steps.date.outputs.date }}" != "$(date +'%Y-%m-%d')" ]; then
echo "DATE is not today's date"
exit 1
fi
# Verify that date.time is within 10 seconds of now.
- name: Verify TIME within 10 seconds of now
run: |
echo "TIME: ${{ steps.date.outputs.time }}"
echo "NOW: $(date +'%H:%M:%S')"
if [ $(date -d "${{ steps.date.outputs.time }}" +%s) -lt $(date -d "now - 10 seconds" +%s) ] || [ $(date -d "${{ steps.date.outputs.time }}" +%s) -gt $(date -d "now + 10 seconds" +%s) ]; then
echo "TIME is not within 10 seconds of now"
exit 1
fi

31
.github/workflows/trunk.cache.yml vendored Normal file
View file

@ -0,0 +1,31 @@
name: "Quality Control: Trunk Cache"
permissions: read-all
on:
workflow_call:
workflow_dispatch:
push:
branches:
- main
paths:
- .trunk/trunk.yaml
schedule:
- cron: "0 9 * * 1" # 9am Tooling Monday
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
trunk-cache:
name: Trunk Cache
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: actions/checkout@v4
- name: "Trunk Cache"
uses: trunk-io/trunk-action@v1
with:
check-mode: populate_cache_only

28
.github/workflows/trunk.check.yml vendored Normal file
View file

@ -0,0 +1,28 @@
name: "Quality Control: Trunk Check"
permissions: read-all
on:
workflow_call:
workflow_dispatch:
push:
branches:
- main
schedule:
- cron: "0 11 * * 2" # 11am Patch Tuesday
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
trunk-check:
name: Trunk Check Runner
runs-on: ubuntu-latest
permissions:
checks: write # For trunk to post annotations
contents: read # For repo checkout
steps:
- uses: actions/checkout@v4
- name: "Trunk Check"
uses: trunk-io/trunk-action@v1

9
.trunk/.gitignore vendored Normal file
View file

@ -0,0 +1,9 @@
*out
*logs
*actions
*notifications
*tools
plugins
user_trunk.yaml
user.yaml
tmp

View file

@ -0,0 +1,3 @@
---
skip-check:
- CKV_SECRET_* # Skip all checks that start with CKV_SECRET, we already have gitleaks doing this.

View file

@ -0,0 +1,3 @@
ignored:
- DL3006
- DL3008

View file

@ -0,0 +1,10 @@
# Autoformatter friendly markdownlint config (all formatting rules disabled)
default: true
blank_lines: false
bullet: false
html: false
indentation: false
line_length: false
spaces: false
url: false
whitespace: false

View file

@ -0,0 +1 @@
LICENCE.md

View file

View file

@ -0,0 +1,6 @@
enable=all
source-path=SCRIPTDIR
# If you're having issues with shellcheck following source, disable the errors via:
# disable=SC1090
# disable=SC1091

View file

@ -0,0 +1,15 @@
extends: relaxed
rules:
quoted-strings:
required: only-when-needed
extra-allowed: ["{|*}"]
empty-values:
forbid-in-block-mappings: false
forbid-in-flow-mappings: false
ignore:
- .github/workflows/*.yml
key-duplicates: {}
octal-values:
forbid-implicit-octal: true
document-start: disable
line-length: disable

37
.trunk/trunk.yaml Normal file
View file

@ -0,0 +1,37 @@
# This file controls the behavior of Trunk: https://docs.trunk.io/cli
# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml
version: 0.1
cli:
version: 1.22.1
# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins)
plugins:
sources:
- id: trunk
ref: v1.5.0
uri: https://github.com/trunk-io/plugins
# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes)
runtimes:
enabled:
- node@18.12.1
- python@3.10.8
# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration)
lint:
disabled:
- git-diff-check
enabled:
- actionlint@1.7.0
- checkov@3.2.95
- markdownlint@0.40.0
- prettier@3.2.5
- trivy@0.51.1
- trufflehog@3.76.3
- yamllint@1.35.1
actions:
enabled:
- trunk-announce
- trunk-check-pre-push
- trunk-fmt-pre-commit
- trunk-upgrade-available
tools:
enabled:
- act@0.2.62

View file

@ -1,2 +1,9 @@
# action-get-datetime
Simple action that names datetimes more useful in github actions.
Use it like so:
```yaml
```

View file

@ -22,6 +22,7 @@ runs:
echo "$var=$value" | tee -a "$GITHUB_OUTPUT"
echo "${var^^}=$value" >> "$GITHUB_ENV"
done
outputs:
datetime:
description: "Current date and time in 'YYYY-MM-DD HH:MM:SS' format"
@ -37,4 +38,4 @@ outputs:
value: ${{ steps.date.outputs.atom }}
atom_with_millis:
description: "Current date and time in 'YYYY-MM-DDTHH:MM:SS.SSSZ' format"
value: ${{ steps.date.outputs.atom_with_millis }}
value: ${{ steps.date.outputs.atom_with_millis }}