Update contributors #15
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/CD Pipeline | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
check-contracts: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./contracts | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Scarb | |
run: curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | sh | |
- name: Add Scarb to PATH | |
run: echo "${HOME}/.local/share/scarb/bin" >> $GITHUB_PATH | |
- name: Build Starknet contracts | |
run: scarb build | |
- name: Run Scarb tests (if any) | |
run: scarb test | |
nextjs-build-and-test: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./client | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
cache-dependency-path: './client/package-lock.json' | |
- name: Install dependencies | |
run: npm ci | |
- name: Lint | |
run: npm run lint | |
# - name: Type check | |
# run: npm run type-check || npm run tsc | |
# - name: Run tests | |
# run: npm test | |
- name: Build | |
run: npm run build | |
env: | |
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
BRIAN_API_KEY: ${{ secrets.BRIAN_API_KEY }} | |
- name: Cache build output | |
uses: actions/cache@v4 | |
with: | |
path: | | |
client/.next/cache | |
${{ github.workspace }}/client/.next/static | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('client/package-lock.json') }}-${{ hashFiles('client/**.[jt]sx?') }} | |
restore-keys: | | |
${{ runner.os }}-nextjs-${{ hashFiles('client/package-lock.json') }}- | |
deploy: | |
needs: [check-contracts, nextjs-build-and-test] | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
defaults: | |
run: | |
working-directory: ./client | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
cache-dependency-path: './client/package-lock.json' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
env: | |
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
BRIAN_API_KEY: ${{ secrets.BRIAN_API_KEY }} |