-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
62 changed files
with
380 additions
and
2,750 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,187 +4,323 @@ on: | |
pull_request: | ||
branches: | ||
- master | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
build: | ||
name: Build on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
validate: | ||
name: Validate | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
ocaml-version: [4.14.1] | ||
node-version: [16.x] | ||
os: [macOS-latest, windows-latest] | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Print Yarn cache | ||
id: print-yarn-cache | ||
run: echo "::set-output name=yarn-cache::$(yarn cache dir)" | ||
run: echo "yarn-cache=$(yarn cache dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Restore Yarn cache | ||
id: yarn-cache | ||
uses: actions/cache@v1 | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.print-yarn-cache.outputs.yarn-cache }} | ||
key: ${{ matrix.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
key: ${{ matrix.os }}-yarn-${{ hashFiles('yarn.lock', '*/yarn.lock') }} | ||
|
||
- name: Install Yarn deps | ||
run: yarn install | ||
|
||
- name: Install Esy | ||
run: npm install -g [email protected] | ||
- name: Setup OCaml ${{ matrix.ocaml-version }} | ||
uses: ocaml/setup-ocaml@v2 | ||
with: | ||
ocaml-compiler: ${{ matrix.ocaml-version }} | ||
|
||
- name: Install Opam deps | ||
run: opam install . --deps-only --with-test | ||
|
||
- name: Build PPX | ||
run: opam exec -- dune build | ||
|
||
- name: Build ReScript lib | ||
run: | | ||
cd lib | ||
yarn run build | ||
- name: Build ReScript examples | ||
run: | | ||
cd examples | ||
yarn run build | ||
- name: Install Esy deps | ||
run: esy install | ||
build_macos: | ||
name: Build on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
needs: | ||
- validate | ||
strategy: | ||
matrix: | ||
os: [macos-13, macos-14] | ||
ocaml-version: [4.14.1] | ||
node-version: [16.x] | ||
|
||
- name: Print Esy cache | ||
id: print-esy-cache | ||
run: node .github/workflows/scripts/print-esy-cache.js | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Restore Esy cache | ||
id: esy-cache | ||
uses: actions/cache@v1 | ||
- name: Setup Node ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
path: ${{ steps.print-esy-cache.outputs.esy-cache }} | ||
key: ${{ matrix.os }}-esy-${{ hashFiles('**/index.json') }} | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Build ppx | ||
run: esy build | ||
- name: Print Yarn cache | ||
id: print-yarn-cache | ||
run: echo "yarn-cache=$(yarn cache dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Restore Yarn cache | ||
id: yarn-cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.print-yarn-cache.outputs.yarn-cache }} | ||
key: ${{ matrix.os }}-yarn-${{ hashFiles('yarn.lock', '*/yarn.lock') }} | ||
|
||
- name: Install Yarn deps | ||
run: yarn install | ||
|
||
- name: Setup OCaml ${{ matrix.ocaml-version }} | ||
uses: ocaml/setup-ocaml@v2 | ||
with: | ||
ocaml-compiler: ${{ matrix.ocaml-version }} | ||
|
||
- name: Build lib | ||
- name: Install Opam deps | ||
run: opam install . --deps-only --with-test | ||
|
||
- name: Build PPX | ||
run: opam exec -- dune build | ||
|
||
- name: Build ReScript lib | ||
run: | | ||
cd lib | ||
yarn run build | ||
- name: Build ReScript examples | ||
run: | | ||
cd examples | ||
yarn run build | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v1 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.os }} | ||
path: _build/default/ppx/bin/bin.exe | ||
|
||
build_linux: | ||
name: Build on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
name: Build on ${{ matrix.container-os }} | ||
runs-on: ${{ matrix.host-os }} | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
needs: | ||
- validate | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
|
||
host-os: [ubuntu-latest] | ||
container-os: [linux-alpine-3] | ||
ocaml-version: [4.14.1] | ||
node-version: [16.x] | ||
container: | ||
image: alexfedoseev/alpine-node-yarn-esy:0.0.9 | ||
image: alex35mil/alpine-ocaml-opam-node-yarn:alpine-3.19-ocaml-4.14-node-16.20-yarn-1.22-o5gm | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Apply static linking patch | ||
run: git apply linux.patch | ||
- name: Print Yarn cache | ||
id: print-yarn-cache | ||
run: echo "yarn-cache=$(yarn cache dir)" >> $GITHUB_OUTPUT | ||
|
||
- name: Restore Yarn cache | ||
id: yarn-cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.print-yarn-cache.outputs.yarn-cache }} | ||
key: ${{ matrix.container-os }}-yarn-${{ hashFiles('yarn.lock', '*/yarn.lock') }} | ||
|
||
- name: Install Yarn deps | ||
run: yarn install | ||
|
||
- name: Setup OCaml ${{ matrix.ocaml-version }} | ||
run: opam init -a --disable-sandboxing --compiler=${{ matrix.ocaml-version }} | ||
|
||
- name: Install Opam deps | ||
run: opam install . --deps-only --with-test | ||
|
||
- name: Build PPX | ||
run: opam exec -- dune build --profile static | ||
|
||
- name: Build ReScript lib | ||
run: | | ||
cd lib | ||
yarn run build | ||
- name: Build ReScript examples | ||
run: | | ||
cd examples | ||
yarn run build | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.container-os }} | ||
path: _build/default/ppx/bin/bin.exe | ||
|
||
build_windows: | ||
name: Build on ${{ matrix.os }} | ||
runs-on: ${{ matrix.os }} | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
needs: | ||
- validate | ||
strategy: | ||
matrix: | ||
os: [windows-latest] | ||
ocaml-version: [4.14.1] | ||
node-version: [16.x] | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Print Yarn cache | ||
id: print-yarn-cache | ||
run: echo "::set-output name=yarn-cache::$(yarn cache dir)" | ||
run: echo "::set-output name=yarn-cache::$(yarn cache dir)" # Using the old way as the new way doesn't work on windows | ||
|
||
- name: Restore Yarn cache | ||
id: yarn-cache | ||
uses: actions/cache@v1 | ||
uses: actions/cache@v4 | ||
with: | ||
path: ${{ steps.print-yarn-cache.outputs.yarn-cache }} | ||
key: ${{ matrix.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | ||
key: ${{ matrix.os }}-yarn-${{ hashFiles('yarn.lock', '*/yarn.lock') }} | ||
|
||
- name: Install Yarn deps | ||
run: yarn install | ||
|
||
- name: Install Esy deps | ||
run: esy install | ||
- name: Apply Opam deps patch | ||
run: | | ||
$lastCommitterName = git log -1 --pretty=format:'%an' | ||
$lastCommitterEmail = git log -1 --pretty=format:'%ae' | ||
git config user.name "$lastCommitterName" | ||
git config user.email "$lastCommitterEmail" | ||
git apply windows.patch | ||
git add . | ||
git commit -m "Patch opam deps" | ||
- name: Setup OCaml ${{ matrix.ocaml-version }} | ||
uses: ocaml/setup-ocaml@v2 | ||
with: | ||
ocaml-compiler: ${{ matrix.ocaml-version }} | ||
|
||
- name: Print Esy cache | ||
id: print-esy-cache | ||
run: node .github/workflows/scripts/print-esy-cache.js | ||
- name: Pin Opam deps | ||
run: | | ||
opam pin add dune https://github.com/ocaml/dune.git#7cbb0e7 # 3.11.1 | ||
opam pin add ppxlib https://github.com/ocaml-ppx/ppxlib.git#f0496c9 # 0.30.0 | ||
- name: Restore Esy cache | ||
id: esy-cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.print-esy-cache.outputs.esy-cache }} | ||
key: ${{ matrix.os }}-esy-${{ hashFiles('**/index.json') }} | ||
- name: Install Opam deps | ||
run: opam install . --deps-only --with-test | ||
|
||
- name: Build ppx | ||
run: esy build | ||
- name: Build PPX | ||
run: opam exec -- dune build | ||
|
||
- name: Build lib | ||
- name: Build ReScript lib | ||
run: | | ||
cd lib | ||
yarn run build | ||
- name: Build ReScript examples | ||
run: | | ||
cd examples | ||
yarn run build | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v1 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.os }} | ||
path: _build/default/ppx/bin/bin.exe | ||
|
||
release: | ||
prepare_release: | ||
needs: | ||
- build | ||
- build_macos | ||
- build_linux | ||
name: Prepare RC | ||
- build_windows | ||
name: Prepare release | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Node ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: Download Linux artifacts | ||
uses: actions/download-artifact@v1 | ||
- name: Download macOS x86 artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ubuntu-latest | ||
path: _bin/linux | ||
name: macos-13 | ||
path: _bin/darwin/intel | ||
|
||
- name: Download macOS artifacts | ||
uses: actions/download-artifact@v1 | ||
- name: Download macOS ARM artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: macOS-latest | ||
path: _bin/darwin | ||
name: macos-14 | ||
path: _bin/darwin/arm | ||
|
||
- name: Download Linux artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: linux-alpine-3 | ||
path: _bin/linux | ||
|
||
- name: Download Windows artifacts | ||
uses: actions/download-artifact@v1 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: windows-latest | ||
path: _bin/windows | ||
|
||
- name: Move artifacts | ||
run: | | ||
mkdir -p _release/bin | ||
mv _bin/darwin/bin.exe _release/bin/rescript-logger-ppx-darwin-x64.exe | ||
mv _bin/windows/bin.exe _release/bin/rescript-logger-ppx-win-x64.exe | ||
mv _bin/linux/bin.exe _release/bin/rescript-logger-ppx-linux-x64.exe | ||
mv _bin/darwin/intel/bin.exe _release/bin/re-formality-ppx-darwin-x64.exe | ||
mv _bin/darwin/arm/bin.exe _release/bin/re-formality-ppx-darwin-arm64.exe | ||
mv _bin/linux/bin.exe _release/bin/re-formality-ppx-linux-x64.exe | ||
mv _bin/windows/bin.exe _release/bin/re-formality-ppx-win-x64.exe | ||
rm -rf _bin | ||
- name: Move lib files | ||
run: | | ||
mkdir -p _release/src | ||
cp README.md _release/README.md | ||
cp lib/bsconfig.json _release/bsconfig.json | ||
cp lib/rescript.json _release/rescript.json | ||
cp -a lib/src/. _release/src/ | ||
cp .github/workflows/scripts/postinstall.js _release/postinstall.js | ||
node .github/workflows/scripts/write-package-json.js | ||
- name: Upload release | ||
uses: actions/upload-artifact@v1 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: release | ||
path: _release |
Oops, something went wrong.