Update GitHub Actions workflow for test coverage (#17) #32
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: Base64 Converter (Built, Lint and Test) | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| # Set up Node.js | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' # or '20' for the latest LTS | |
| # Cache node_modules | |
| - name: Cache node modules | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| # Install dependencies | |
| - name: Install dependencies | |
| run: npm install --legacy-peer-deps | |
| # Run Prettier | |
| - name: Run Prettier | |
| run: npm run format | |
| # Run tests | |
| - name: Run tests | |
| run: npm run test | |
| env: | |
| CI: true | |
| NODE_OPTIONS: --enable-source-maps --max-old-space-size=4096 # Optional | |
| # Build the project | |
| - name: Build the project | |
| run: npm run build |