Begin integration of unit conversion + optimisation to BeerXML import flow #225
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: BrewTrackerAndroid CI | |
| on: | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: "npm" | |
| cache-dependency-path: "./package-lock.json" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: TypeScript type checking | |
| run: npm run type-check | |
| - name: Lint code | |
| run: npm run lint || echo "Linting warnings/errors found - see output above. Consider fixing these for better code quality." | |
| - name: Format code with Prettier | |
| 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' && github.event.pull_request.head.repo.full_name == github.repository | |
| 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." | |
| git push origin "HEAD:${{ github.head_ref }}" | |
| - name: Skip auto-commit for forks | |
| if: steps.verify-changed-files.outputs.changed == 'true' && github.event.pull_request.head.repo.full_name != github.repository | |
| run: | | |
| echo "Skipping auto-commit: PR from a fork cannot be pushed by GITHUB_TOKEN." | |
| - name: Run tests with coverage | |
| env: | |
| CI: true | |
| NODE_ENV: test | |
| run: npm run test:ci | |
| - name: Build application (Expo prebuild check) | |
| run: npx expo install --fix | |