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
					
				
							
								
								
									
										4
									
								
								.github/workflows/docs-publish.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/docs-publish.yaml
									
									
									
									
										vendored
									
									
								
							| @ -3,6 +3,8 @@ on: | ||||
|   push: | ||||
|     branches: | ||||
|       - main | ||||
|     paths: | ||||
|       - 'docs/**' | ||||
| 
 | ||||
| permissions: | ||||
|   contents: write | ||||
| @ -15,5 +17,5 @@ jobs: | ||||
|       - uses: actions/setup-python@v4 | ||||
|         with: | ||||
|           python-version: 3.x | ||||
|       - run: pip install mkdocs-material  | ||||
|       - run: pip install mkdocs-material | ||||
|       - run: mkdocs gh-deploy --force | ||||
|  | ||||
							
								
								
									
										53
									
								
								.github/workflows/k3d-ci.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										53
									
								
								.github/workflows/k3d-ci.yaml
									
									
									
									
										vendored
									
									
								
							| @ -1,13 +1,19 @@ | ||||
| name: Cluster Run (K3d) | ||||
| 
 | ||||
| on: [push, pull_request] | ||||
| on: | ||||
|   push: | ||||
|     branches: | ||||
|       - main | ||||
|   pull_request: | ||||
|     paths: | ||||
|       - 'backend/**' | ||||
|       - 'chart/**' | ||||
| 
 | ||||
| jobs: | ||||
|   btrix-k3d-test: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       -  | ||||
|         name: Create k3d Cluster | ||||
|       - name: Create k3d Cluster | ||||
|         uses: AbsaOSS/k3d-action@v2 | ||||
|         with: | ||||
|           cluster-name: btrix-1 | ||||
| @ -17,18 +23,15 @@ jobs: | ||||
|             --no-lb | ||||
|             --k3s-arg "--no-deploy=traefik,servicelb,metrics-server@server:*" | ||||
| 
 | ||||
|       -  | ||||
|         name: Checkout | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v3 | ||||
| 
 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|       - name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         with: | ||||
|           driver-opts: network=host | ||||
| 
 | ||||
|       - | ||||
|         name: Build Backend | ||||
|       - name: Build Backend | ||||
|         uses: docker/build-push-action@v3 | ||||
|         with: | ||||
|           context: backend | ||||
| @ -38,8 +41,7 @@ jobs: | ||||
|           cache-from: type=gha,scope=backend | ||||
|           cache-to: type=gha,scope=backend,mode=max | ||||
| 
 | ||||
|       - | ||||
|         name: Build Frontend | ||||
|       - name: Build Frontend | ||||
|         uses: docker/build-push-action@v3 | ||||
|         with: | ||||
|           context: frontend | ||||
| @ -49,46 +51,37 @@ jobs: | ||||
|           cache-from: type=gha,scope=frontend | ||||
|           cache-to: type=gha,scope=frontend,mode=max | ||||
| 
 | ||||
|       -  | ||||
|         name: "Import Images" | ||||
|       - name: 'Import Images' | ||||
|         run: | | ||||
|           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 | ||||
| 
 | ||||
|       -  | ||||
|         name: Install Kubectl | ||||
|       - name: Install Kubectl | ||||
|         uses: azure/setup-kubectl@v3 | ||||
| 
 | ||||
|       - name: Install Helm | ||||
|         uses: azure/setup-helm@v3 | ||||
|         with: | ||||
|            version: 3.10.2 | ||||
|           version: 3.10.2 | ||||
| 
 | ||||
|       -  | ||||
|         name: Start Cluster with Helm | ||||
|       - name: Start Cluster with Helm | ||||
|         run: | | ||||
|           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 | ||||
|         with: | ||||
|           python-version: '3.9' | ||||
| 
 | ||||
|       -  | ||||
|         name: Install Python Libs | ||||
|       - name: Install Python Libs | ||||
|         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 | ||||
|   | ||||
|       -  | ||||
|         name: Run Tests | ||||
| 
 | ||||
