Skip to content

Commit f786966

Browse files
committed
Adds workflows for CI
1 parent fea7cb0 commit f786966

3 files changed

Lines changed: 122 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
test-backend:
8+
runs-on: ubuntu-latest
9+
defaults:
10+
run:
11+
working-directory: apps/opencase
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: 22
18+
cache: npm
19+
cache-dependency-path: apps/opencase/package-lock.json
20+
21+
- run: npm ci
22+
- run: npm run lint
23+
- run: npm test
24+
25+
test-frontend:
26+
runs-on: ubuntu-latest
27+
defaults:
28+
run:
29+
working-directory: apps/editor
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- uses: actions/setup-node@v4
34+
with:
35+
node-version: 22
36+
cache: npm
37+
cache-dependency-path: apps/editor/package-lock.json
38+
39+
- run: npm ci
40+
- run: npm run lint
41+
- run: npm test
42+
43+
build-images:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v4
47+
48+
- uses: docker/setup-buildx-action@v3
49+
50+
- name: Build opencase
51+
uses: docker/build-push-action@v6
52+
with:
53+
context: apps/opencase
54+
push: false
55+
cache-from: type=gha,scope=opencase
56+
cache-to: type=gha,scope=opencase,mode=max
57+
58+
- name: Build editor
59+
uses: docker/build-push-action@v6
60+
with:
61+
context: apps/editor
62+
push: false
63+
cache-from: type=gha,scope=editor
64+
cache-to: type=gha,scope=editor,mode=max

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
env:
8+
IMAGE_TAG: sha-${{ github.sha }}
9+
10+
jobs:
11+
build-and-push:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
id-token: write
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: google-github-actions/auth@v2
21+
with:
22+
workload_identity_provider: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }}
23+
service_account: ${{ vars.GCP_SERVICE_ACCOUNT }}
24+
25+
- uses: docker/setup-buildx-action@v3
26+
27+
- name: Configure Docker for Artifact Registry
28+
run: gcloud auth configure-docker ${{ vars.ARTIFACT_REGISTRY_REGION }}-docker.pkg.dev --quiet
29+
30+
- name: Build and push opencase
31+
uses: docker/build-push-action@v6
32+
with:
33+
context: apps/opencase
34+
push: true
35+
tags: ${{ vars.IMAGE_REGISTRY }}/opencase:${{ env.IMAGE_TAG }}
36+
cache-from: type=gha,scope=opencase
37+
cache-to: type=gha,scope=opencase,mode=max
38+
39+
- name: Build and push editor
40+
uses: docker/build-push-action@v6
41+
with:
42+
context: apps/editor
43+
push: true
44+
tags: ${{ vars.IMAGE_REGISTRY }}/editor:${{ env.IMAGE_TAG }}
45+
cache-from: type=gha,scope=editor
46+
cache-to: type=gha,scope=editor,mode=max
47+
48+
trigger-deploy:
49+
needs: build-and-push
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: peter-evans/repository-dispatch@v3
53+
with:
54+
token: ${{ secrets.DEPLOY_REPO_TOKEN }}
55+
repository: ${{ vars.DEPLOY_REPO }}
56+
event-type: deploy
57+
client-payload: '{"image_tag": "${{ env.IMAGE_TAG }}"}'

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.env
22
AGENTS.md
3+
.DS_Store

0 commit comments

Comments
 (0)