Skip to content

Merge pull request #30 from aomlomics/CarterRoll-patch-1 #5

Merge pull request #30 from aomlomics/CarterRoll-patch-1

Merge pull request #30 from aomlomics/CarterRoll-patch-1 #5

Workflow file for this run

name: Opal CI/CD workflow
on: push
jobs:
test-server:
runs-on: ubuntu-latest
defaults:
run:
working-directory: server
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
test-frontend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontend
steps:
- uses: actions/checkout@v4
- name: Populate environment with secrets
run: |
echo "${{ secrets.FRONTEND_FULL_ENV }}" > $GITHUB_ENV
echo "${{ secrets.FRONTEND_FULL_ENV }}" > .env
- name: Use Node.js 20.16.0
uses: actions/setup-node@v4
with:
node-version: "20.16.0"
- run: npm ci
- run: npm run build
deploy:
runs-on: self-hosted
needs: [test-server, test-frontend]
if: github.ref == 'refs/heads/main'
steps:
- name: Pull repository
working-directory: /home/node/opal
run: git pull
- name: Build server
working-directory: /home/node/opal/server
run: |
echo "${{ secrets.SERVER_FULL_ENV }}" > .env
pip install -r requirements.txt
- name: Build frontend
working-directory: /home/node/opal/frontend
run: |
echo "${{ secrets.FRONTEND_FULL_ENV }}" > .env
npm ci
npm run build