This repository has been archived by the owner on Nov 13, 2023. It is now read-only.
Update README.md #145
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
name: CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-latest, ubuntu-18.04, windows-latest] | |
# syntax explanation: | |
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations | |
include: | |
- os: macos-latest | |
build: eval $(opam env) && dune build && npm test | |
artifact-folder: darwin | |
- os: ubuntu-18.04 | |
build: eval $(opam env) && dune build && npm test | |
artifact-folder: linux | |
- os: windows-latest | |
build: "& $env:CYGWIN_ROOT\\bin\\ocaml-env exec -- dune build" | |
artifact-folder: win32 | |
runs-on: ${{matrix.os}} | |
steps: | |
# needed for Windows testing | |
- name: Set git to use LF | |
run: | | |
git config --global core.autocrlf false | |
git config --global core.eol lf | |
- uses: actions/[email protected] | |
- name: Cache OCaml's opam | |
uses: actions/[email protected] | |
with: | |
path: ~/.opam | |
key: ${{matrix.os}}-rescript-vscode-v2 | |
- name: Use OCaml | |
uses: ocaml/setup-ocaml@v2 | |
with: | |
ocaml-compiler: 4.12.x | |
- name: Use Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 14.4.0 | |
- run: npm ci | |
- run: opam install dune | |
- name: Build and test | |
run: ${{matrix.build}} | |
# Also avoids artifacts upload permission loss: | |
# https://github.com/actions/upload-artifact/tree/ee69f02b3dfdecd58bb31b4d133da38ba6fe3700#permission-loss | |
- name: Compress files | |
run: | | |
mkdir ${{matrix.artifact-folder}} | |
cp _build/default/src/GenType.exe gentype.exe | |
tar -cvf binary.tar gentype.exe | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: ${{matrix.os}} | |
path: binary.tar | |
npm_pack: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/[email protected] | |
- name: download binaries | |
uses: actions/download-artifact@v2 | |
- name: Pack genType | |
run: | | |
# Put the built artifacts in the appropriate package folder | |
tar xf macos-latest/binary.tar -C dist/vendor-darwin | |
tar xf ubuntu-18.04/binary.tar -C dist/vendor-linux | |
tar xf windows-latest/binary.tar -C dist/vendor-win32 | |
# Add the correct package.json / README / etc to dist | |
node scripts/prepare_release.js | |
# Pack everything up | |
cd dist | |
npm pack | |
cd .. | |
mv dist/gentype-*.tgz gentype-npm.tgz | |
- name: upload gentype-npm.tgz | |
uses: actions/upload-artifact@v2 | |
with: | |
name: gentype-npm.tgz | |
path: gentype-npm.tgz |