CI/CD for tests and builds (broken caching)
This commit is contained in:
		
							
								
								
									
										86
									
								
								.gitea/workflows/test-and-build.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								.gitea/workflows/test-and-build.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,86 @@ | ||||
| name: Test and Build | ||||
|  | ||||
| on: | ||||
|   push: | ||||
|     branches: | ||||
|       - main | ||||
|   pull_request: | ||||
|     types: | ||||
|       - opened | ||||
|       - synchronize | ||||
|  | ||||
| jobs: | ||||
|   test: | ||||
|     container: | ||||
|       image: docker.matri.cx/nix-runner:latest | ||||
|       credentials: | ||||
|         username: ${{ secrets.REGISTRY_USERNAME }} | ||||
|         password: ${{ secrets.REGISTRY_PASSWORD }} | ||||
|     steps: | ||||
|       - name: Checkout code | ||||
|         uses: actions/checkout@v3 | ||||
|  | ||||
|       - name: Set up cache for Cabal | ||||
|         uses: actions/cache@v4 | ||||
|         with: | ||||
|           path: | | ||||
|             ~/.cabal | ||||
|             ~/.ghc | ||||
|           key: cabal-${{ runner.os }}-${{ hashFiles('tricu.cabal') }} | ||||
|           restore-keys: | | ||||
|             cabal-${{ runner.os }}- | ||||
|  | ||||
|       - name: Set up cache for Nix | ||||
|         uses: actions/cache@v4 | ||||
|         with: | ||||
|           path: | | ||||
|             /nix/store | ||||
|             /nix/var/nix/cache | ||||
|           key: nix-${{ runner.os }}-${{ hashFiles('flake.lock') }} | ||||
|           restore-keys: | | ||||
|             nix-${{ runner.os }}- | ||||
|  | ||||
|       - name: Initialize Cabal and update package list | ||||
|         run: | | ||||
|           nix develop --command cabal update | ||||
|  | ||||
|       - name: Install dependencies and run tests | ||||
|         run: | | ||||
|           nix develop --command cabal test | ||||
|  | ||||
|   build: | ||||
|     needs: test | ||||
|     container: | ||||
|       image: docker.matri.cx/nix-runner:latest | ||||
|       credentials: | ||||
|         username: ${{ secrets.REGISTRY_USERNAME }} | ||||
|         password: ${{ secrets.REGISTRY_PASSWORD }} | ||||
|     steps: | ||||
|       - name: Checkout code | ||||
|         uses: actions/checkout@v3 | ||||
|  | ||||
|       - name: Set up cache for Cabal | ||||
|         uses: actions/cache@v4 | ||||
|         with: | ||||
|           path: | | ||||
|             ~/.cabal | ||||
|             ~/.ghc | ||||
|           key: cabal-${{ runner.os }}-${{ hashFiles('tricu.cabal') }} | ||||
|           restore-keys: | | ||||
|             cabal-${{ runner.os }}- | ||||
|  | ||||
|       - name: Set up cache for Nix | ||||
|         uses: actions/cache@v4 | ||||
|         with: | ||||
|           path: | | ||||
|             /nix/store | ||||
|             /nix/var/nix/cache | ||||
|           key: nix-${{ runner.os }}-${{ hashFiles('flake.lock') }} | ||||
|           restore-keys: | | ||||
|             nix-${{ runner.os }}- | ||||
|  | ||||
|       - name: Build binary | ||||
|         run: | | ||||
|           nix build | ||||
|           ls -alh ./result/bin/tricu | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 James Eversole
					James Eversole