Improvements #16
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
| # This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
| name: Node.js CI | |
| on: | |
| push: | |
| branches: ["main", "improvements"] | |
| pull_request: | |
| branches: ["*"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: node-ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [20.x, 22.x, 24.x] | |
| # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: "npm" | |
| - run: npm ci | |
| - run: npm run build --if-present | |
| - run: npm test --if-present | |
| packaging-smoke: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| cache: "npm" | |
| - run: npm ci | |
| - run: npm run bundle | |
| - name: Build Linux standalone binary | |
| run: npx pkg dist-bundle/index.cjs --targets node20-linux-x64 --out-path dist --no-bytecode --public | |
| - name: Smoke test packaged binary | |
| run: | | |
| if [ -f dist/investec-ipb-linux-x64 ]; then | |
| chmod +x dist/investec-ipb-linux-x64 | |
| ./dist/investec-ipb-linux-x64 --version | |
| elif [ -f dist/index ]; then | |
| chmod +x dist/index | |
| ./dist/index --version | |
| else | |
| echo "Packaged binary not found" | |
| exit 1 | |
| fi |