Skip to content

add batch size normalisation to unit_conversion workflow #280

add batch size normalisation to unit_conversion workflow

add batch size normalisation to unit_conversion workflow #280

Workflow file for this run

name: Frontend CI
on:
push:
branches: [main, develop]
paths:
- "frontend/**"
- ".github/workflows/frontend-ci.yml"
pull_request:
branches: [main, develop]
paths:
- "frontend/**"
- ".github/workflows/frontend-ci.yml"
permissions:
contents: write
pull-requests: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
ref: ${{ github.head_ref }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
cache-dependency-path: "./frontend/package-lock.json"
- name: Install dependencies
working-directory: ./frontend
run: npm ci
- name: TypeScript type checking
working-directory: ./frontend
run: npx tsc --noEmit
- name: Format code with Prettier
working-directory: ./frontend
run: npm run format
- name: Check for formatting changes
id: verify-changed-files
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Commit formatting changes
if: steps.verify-changed-files.outputs.changed == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Auto-format code with Prettier
🤖 This commit was automatically generated by GitHub Actions
to ensure consistent code formatting across the project."
# Push to the correct branch based on context
if [ "${{ github.event_name }}" == "pull_request" ]; then
git push origin HEAD:${{ github.head_ref }}
else
git push origin HEAD:${{ github.ref_name }}
fi
- name: Run tests with coverage
working-directory: ./frontend
env:
REACT_APP_API_URL: "http://localhost:5000/api"
CI: true
NODE_ENV: test
run: npm run coverage
- name: Build application
working-directory: ./frontend
env:
REACT_APP_API_URL: "http://localhost:5000/api"
CI: false
run: npm run build
- name: Upload coverage reports
uses: codecov/codecov-action@v4
with:
directory: ./frontend/coverage
flags: frontend
name: frontend-coverage
fail_ci_if_error: false