|       - name: Run Tests | ||||
|         run: pytest -vv ./backend/test/*.py | ||||
| 
 | ||||
|       - | ||||
|         name: Print Backend Logs | ||||
|       - name: Print Backend Logs | ||||
|         if: ${{ failure() }} | ||||
|         run: kubectl logs svc/browsertrix-cloud-backend | ||||
| 
 | ||||
|  | ||||
							
								
								
									
										18
									
								
								.github/workflows/lint.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								.github/workflows/lint.yaml
									
									
									
									
										vendored
									
									
								
							| @ -1,16 +1,26 @@ | ||||
| name: Lint Check | ||||
| on: [push, pull_request] | ||||
| name: Backend Lint Check | ||||
| 
 | ||||
| on: | ||||
|   push: | ||||
|     branches: | ||||
|       - main | ||||
|     paths: | ||||
|       - 'backend/**' | ||||
|   pull_request: | ||||
|     paths: | ||||
|       - 'backend/**' | ||||
| 
 | ||||
| jobs: | ||||
|   unit-tests: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - name: checkout | ||||
|         uses: actions/checkout@v2 | ||||
|          | ||||
| 
 | ||||
|       - name: Set up Python | ||||
|         uses: actions/setup-python@v1 | ||||
|         with: | ||||
|           python-version: "3.10" | ||||
|           python-version: '3.10' | ||||
| 
 | ||||
|       - name: Install dependencies | ||||
|         run: | | ||||
|  | ||||
							
								
								
									
										47
									
								
								.github/workflows/microk8s-ci.yaml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										47
									
								
								.github/workflows/microk8s-ci.yaml
									
									
									
									
										vendored
									
									
								
							| @ -1,32 +1,34 @@ | ||||
| name: Cluster Run (MicroK8s) | ||||
| 
 | ||||
| on: [push, pull_request] | ||||
| on: | ||||
|   push: | ||||
|     branches: | ||||
|       - main | ||||
|   pull_request: | ||||
|     paths: | ||||
|       - 'backend/**' | ||||
|       - 'chart/**' | ||||
| 
 | ||||
| jobs: | ||||
|   btrix-microk8s-test: | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       -  | ||||
|         uses: balchua/microk8s-actions@v0.3.1 | ||||
|       - uses: balchua/microk8s-actions@v0.3.1 | ||||
|         with: | ||||
|           channel: '1.25/stable' | ||||
|           addons: '["dns", "helm3", "hostpath-storage", "registry", "metrics-server"]' | ||||
|       - | ||||
|         name: Checkout | ||||
|       - name: Checkout | ||||
|         uses: actions/checkout@v3 | ||||
| 
 | ||||
|       - | ||||
|         name: Set up Docker Buildx | ||||
|       - name: Set up Docker Buildx | ||||
|         uses: docker/setup-buildx-action@v2 | ||||
|         with: | ||||
|           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/ | ||||
| 
 | ||||
|       - | ||||
|         name: Build Backend | ||||
|       - name: Build Backend | ||||
|         uses: docker/build-push-action@v3 | ||||
|         with: | ||||
|           context: backend | ||||
| @ -35,8 +37,7 @@ jobs: | ||||
|           cache-from: type=gha,scope=backend | ||||
|           cache-to: type=gha,scope=backend,mode=max | ||||
| 
 | ||||
|       - | ||||
|         name: Build Frontend | ||||
|       - name: Build Frontend | ||||
|         uses: docker/build-push-action@v3 | ||||
|         with: | ||||
|           context: frontend | ||||
| @ -45,30 +46,24 @@ jobs: | ||||
|           cache-from: type=gha,scope=frontend | ||||
|           cache-to: type=gha,scope=frontend,mode=max | ||||
| 
 | ||||
|       -  | ||||
|         name: Start Cluster with Helm | ||||
|       - name: Start Cluster with Helm | ||||
|         run: | | ||||
|           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 | ||||
|         with: | ||||
|           python-version: '3.9' | ||||
| 
 | ||||
|       -  | ||||
|         name: Install Python Libs | ||||
|       - name: Install Python Libs | ||||
|         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 | ||||
|   | ||||
|       -  | ||||
|         name: Run Tests | ||||
| 
 | ||||
|       - name: Run Tests | ||||
|         run: pytest -vv ./backend/test/*.py | ||||
| 
 | ||||
|       - | ||||
|         name: Print Backend Logs | ||||
|       - name: Print Backend Logs | ||||
|         if: ${{ failure() }} | ||||
|         run: sudo microk8s kubectl logs svc/browsertrix-cloud-backend | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user