optimize ci build: use own dockerfile for dependencies + cache for builds #164

Merged
philipp merged 16 commits from own-dockerfile into staging 2024-01-17 22:56:36 +01:00
2 changed files with 9 additions and 26 deletions
Showing only changes of commit 62171d72fe - Show all commits

View File

@ -9,9 +9,10 @@ env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
jobs: jobs:
test-frontend: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: git.hofer.link/ruderverein-donau-linz/rowing-ci:latest container:
image: git.hofer.link/ruderverein-donau-linz/rowing-ci:20240117
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Run Test DB Script - name: Run Test DB Script
@ -20,10 +21,10 @@ jobs:
run: | run: |
cargo build cargo build
cd frontend && npm install && npm run build cd frontend && npm install && npm run build
- name: Install dependencies
run: cd frontend && npm install
- name: Run Playwright tests - name: Run Playwright tests
run: cd frontend && npx playwright test --workers 1 run: cd frontend && npx playwright test --workers 1
- name: Run Tests
run: cargo test --verbose
#- uses: actions/upload-artifact@v3 #- uses: actions/upload-artifact@v3
# if: always() # if: always()
# with: # with:
@ -31,29 +32,11 @@ jobs:
# path: frontend/playwright-report/ # path: frontend/playwright-report/
# retention-days: 30 # retention-days: 30
test-backend:
runs-on: ubuntu-latest
container: git.hofer.link/ruderverein-donau-linz/rowing-ci:latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run Test DB Script
run: ./test_db.sh
- name: Build
run: |
cargo build
cd frontend && npm install && npm run build
- name: Run Tests
run: cargo test --verbose
deploy-staging: deploy-staging:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: git.hofer.link/ruderverein-donau-linz/rowing-ci:latest image: git.hofer.link/ruderverein-donau-linz/rowing-ci:20240117
needs: [test_frontend, test_backend] needs: [test]
if: github.ref == 'refs/heads/staging' if: github.ref == 'refs/heads/staging'
steps: steps:
- name: Checkout - name: Checkout
@ -93,7 +76,7 @@ jobs:
deploy-main: deploy-main:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: git.hofer.link/ruderverein-donau-linz/rowing-ci:latest container: git.hofer.link/ruderverein-donau-linz/rowing-ci:latest
needs: [test_frontend, test_backend] needs: [test]
if: github.ref == 'refs/heads/main' if: github.ref == 'refs/heads/main'
steps: steps:
- name: Checkout - name: Checkout

View File

@ -5,7 +5,7 @@
# 2. Tag the image: `docker tag <id> git.hofer.link/ruderverein-donau-linz/rowing-ci:latest` # 2. Tag the image: `docker tag <id> git.hofer.link/ruderverein-donau-linz/rowing-ci:latest`
# 3. Push the image: `docker push git.hofer.link/ruderverein-donau-linz/rowing-ci:latest` # 3. Push the image: `docker push git.hofer.link/ruderverein-donau-linz/rowing-ci:latest`
FROM rust:latest FROM rust:1.75.0
RUN apt-get update && apt-get install -y sqlite3 RUN apt-get update && apt-get install -y sqlite3