summaryrefslogtreecommitdiff
path: root/.github/workflows/cicd.yml
diff options
context:
space:
mode:
authorA Farzat <a@farzat.xyz>2025-10-12 10:31:08 +0300
committerA Farzat <a@farzat.xyz>2025-10-12 10:34:28 +0300
commit20c63cb6b18ee70b874ba63c1ad6212af165b291 (patch)
tree163572dd75b8215efc1ad0423841baec0bf68f60 /.github/workflows/cicd.yml
parent01c082ce9de0061eaac183ffc22f86e739a9484f (diff)
downloadcsca5028-20c63cb6b18ee70b874ba63c1ad6212af165b291.tar.gz
csca5028-20c63cb6b18ee70b874ba63c1ad6212af165b291.zip
Merge GitHub workflows to one
Diffstat (limited to '.github/workflows/cicd.yml')
-rw-r--r--.github/workflows/cicd.yml93
1 files changed, 93 insertions, 0 deletions
diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml
new file mode 100644
index 0000000..217d8cd
--- /dev/null
+++ b/.github/workflows/cicd.yml
@@ -0,0 +1,93 @@
+name: Deploy to GitHub Pages
+
+on:
+ push:
+ branches: [ deploy ]
+ pull_request:
+ branches: [ deploy ]
+
+concurrency:
+ group: "pages"
+ cancel-in-progress: true
+
+permissions:
+ contents: read
+ pages: write
+ id-token: write
+
+jobs:
+ python-tests:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Python
+ uses: actions/setup-python@v4
+ with:
+ python-version: '3.13'
+
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
+ pip install mypy
+
+ - name: Run unit tests
+ run: python -m unittest tests/*.py
+
+ - name: Run type checking
+ run: mypy --explicit-package-bases --strict .
+
+ build:
+ runs-on: ubuntu-latest
+ needs: python-tests
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: '18'
+ cache: 'npm'
+ cache-dependency-path: 'front-end/package-lock.json'
+
+ - name: Create env file
+ run: |
+ echo "VITE_API_BASE_URL=https://flask.csca5028.farzat.xyz/" > front-end/.env
+ working-directory: ./
+
+ - name: Install dependencies
+ run: npm ci
+ working-directory: ./front-end
+
+ - name: Build
+ run: npm run build
+ working-directory: ./front-end
+
+ - name: Setup Pages
+ uses: actions/configure-pages@v4
+
+ - name: Upload artifact
+ uses: actions/upload-pages-artifact@v3
+ with:
+ path: ./front-end/dist
+
+ deploy:
+ environment:
+ name: github-pages
+ url: ${{ steps.deployment.outputs.page_url }}
+ runs-on: ubuntu-latest
+ needs: build
+
+ permissions:
+ pages: write
+ id-token: write
+
+ steps:
+ - name: Deploy to GitHub Pages
+ id: deployment
+ uses: actions/deploy-pages@v4