build: use pnpm for the deploy

This commit is contained in:
Rafael Taranto 2025-05-23 16:02:58 +01:00
parent 64e358f61c
commit bac8813a8d
36 changed files with 19068 additions and 29560 deletions

View file

@ -4,42 +4,48 @@ on: [ workflow_dispatch ]
jobs:
everything:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
- name: Setup Turbo cache
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-updatetar
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-updatetar
- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
file: build/ci.Dockerfile
load: true
tags: ci_image:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
${{ runner.os }}-turbo-
- name: Extract artifact from Docker image
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.11.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build packages with Turbo
run: pnpm run build
- name: Package production build
run: |
docker create --name extract_artifact ci_image:latest
docker cp extract_artifact:/lamassu-server.tar.gz ./lamassu-server.tar.gz
docker rm extract_artifact
# Create production-ready server package using pnpm deploy
pnpm deploy --filter=./packages/server --prod lamassu-server --legacy
# Copy built admin UI to public directory
cp -r packages/admin-ui/build lamassu-server/public
# Create tarball
tar -zcf lamassu-server.tar.gz lamassu-server/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: lamassu-server.tar.gz
path: lamassu-server.tar.gz
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

View file

@ -17,16 +17,48 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
- name: Setup Turbo cache
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-updatetar
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-updatetar
${{ runner.os }}-turbo-
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.11.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- name: Build packages with Turbo
run: pnpm run build
- name: Verify build artifacts
run: |
echo "=== Verifying typesafe-db build ==="
ls -la packages/typesafe-db/lib/
echo "=== Verifying admin-ui build ==="
ls -la packages/admin-ui/build/
- name: Package production build
run: |
# Create production-ready server package using pnpm deploy
pnpm deploy --filter=./packages/server --prod lamassu-server --legacy
# Copy built admin UI to public directory
cp -r packages/admin-ui/build lamassu-server/public
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
@ -34,7 +66,7 @@ jobs:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Build and push
- name: Build and push server image
uses: docker/build-push-action@v5
with:
context: .
@ -42,10 +74,8 @@ jobs:
target: l-s
file: ./build/server.Dockerfile
tags: ${{ env.DOCKERHUB_SERVER_REPO }}:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Build and push
- name: Build and push admin server image
uses: docker/build-push-action@v5
with:
context: .
@ -53,10 +83,3 @@ jobs:
target: l-a-s
file: ./build/server.Dockerfile
tags: ${{ env.DOCKERHUB_ADMIN_REPO }}:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache

View file

@ -3,24 +3,38 @@ name: Tests
on:
pull_request:
branches: [ dev ]
push:
branches: [ dev ]
jobs:
test:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Turbo cache
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 10.11.0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'
cache: 'pnpm'
- name: Install dependencies
run: npm ci
run: pnpm install
- name: Run admin-ui tests
working-directory: packages/admin-ui
run: npm run test:run
- name: Run tests
run: pnpm run test