refactor: use cargo-chef
for better docker images
#4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v27 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | |
run: nix develop -c cargo build | |
- name: Run tests | |
run: | | |
sudo apt-get update | |
sudo apt-get install ca-certificates curl gnupg | |
sudo install -m 0755 -d /etc/apt/keyrings | |
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | |
sudo chmod a+r /etc/apt/keyrings/docker.gpg | |
echo \ | |
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ | |
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ | |
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | |
sudo apt-get update | |
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin | |
nix develop -c docker compose up cache db -d | |
nix develop -c cargo run --package migration up | |
nix develop -c cargo test | |
nix develop -c docker compose up -d | |
cd client | |
nix develop -c npm i | |
nix develop -c npm run build | |
nix develop -c npm run test | |
- name: Upload cypress e2e results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: "cypress-results" | |
path: "client/cypress/videos" | |
if-no-files-found: "error" | |
retention-days: 90 | |
compression-level: 0 | |
overwrite: true |