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 42 additions and 4 deletions
Showing only changes of commit 865c55cd18 - Show all commits

View File

@ -16,13 +16,25 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Run Test DB Script - name: Run Test DB Script
run: ./test_db.sh run: ./test_db.sh
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Build - name: Build
run: | run: |
cargo build cargo build
cd frontend && npm install && npm run build cd frontend && npm install && npm run build
- name: Run Playwright tests - name: Frontend tests
run: cd frontend && npx playwright test --workers 1 run: cd frontend && npx playwright test --workers 1
- name: Run Tests - name: Backend tests
run: cargo test --verbose run: cargo test --verbose
#- uses: actions/upload-artifact@v3 #- uses: actions/upload-artifact@v3
# if: always() # if: always()
@ -44,6 +56,19 @@ jobs:
- name: Run Test DB Script - name: Run Test DB Script
run: ./test_db.sh run: ./test_db.sh
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Build - name: Build
run: | run: |
cargo build --release --target $CARGO_TARGET cargo build --release --target $CARGO_TARGET
@ -84,6 +109,19 @@ jobs:
- name: Run Test DB Script - name: Run Test DB Script
run: ./test_db.sh run: ./test_db.sh
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Build - name: Build
run: | run: |
cargo build --release --target $CARGO_TARGET cargo build --release --target $CARGO_TARGET

View File

@ -2,8 +2,8 @@
# Process to renew it: # Process to renew it:
# 0. Login to gitea docker registry: `docker login git.hofer.link` # 0. Login to gitea docker registry: `docker login git.hofer.link`
# 1. Build the image `docker build .` # 1. Build the image `docker build .`
# 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:<date>`
# 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:<date>`
FROM rust:1.75.0 FROM rust:1.75.0