Skip to content

feat: add tests to CI #29 #54

feat: add tests to CI #29

feat: add tests to CI #29 #54

Workflow file for this run

name: πŸš€ Test & Deploy Static Content to GitHub Pages
on: push
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
permissions:
contents: read # Read access to repository contents
pages: write # Write access for deployment to GitHub Pages
id-token: write # Allow GitHub to issue an ID token for authentication
# Allow only one concurrent deployment at a time
concurrency:
group: 'pages' # Group deployments by name for concurrency control
cancel-in-progress: true # Cancel any in-progress deployments if a new one starts
jobs:
# Setup environment and dependencies
setup:
name: πŸ› οΈ Setup Development Environment
runs-on: ubuntu-latest
steps:
- name: Checkout Repository πŸ“₯
uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
node-version: 20
- name: Install & Cache Dependencies πŸ“¦
run: |
yarn install --immutable
mkdir -p ./cache
cp -R node_modules ./cache/
- name: Upload Dependencies Artifact πŸ“¦
uses: actions/upload-artifact@v4
with:
name: dependencies
path: ./cache
tests:
name: πŸ” Execute Unit Tests
needs: setup
runs-on: ubuntu-latest
steps:
- name: Checkout Repository πŸ“₯
uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
node-version: 20
- name: Download Dependencies Artifact πŸ“₯
uses: actions/download-artifact@v4
with:
name: dependencies
path: ./
- name: Install Dependencies πŸ› οΈ
run: yarn install --immutable
- name: Run Tests πŸ§ͺ
run: yarn test
deploy:
name: πŸš€ Deploy to GitHub Pages
needs: [setup, tests]
if: github.ref == 'refs/heads/main' # Only deploy from the main branch
environment:
name: github-pages # Set deployment environment to GitHub Pages
url: ${{ steps.deployment.outputs.page_url }} # Output page URL
runs-on: ubuntu-latest
steps:
- name: Checkout Repository πŸ“₯
uses: actions/checkout@v4
- uses: ./.github/actions/setup
with:
node-version: 20
- name: Download Dependencies Artifact πŸ“₯
uses: actions/download-artifact@v4
with:
name: dependencies
path: ./
- name: Install Dependencies πŸ› οΈ
run: yarn install --immutable
- name: Build Static Content πŸ—οΈ
run: yarn build:demo # Build the static site with Vite
- name: Setup GitHub Pages βš™οΈ
uses: actions/configure-pages@v4
- name: Upload Build Artifacts πŸ“¦
uses: actions/upload-pages-artifact@v3
with:
path: './dist' # Path to the build output directory
- name: Deploy to GitHub Pages 🌐
id: deployment
uses: actions/deploy-pages@v4 # Deploy the build to GitHub Pages