refactor: ♻️ improve server structure (#421) #788
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: | |
push: | |
branches: [trunk] | |
pull_request: | |
branches: [trunk] | |
env: | |
GIT_LFS_CACHE_DIR: '${{ github.workspace }}/git-lfs-cache' | |
jobs: | |
build-and-test: | |
runs-on: self-hosted | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
TURBO_REMOTE_ONLY: true | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Restore Git LFS cache | |
uses: actions/cache@v2 | |
with: | |
path: '${{ env.GIT_LFS_CACHE_DIR }}' | |
key: "${{ runner.os }}-git-lfs-${{ hashFiles('**/lfs/*') }}" | |
restore-keys: | | |
${{ runner.os }}-git-lfs- | |
- name: Git LFS checkout | |
run: git lfs checkout | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install pnpm | |
run: npm i -g pnpm turbo | |
- name: Cache pnpm modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/.pnpm-store/v3 | |
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm- | |
- name: Install dependencies | |
run: pnpm install --frozen-lockfile | |
- name: Setup prisma | |
run: turbo db:generate | |
- name: Build | |
run: pnpm run build | |
# - name: Test | |
# run: pnpm run test | |
# | |
# - uses: codecov/codecov-action@v3 | |
# with: | |
# files: ./packages/osiris/coverage/lcov.info #, ... | |
docker: | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Restore Git LFS cache | |
uses: actions/cache@v2 | |
with: | |
path: '${{ env.GIT_LFS_CACHE_DIR }}' | |
key: "${{ runner.os }}-git-lfs-${{ hashFiles('**/lfs/*') }}" | |
restore-keys: | | |
${{ runner.os }}-git-lfs- | |
- name: Git LFS checkout | |
run: git lfs checkout | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
file: ./apps/server/Dockerfile | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |