diff --git a/.github/workflows/monorepo-production-tests.yml b/.github/workflows/monorepo-production-tests.yml new file mode 100644 index 0000000..ffb04aa --- /dev/null +++ b/.github/workflows/monorepo-production-tests.yml @@ -0,0 +1,94 @@ +name: Monorepo Production Tests + +on: + push: + branches: + - main + - master + +jobs: + setup-install: + name: Install all dependencies + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Use Node.js 18 + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: "npm" + + - name: Install root and frontend dependencies + run: npm install --workspaces + + - name: Setup Python 3.9 + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install backend Python dependencies + working-directory: ./backend + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + frontend-build-start: + name: Build and start frontend for production test + runs-on: ubuntu-latest + needs: setup-install + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Use Node.js 18 + uses: actions/setup-node@v3 + with: + node-version: 18 + cache: "npm" + + - name: Install dependencies (frontend) + working-directory: ./frontend + run: npm install + + - name: Build frontend production + working-directory: ./frontend + run: npm run build + + - name: Start frontend app and test + working-directory: ./frontend + run: | + npm run start & # start frontend in background + sleep 10 # wait for app to initialize + kill $! # stop the app + + backend-test-lint: + name: Run backend lint and tests + runs-on: ubuntu-latest + needs: setup-install + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup Python 3.9 + uses: actions/setup-python@v4 + with: + python-version: 3.9 + + - name: Install backend dependencies + working-directory: ./backend + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run backend lint checks + working-directory: ./backend + run: | + black . --check + isort . --check-only + flake8 . + + - name: Run backend tests + working-directory: ./backend + run: pytest