Skip to content

Get rid of esy and rely #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 18 additions & 39 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,55 +11,40 @@ on:
jobs:
build:
name: Build and test on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [14.x]
os: [ubuntu-latest, macOS-latest, windows-2016]
os:
- macos-latest
- ubuntu-18.04
- windows-latest

steps:
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Checkout submodules
run: git submodule update --init --recursive

- name: Install esy
run: npm i -g [email protected]

- name: Restore esy install cache
uses: actions/cache@v1
- name: Use Node.js 14
uses: actions/setup-node@v2
with:
path: ~/.esy/source
key: source-${{ hashFiles('**/index.json') }}

- name: esy install
run: esy install
node-version: 14

- name: Get esy cache folder
id: print_esy_cache
run: node .github/workflows/print_esy_cache.js

- name: Restore esy build cache
uses: actions/cache@v1
- name: Use OCaml 4.06.1
uses: ocaml/setup-ocaml@v2
with:
path: ${{ steps.print_esy_cache.outputs.esy_cache }}
key: build-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
restore-keys: build-${{ matrix.os }}-
ocaml-compiler: 4.06.1

- name: OPAM install
run: opam install . --deps-only --with-test

- name: Build
run: |
esy build
# Cleanup build cache in case dependencies have changed
esy cleanup .
run: opam exec -- dune build

- name: Test
run: esy test
run: opam exec -- dune runtest

- name: (release only) Get artifact filenames
id: get_filenames
Expand All @@ -69,13 +54,7 @@ jobs:
- name: (release only) Get exe
if: github.event_name != 'pull_request'
shell: bash
run: |
# from https://stackoverflow.com/a/24848739/617787
s=$(pwd); d=$(dirname $(esy x which Extract.exe));
while [ "${d#$s/}" == "${d}" ]
do s=$(dirname $s);b="../${b}"; done;
ESY__BINARY_PATH=${b}${d#$s/}/Extract.exe
mv "$ESY__BINARY_PATH" ${{ steps.get_filenames.outputs.exe_name }}
run: mv _build/default/bin/Extract.exe ${{ steps.get_filenames.outputs.exe_name }}

- name: (release only) Upload artifact ${{ matrix.os }}
if: github.event_name != 'pull_request'
Expand Down
11 changes: 8 additions & 3 deletions .github/workflows/get_filenames.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
const fs = require("fs");
const os = require("os");

const packageJson = fs.readFileSync("package.json");
const { version } = JSON.parse(packageJson);

const version = getVersion();
const exeName = getExeName();
const platform = getPlatformName();
const artifactName = `rescript-react-intl-extractor-${version}-${platform}`;
Expand All @@ -12,6 +10,13 @@ const artifactName = `rescript-react-intl-extractor-${version}-${platform}`;
console.log(`::set-output name=exe_name::${exeName}`);
console.log(`::set-output name=artifact_name::${artifactName}`);

function getVersion() {
const duneProject = fs.readFileSync("dune-project");
const match = /\(version (.*)\)/.exec(duneProject);

return match[1];
}

function getPlatformName() {
const platform = os.platform();

Expand Down
21 changes: 0 additions & 21 deletions .github/workflows/print_esy_cache.js

This file was deleted.

10 changes: 1 addition & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
npm-debug.log
_build/
.merlin
yarn-error.log
node_modules
_build
_esy
_release
*.byte
*.native
rescript-react-intl-extractor.install
.DS_Store
5 changes: 0 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"reason.codelens.enabled": true,
"reason.format.width": 120,
"reason_language_server.per_value_codelens": true,
"reason_language_server.format_width": 120,
"editor.rulers": [120],
"editor.tabSize": 2,
"editor.renderIndentGuides": false,
"files.insertFinalNewline": true
Expand Down
21 changes: 8 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,25 +136,20 @@ The ReScript parser is included as a git submodule. Therefore, after checking ou

git submodule update --init --recursive

Install [esy] as follows:
Install Ocaml and OPAM, and create an OPAM switch with OCaml version 4.06.1.

% npm install -g esy
Then run

Then you can install the project dependencies using:
opam pin add rescript-react-intl-extractor.dev . --no-action
opam install . --deps-only --with-doc --with-test

% esy install
To build the project, run

Then build the project dependencies along with the project itself:
opam exec -- dune build

% esy build
To run the tests, do

Run the compiled executable:

% esy x Extract.exe

Run the tests:

% esy test
opam exec -- dune runtest

[rescript]: https://rescript-lang.org/
[reason]: https://reasonml.github.io
Expand Down
7 changes: 3 additions & 4 deletions bin/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(executable
(name Extract)
(public_name Extract.exe)
(libraries lib)
)
(name Extract)
(public_name Extract.exe)
(libraries lib))
7 changes: 0 additions & 7 deletions docker/Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion docker/README.md

This file was deleted.

36 changes: 35 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
@@ -1,2 +1,36 @@
(lang dune 2.0)
(lang dune 2.7)

(name rescript-react-intl-extractor)

(version 0.12.0)

(generate_opam_files true)

(license MIT)

(authors "Christoph Knittel <[email protected]>")

(maintainers "Christoph Knittel <[email protected]>")

(source
(github cca-io/rescript-react-intl-extractor))

(bug_reports
"https://github.com/cca-io/rescript-react-intl-extractor/issues")

(homepage "https://github.com/cca-io/rescript-react-intl-extractor")

(documentation "https://github.com/cca-io/rescript-react-intl-extractor")

(package
(name rescript-react-intl-extractor)
(synopsis "Extracts messages for localization from ReScript source files")
(depends
(alcotest :with-test)
(ocaml
(= 4.06.1))
(reason
(= 3.7.0))
(yojson
(= 1.7.0))
dune))
3 changes: 0 additions & 3 deletions esy.lock/.gitattributes

This file was deleted.

3 changes: 0 additions & 3 deletions esy.lock/.gitignore

This file was deleted.

Loading