Add path filter to GH workflows (#500)
* update docs path * update lint check * cluster runs only on backend changes
This commit is contained in:
parent
1dfa494210
commit
24a7b14d63
2
.github/workflows/docs-publish.yaml
vendored
2
.github/workflows/docs-publish.yaml
vendored
@ -3,6 +3,8 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
paths:
|
||||||
|
- 'docs/**'
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|||||||
49
.github/workflows/k3d-ci.yaml
vendored
49
.github/workflows/k3d-ci.yaml
vendored
@ -1,13 +1,19 @@
|
|||||||
name: Cluster Run (K3d)
|
name: Cluster Run (K3d)
|
||||||
|
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'backend/**'
|
||||||
|
- 'chart/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
btrix-k3d-test:
|
btrix-k3d-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Create k3d Cluster
|
||||||
name: Create k3d Cluster
|
|
||||||
uses: AbsaOSS/k3d-action@v2
|
uses: AbsaOSS/k3d-action@v2
|
||||||
with:
|
with:
|
||||||
cluster-name: btrix-1
|
cluster-name: btrix-1
|
||||||
@ -17,18 +23,15 @@ jobs:
|
|||||||
--no-lb
|
--no-lb
|
||||||
--k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*"
|
--k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*"
|
||||||
|
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
-
|
- name: Set up Docker Buildx
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
with:
|
with:
|
||||||
driver-opts: network=host
|
driver-opts: network=host
|
||||||
|
|
||||||
-
|
- name: Build Backend
|
||||||
name: Build Backend
|
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
context: backend
|
context: backend
|
||||||
@ -38,8 +41,7 @@ jobs:
|
|||||||
cache-from: type=gha,scope=backend
|
cache-from: type=gha,scope=backend
|
||||||
cache-to: type=gha,scope=backend,mode=max
|
cache-to: type=gha,scope=backend,mode=max
|
||||||
|
|
||||||
-
|
- name: Build Frontend
|
||||||
name: Build Frontend
|
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
context: frontend
|
context: frontend
|
||||||
@ -49,14 +51,12 @@ jobs:
|
|||||||
cache-from: type=gha,scope=frontend
|
cache-from: type=gha,scope=frontend
|
||||||
cache-to: type=gha,scope=frontend,mode=max
|
cache-to: type=gha,scope=frontend,mode=max
|
||||||
|
|
||||||
-
|
- name: 'Import Images'
|
||||||
name: "Import Images"
|
|
||||||
run: |
|
run: |
|
||||||
k3d image import webrecorder/browsertrix-backend:latest -m direct -c btrix-1 --verbose
|
k3d image import webrecorder/browsertrix-backend:latest -m direct -c btrix-1 --verbose
|
||||||
k3d image import webrecorder/browsertrix-frontend:latest -m direct -c btrix-1 --verbose
|
k3d image import webrecorder/browsertrix-frontend:latest -m direct -c btrix-1 --verbose
|
||||||
|
|
||||||
-
|
- name: Install Kubectl
|
||||||
name: Install Kubectl
|
|
||||||
uses: azure/setup-kubectl@v3
|
uses: azure/setup-kubectl@v3
|
||||||
|
|
||||||
- name: Install Helm
|
- name: Install Helm
|
||||||
@ -64,31 +64,24 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
version: 3.10.2
|
version: 3.10.2
|
||||||
|
|
||||||
-
|
- name: Start Cluster with Helm
|
||||||
name: Start Cluster with Helm
|
|
||||||
run: |
|
run: |
|
||||||
helm upgrade --install -f ./chart/values.yaml -f ./chart/examples/k3d-ci.yaml btrix ./chart/
|
helm upgrade --install -f ./chart/values.yaml -f ./chart/examples/k3d-ci.yaml btrix ./chart/
|
||||||
|
|
||||||
-
|
- name: Install Python
|
||||||
name: Install Python
|
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v3
|
||||||
with:
|
with:
|
||||||
python-version: '3.9'
|
python-version: '3.9'
|
||||||
|
|
||||||
-
|
- name: Install Python Libs
|
||||||
name: Install Python Libs
|
|
||||||
run: pip install pytest requests
|
run: pip install pytest requests
|
||||||
|
|
||||||
-
|
- name: Wait for all pods to be ready
|
||||||
name: Wait for all pods to be ready
|
|
||||||
run: kubectl wait --for=condition=ready pod --all --timeout=240s
|
run: kubectl wait --for=condition=ready pod --all --timeout=240s
|
||||||
|
|
||||||
-
|
- name: Run Tests
|
||||||
name: Run Tests
|
|
||||||
run: pytest -vv ./backend/test/*.py
|
run: pytest -vv ./backend/test/*.py
|
||||||
|
|
||||||
-
|
- name: Print Backend Logs
|
||||||
name: Print Backend Logs
|
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
run: kubectl logs svc/browsertrix-cloud-backend
|
run: kubectl logs svc/browsertrix-cloud-backend
|
||||||
|
|
||||||
|
|||||||
16
.github/workflows/lint.yaml
vendored
16
.github/workflows/lint.yaml
vendored
@ -1,5 +1,15 @@
|
|||||||
name: Lint Check
|
name: Backend Lint Check
|
||||||
on: [push, pull_request]
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths:
|
||||||
|
- 'backend/**'
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'backend/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
unit-tests:
|
unit-tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -10,7 +20,7 @@ jobs:
|
|||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v1
|
||||||
with:
|
with:
|
||||||
python-version: "3.10"
|
python-version: '3.10'
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
45
.github/workflows/microk8s-ci.yaml
vendored
45
.github/workflows/microk8s-ci.yaml
vendored
@ -1,32 +1,34 @@
|
|||||||
name: Cluster Run (MicroK8s)
|
name: Cluster Run (MicroK8s)
|
||||||
|
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'backend/**'
|
||||||
|
- 'chart/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
btrix-microk8s-test:
|
btrix-microk8s-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
- uses: balchua/microk8s-actions@v0.3.1
|
||||||
uses: balchua/microk8s-actions@v0.3.1
|
|
||||||
with:
|
with:
|
||||||
channel: '1.25/stable'
|
channel: '1.25/stable'
|
||||||
addons: '["dns", "helm3", "hostpath-storage", "registry", "metrics-server"]'
|
addons: '["dns", "helm3", "hostpath-storage", "registry", "metrics-server"]'
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
-
|
- name: Set up Docker Buildx
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v2
|
||||||
with:
|
with:
|
||||||
driver-opts: network=host
|
driver-opts: network=host
|
||||||
|
|
||||||
-
|
- name: Wait for registry to be available
|
||||||
name: Wait for registry to be available
|
|
||||||
run: curl --retry 20 --retry-delay 10 --retry-connrefused http://localhost:32000/v2/
|
run: curl --retry 20 --retry-delay 10 --retry-connrefused http://localhost:32000/v2/
|
||||||
|
|
||||||
-
|
- name: Build Backend
|
||||||
name: Build Backend
|
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
context: backend
|
context: backend
|
||||||
@ -35,8 +37,7 @@ jobs:
|
|||||||
cache-from: type=gha,scope=backend
|
cache-from: type=gha,scope=backend
|
||||||
cache-to: type=gha,scope=backend,mode=max
|
cache-to: type=gha,scope=backend,mode=max
|
||||||
|
|
||||||
-
|
- name: Build Frontend
|
||||||
name: Build Frontend
|
|
||||||
uses: docker/build-push-action@v3
|
uses: docker/build-push-action@v3
|
||||||
with:
|
with:
|
||||||
context: frontend
|
context: frontend
|
||||||
@ -45,30 +46,24 @@ jobs:
|
|||||||
cache-from: type=gha,scope=frontend
|
cache-from: type=gha,scope=frontend
|
||||||
cache-to: type=gha,scope=frontend,mode=max
|
cache-to: type=gha,scope=frontend,mode=max
|
||||||
|
|
||||||
-
|
- name: Start Cluster with Helm
|
||||||
name: Start Cluster with Helm
|
|
||||||
run: |
|
run: |
|
||||||
sudo microk8s helm3 upgrade --install -f ./chart/values.yaml -f ./chart/examples/microk8s-ci.yaml btrix ./chart/
|
sudo microk8s helm3 upgrade --install -f ./chart/values.yaml -f ./chart/examples/microk8s-ci.yaml btrix ./chart/
|
||||||
|
|
||||||
-
|
- name: Install Python
|
||||||
name: Install Python
|
|
||||||
uses: actions/setup-python@v3
|
uses: actions/setup-python@v3
|
||||||
with:
|
with:
|
||||||
python-version: '3.9'
|
python-version: '3.9'
|
||||||
|
|
||||||
-
|
- name: Install Python Libs
|
||||||
name: Install Python Libs
|
|
||||||
run: pip install pytest requests
|
run: pip install pytest requests
|
||||||
|
|
||||||
-
|
- name: Wait for all pods to be ready
|
||||||
name: Wait for all pods to be ready
|
|
||||||
run: sudo microk8s kubectl wait --for=condition=ready pod --all --timeout=240s
|
run: sudo microk8s kubectl wait --for=condition=ready pod --all --timeout=240s
|
||||||
|
|
||||||
-
|
- name: Run Tests
|
||||||
name: Run Tests
|
|
||||||
run: pytest -vv ./backend/test/*.py
|
run: pytest -vv ./backend/test/*.py
|
||||||
|
|
||||||
-
|
- name: Print Backend Logs
|
||||||
name: Print Backend Logs
|
|
||||||
if: ${{ failure() }}
|
if: ${{ failure() }}
|
||||||
run: sudo microk8s kubectl logs svc/browsertrix-cloud-backend
|
run: sudo microk8s kubectl logs svc/browsertrix-cloud-backend
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user