Bucklescript Build in Github actions

bsb

#1

Hi all!

Has anyone had any success running a Bucklescript build in Github actions?

I have a ReasonReact app built with Parcel and Yarn. I’m running into some errors in the workflow. My Github workflow is based on Ubuntu Latest.

The build error can be seen here: https://github.com/RicheyRyan/gear-calculator/runs/458971445?check_suite_focus=true

Basically, it bs-platform tries to build ninja and fails because it can’t find python.

I have tried:

  • Setting up a python environment in the workflow
  • Including ninja directly in the workflow

If anyone has any pointers or even just other CI code that I could refer to, I’d be grateful!

Thanks,
Richey


#2

Yeah I’ve done this, didn’t have any issues. Here’s my workflow file (yarn build is the bs build step):

name: Checks

on: push

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1

      - uses: actions/setup-node@v1
        with:
          node-version: 10.x

      - name: Cache node modules
        uses: actions/cache@v1
        with:
          path: ~/.cache/yarn
          key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}/{1}', github.workspace, 'yarn.lock')) }}
          restore-keys: |
            ${{ runner.os }}-yarn-

      - run: yarn install --pure-lockfile

      - run: yarn lint

  typecheck:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1

      - uses: actions/setup-node@v1
        with:
          node-version: 10.x

      - name: Cache node modules
        uses: actions/cache@v1
        with:
          path: ~/.cache/yarn
          key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}/{1}', github.workspace, 'yarn.lock')) }}
          restore-keys: |
            ${{ runner.os }}-yarn-

      - run: yarn install --pure-lockfile

      - run: yarn typecheck

  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1

      - uses: actions/setup-node@v1
        with:
          node-version: 10.x

      - name: Cache node modules
        uses: actions/cache@v1
        with:
          path: ~/.cache/yarn
          key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}/{1}', github.workspace, 'yarn.lock')) }}
          restore-keys: |
            ${{ runner.os }}-yarn-

      - run: yarn install --pure-lockfile

      - run: yarn build
      - run: yarn test:ci --runInBand
        env:
          SMOOCH_KID: ${{ secrets.SMOOCH_KID }}
          SMOOCH_SECRET: ${{ secrets.SMOOCH_SECRET }}

  deploy-functions:
    needs: [lint, typecheck, test]
    if: github.ref == 'refs/heads/dev'

    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1

      - uses: actions/setup-node@v1
        with:
          node-version: 10.x

      - name: Cache node modules
        uses: actions/cache@v1
        with:
          path: ~/.cache/yarn
          key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}/{1}', github.workspace, 'yarn.lock')) }}
          restore-keys: |
            ${{ runner.os }}-yarn-

      - run: yarn install --pure-lockfile

      - run: yarn build
      - run: yarn deploy-functions --token ${{ secrets.FIREBASE_TOKEN }}
        env:
          SMOOCH_KID: ${{ secrets.SMOOCH_KID }}
          SMOOCH_SECRET: ${{ secrets.SMOOCH_SECRET }}

#3

Thanks @benadamstyles, using setup-node rather than the yarn action was the key! Thanks for the tip!