Skip to content

Fix error line number coming from parser #1819

Fix error line number coming from parser

Fix error line number coming from parser #1819

Workflow file for this run

name: Ppx CI
on:
push:
branches:
- main
pull_request:
branches:
- main
permissions:
contents: write
pull-requests: write
defaults:
run:
shell: bash
jobs:
build:
name: Build
strategy:
matrix:
os: [ubuntu-20.04, macos-latest] # Missing windows-latest
ocaml-compiler:
- 5.1.1
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
# https://github.com/mmottl/pcre-ocaml/issues/18
# https://github.com/actions/runner-images/issues/6634
- name: Install pcre (only MacOS)
if: matrix.os == 'macos-latest'
run: brew install pcre
- name: Use Node.js
uses: actions/setup-node@v3
- name: Use OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
- name: Load opam cache when not Windows
if: runner.os != 'Windows'
id: opam-cache
uses: actions/cache/restore@v3
with:
path: ~/.opam
key: opam-${{ matrix.os }}-${{ hashFiles('**.opam') }}
- name: Load opam cache when Windows
if: runner.os == 'Windows'
id: opam-cache-windows
uses: actions/cache/restore@v3
with:
path: _opam
key: opam-${{ matrix.os }}-${{ hashFiles('**.opam') }}
- name: Install dependencies
run: make install
- name: Build
run: make build
- name: Test
run: make test
- name: Release static
run: make release-static
- name: Upload artifacts for ${{ matrix.os }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}
path: _build/default/packages/bin/bin.exe
- name: Upload runtime artifacts for @davesnx/styled-ppx/runtime/css
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v3
with:
name: runtime-css
path: _build/default/packages/css/rescript
- name: Upload runtime artifacts for @davesnx/styled-ppx/runtime/emotion
if: matrix.os == 'ubuntu-20.04'
uses: actions/upload-artifact@v3
with:
name: runtime-emotion
path: _build/default/packages/emotion/rescript
- name: Save cache when not Windows
uses: actions/cache/save@v3
if: steps.opam-cache.outputs.cache-hit != 'true' && runner.os != 'Windows'
with:
path: ~/.opam
key: opam-${{ matrix.os }}-${{ hashFiles('**.opam') }}
- name: Save cache when Windows
uses: actions/cache/save@v3
if: steps.opam-cache-windows.outputs.cache-hit != 'true' && runner.os == 'Windows'
with:
path: _opam
key: opam-${{ matrix.os }}-${{ hashFiles('**.opam') }}
- name: Grant permission to run ppx
run: chmod +x _build/default/packages/bin/bin.exe
- name: Run E2E ReScript v9 tests
run: make test_e2e_rescript_v9
- name: Run E2E ReScript v10 tests
run: make test_e2e_rescript_v10
publish:
name: Publish
needs: build
if: github.repository_owner == 'davesnx'
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
- name: Make NPM release skeleton
run: node scripts/release-make-skeleton.js
- name: Print short SHA
id: sha
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Download linux artifacts
uses: actions/download-artifact@v3
with:
name: ubuntu-20.04
path: _release/platform-linux-x64
- name: Download macOS artifacts
uses: actions/download-artifact@v3
with:
name: macos-latest
path: _release/platform-darwin-x64
# - name: Download windows artifacts
# uses: actions/download-artifact@v3
# with:
# name: windows-latest
# path: _release/platform-windows-x64
- name: Download runtime-css artifacts
uses: actions/download-artifact@v3
with:
name: runtime-css
path: _release/css
- name: Download runtime-emotion artifacts
uses: actions/download-artifact@v3
with:
name: runtime-emotion
path: _release/emotion
- name: Release nightly (@davesnx/styled-ppx) package
if: ${{ success() && github.event_name == 'pull_request' && github.event.pull_request.user.login == 'davesnx' }}
id: nightly
working-directory: ./_release
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
run: |
ls -lhsa
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm config set scope "@davesnx"
npm version prerelease --preid ${{ steps.sha.outputs.sha_short }} -no-git-tag-version
npm publish --access public --tag nightly
echo "version=$(npm view @davesnx/styled-ppx@nightly version)" >> $GITHUB_OUTPUT
- name: Release (@davesnx/styled-ppx) package
if: ${{ success() && github.event_name != 'pull_request' }}
working-directory: ./_release
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
run: |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
npm config set scope "@davesnx"
REMOTE=$(npm view @davesnx/styled-ppx version)
CURRENT=$(jq -r '.version' package.json)
if [ "$REMOTE" != "$CURRENT" ]
then
npm publish --access public
else
echo "New verison and remote version are equal, nothing to publish"
fi
- uses: mshick/add-pr-comment@v2
if: ${{ steps.nightly.outputs.version }}
with:
message: |
New **nightly** version has been published to the NPM registry: [@davesnx/styled-ppx@${{ steps.nightly.outputs.version }}](https://www.npmjs.com/package/@davesnx/styled-ppx/v/${{ steps.nightly.outputs.version }}).
Install it with `npm install @davesnx/styled-ppx@nightly` or `npm install @davesnx/styled-ppx@${{ steps.nightly.outputs.version }}`.
repo-token: ${{ secrets.GITHUB_TOKEN }}
allow-repeats: false