ci: require lint and validate before build
This commit is contained in:
+20
-10
@@ -11,7 +11,7 @@ env:
|
|||||||
REGISTRY: gcr.forust.xyz
|
REGISTRY: gcr.forust.xyz
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint-prettier:
|
||||||
runs-on: [self-hosted, linux, arch, homelab]
|
runs-on: [self-hosted, linux, arch, homelab]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -37,6 +37,12 @@ jobs:
|
|||||||
node:22-alpine \
|
node:22-alpine \
|
||||||
sh -lc 'npx --yes prettier@3 --check --ignore-unknown "$@"' sh "${prettier_files[@]}"
|
sh -lc 'npx --yes prettier@3 --check --ignore-unknown "$@"' sh "${prettier_files[@]}"
|
||||||
|
|
||||||
|
lint-ruff:
|
||||||
|
runs-on: [self-hosted, linux, arch, homelab]
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Lint Python with Ruff
|
- name: Lint Python with Ruff
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -46,6 +52,12 @@ jobs:
|
|||||||
ghcr.io/astral-sh/ruff:latest \
|
ghcr.io/astral-sh/ruff:latest \
|
||||||
check .
|
check .
|
||||||
|
|
||||||
|
lint-yaml:
|
||||||
|
runs-on: [self-hosted, linux, arch, homelab]
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Lint YAML syntax
|
- name: Lint YAML syntax
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -55,6 +67,12 @@ jobs:
|
|||||||
cytopia/yamllint:latest \
|
cytopia/yamllint:latest \
|
||||||
-c .yamllint .
|
-c .yamllint .
|
||||||
|
|
||||||
|
lint-dockerfiles:
|
||||||
|
runs-on: [self-hosted, linux, arch, homelab]
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Lint Dockerfiles
|
- name: Lint Dockerfiles
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -80,15 +98,6 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Validate YAML syntax
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
docker run --rm \
|
|
||||||
-v "$PWD:/work" \
|
|
||||||
-w /work \
|
|
||||||
cytopia/yamllint:latest \
|
|
||||||
-c .yamllint .
|
|
||||||
|
|
||||||
- name: Validate Kubernetes manifests
|
- name: Validate Kubernetes manifests
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -112,6 +121,7 @@ jobs:
|
|||||||
"${manifests[@]}"
|
"${manifests[@]}"
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
needs: [lint-prettier, lint-ruff, lint-yaml, lint-dockerfiles, validate]
|
||||||
if: github.event_name != 'pull_request' && (github.ref_name == 'main' || github.ref_name == 'dev')
|
if: github.event_name != 'pull_request' && (github.ref_name == 'main' || github.ref_name == 'dev')
|
||||||
runs-on: [self-hosted, linux, arch, homelab]
|
runs-on: [self-hosted, linux, arch, homelab]
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
+20
-10
@@ -11,7 +11,7 @@ env:
|
|||||||
REGISTRY: gcr.forust.xyz
|
REGISTRY: gcr.forust.xyz
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint-prettier:
|
||||||
runs-on: [self-hosted, linux, arch, homelab]
|
runs-on: [self-hosted, linux, arch, homelab]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
@@ -37,6 +37,12 @@ jobs:
|
|||||||
node:22-alpine \
|
node:22-alpine \
|
||||||
sh -lc 'npx --yes prettier@3 --check --ignore-unknown "$@"' sh "${prettier_files[@]}"
|
sh -lc 'npx --yes prettier@3 --check --ignore-unknown "$@"' sh "${prettier_files[@]}"
|
||||||
|
|
||||||
|
lint-ruff:
|
||||||
|
runs-on: [self-hosted, linux, arch, homelab]
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Lint Python with Ruff
|
- name: Lint Python with Ruff
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -46,6 +52,12 @@ jobs:
|
|||||||
ghcr.io/astral-sh/ruff:latest \
|
ghcr.io/astral-sh/ruff:latest \
|
||||||
check .
|
check .
|
||||||
|
|
||||||
|
lint-yaml:
|
||||||
|
runs-on: [self-hosted, linux, arch, homelab]
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Lint YAML syntax
|
- name: Lint YAML syntax
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -55,6 +67,12 @@ jobs:
|
|||||||
cytopia/yamllint:latest \
|
cytopia/yamllint:latest \
|
||||||
-c .yamllint .
|
-c .yamllint .
|
||||||
|
|
||||||
|
lint-dockerfiles:
|
||||||
|
runs-on: [self-hosted, linux, arch, homelab]
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Lint Dockerfiles
|
- name: Lint Dockerfiles
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -80,15 +98,6 @@ jobs:
|
|||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Validate YAML syntax
|
|
||||||
shell: bash
|
|
||||||
run: |
|
|
||||||
docker run --rm \
|
|
||||||
-v "$PWD:/work" \
|
|
||||||
-w /work \
|
|
||||||
cytopia/yamllint:latest \
|
|
||||||
-c .yamllint .
|
|
||||||
|
|
||||||
- name: Validate Kubernetes manifests
|
- name: Validate Kubernetes manifests
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
@@ -112,6 +121,7 @@ jobs:
|
|||||||
"${manifests[@]}"
|
"${manifests[@]}"
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
needs: [lint-prettier, lint-ruff, lint-yaml, lint-dockerfiles, validate]
|
||||||
if: github.event_name != 'pull_request' && (github.ref_name == 'main' || github.ref_name == 'dev')
|
if: github.event_name != 'pull_request' && (github.ref_name == 'main' || github.ref_name == 'dev')
|
||||||
runs-on: [self-hosted, linux, arch, homelab]
|
runs-on: [self-hosted, linux, arch, homelab]
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
Reference in New Issue
Block a user