Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #5

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/Backend-cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Backend-cd

on:
pull_request:
types: [labeled]

jobs:
deploy-git:
if: "${{ github.event.label.name == 'prod: backend' }}"
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Remove deploy label
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: "prod: backend"

deploy-aws:
needs: deploy-git
runs-on: aws-nft

steps:
- name: stop old image
run: sudo docker-compose stop
- name: remove old image
run: sudo docker-compose rm -f
- name: pull new image
run: sudo docker-compose pull
- name: run new image
run: sudo docker-compose up -d
- name: prune images
run: sudo docker image prune -af
29 changes: 19 additions & 10 deletions .github/workflows/ci.yaml → .github/workflows/Backend-ci .yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,43 @@
name: CI
name: Backend-ci

on:
push:
branches: [main]
paths: "backend/**"
pull_request:
types: [opened, synchronize, reopened]
paths: "backend/**"

jobs:
test:
git-ci:
runs-on: ubuntu-latest
strategy:
matrix: { dir: ["./backend", "./frontend", "smart_contract"] }

steps:
- name: Checkout repo
- name: Checkout
uses: actions/checkout@v4

- name: Remove deploy label
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: "deploy: backend"

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
cache-dependency-path: "**/package-lock.json"
cache-dependency-path: "backend/package-lock.json"

- name: Install deps
run: npm install
working-directory: ${{ matrix.dir }}
working-directory: "backend"

- name: Run CI
- name: Run ci
run: npm ci
working-directory: ${{ matrix.dir }}
working-directory: "backend"

docker:
docker-push:
needs: git-ci
runs-on: ubuntu-latest

steps:
Expand All @@ -47,6 +53,9 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: print location
run: pwd

- name: Build and push
uses: docker/build-push-action@v5
with:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/Frontend-ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Frontend-ci

on:
push:
branches: [main]
paths: 'frontend/**'
pull_request:
types: [opened, synchronize, reopened]
paths: 'frontend/**'

jobs:
git-ci:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Remove deploy label
uses: actions-ecosystem/action-remove-labels@v1
with:
labels: "deploy: frontend"

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
cache: "npm"
cache-dependency-path: "frontend/package-lock.json"

- name: Install deps
run: npm install
working-directory: "frontend"

- name: Run ci
run: npm ci
working-directory: "frontend"
2 changes: 0 additions & 2 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ COPY package*.json ./

RUN npm install

RUN cp -r node_modules/zod node_modules/@types

COPY prisma ./prisma

RUN npx prisma generate
Expand Down
Loading
Loading