Skip to content

Commit 30fe23f

Browse files
authored
Get rid of esy and rely (#78)
* Get rid of esy and rely and use opam (directly) and alcotest instead * Reason 3.7.0 * Build on ubuntu-18.04
1 parent c4e6728 commit 30fe23f

File tree

91 files changed

+333
-4599
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+333
-4599
lines changed

Diff for: .github/workflows/ci.yml

+18-39
Original file line numberDiff line numberDiff line change
@@ -11,55 +11,40 @@ on:
1111
jobs:
1212
build:
1313
name: Build and test on ${{ matrix.os }}
14-
runs-on: ${{ matrix.os }}
1514
strategy:
1615
matrix:
17-
node-version: [14.x]
18-
os: [ubuntu-latest, macOS-latest, windows-2016]
16+
os:
17+
- macos-latest
18+
- ubuntu-18.04
19+
- windows-latest
1920

20-
steps:
21-
- name: Use Node.js ${{ matrix.node-version }}
22-
uses: actions/setup-node@v1
23-
with:
24-
node-version: ${{ matrix.node-version }}
21+
runs-on: ${{ matrix.os }}
2522

23+
steps:
2624
- name: Checkout repository
2725
uses: actions/checkout@v2
2826

2927
- name: Checkout submodules
3028
run: git submodule update --init --recursive
3129

32-
- name: Install esy
33-
run: npm i -g [email protected]
34-
35-
- name: Restore esy install cache
36-
uses: actions/cache@v1
30+
- name: Use Node.js 14
31+
uses: actions/setup-node@v2
3732
with:
38-
path: ~/.esy/source
39-
key: source-${{ hashFiles('**/index.json') }}
40-
41-
- name: esy install
42-
run: esy install
33+
node-version: 14
4334

44-
- name: Get esy cache folder
45-
id: print_esy_cache
46-
run: node .github/workflows/print_esy_cache.js
47-
48-
- name: Restore esy build cache
49-
uses: actions/cache@v1
35+
- name: Use OCaml 4.06.1
36+
uses: ocaml/setup-ocaml@v2
5037
with:
51-
path: ${{ steps.print_esy_cache.outputs.esy_cache }}
52-
key: build-${{ matrix.os }}-${{ hashFiles('**/index.json') }}
53-
restore-keys: build-${{ matrix.os }}-
38+
ocaml-compiler: 4.06.1
39+
40+
- name: OPAM install
41+
run: opam install . --deps-only --with-test
5442

5543
- name: Build
56-
run: |
57-
esy build
58-
# Cleanup build cache in case dependencies have changed
59-
esy cleanup .
44+
run: opam exec -- dune build
6045

6146
- name: Test
62-
run: esy test
47+
run: opam exec -- dune runtest
6348

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

8059
- name: (release only) Upload artifact ${{ matrix.os }}
8160
if: github.event_name != 'pull_request'

Diff for: .github/workflows/get_filenames.js

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
const fs = require("fs");
22
const os = require("os");
33

4-
const packageJson = fs.readFileSync("package.json");
5-
const { version } = JSON.parse(packageJson);
6-
4+
const version = getVersion();
75
const exeName = getExeName();
86
const platform = getPlatformName();
97
const artifactName = `rescript-react-intl-extractor-${version}-${platform}`;
@@ -12,6 +10,13 @@ const artifactName = `rescript-react-intl-extractor-${version}-${platform}`;
1210
console.log(`::set-output name=exe_name::${exeName}`);
1311
console.log(`::set-output name=artifact_name::${artifactName}`);
1412

13+
function getVersion() {
14+
const duneProject = fs.readFileSync("dune-project");
15+
const match = /\(version (.*)\)/.exec(duneProject);
16+
17+
return match[1];
18+
}
19+
1520
function getPlatformName() {
1621
const platform = os.platform();
1722

Diff for: .github/workflows/print_esy_cache.js

-21
This file was deleted.

Diff for: .gitignore

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
npm-debug.log
1+
_build/
22
.merlin
3-
yarn-error.log
4-
node_modules
5-
_build
6-
_esy
7-
_release
8-
*.byte
9-
*.native
10-
rescript-react-intl-extractor.install
113
.DS_Store

Diff for: .vscode/settings.json

-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
{
2-
"reason.codelens.enabled": true,
3-
"reason.format.width": 120,
4-
"reason_language_server.per_value_codelens": true,
5-
"reason_language_server.format_width": 120,
6-
"editor.rulers": [120],
72
"editor.tabSize": 2,
83
"editor.renderIndentGuides": false,
94
"files.insertFinalNewline": true

Diff for: README.md

+8-13
Original file line numberDiff line numberDiff line change
@@ -136,25 +136,20 @@ The ReScript parser is included as a git submodule. Therefore, after checking ou
136136

137137
git submodule update --init --recursive
138138

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

141-
% npm install -g esy
141+
Then run
142142

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

145-
% esy install
146+
To build the project, run
146147

147-
Then build the project dependencies along with the project itself:
148+
opam exec -- dune build
148149

149-
% esy build
150+
To run the tests, do
150151

151-
Run the compiled executable:
152-
153-
% esy x Extract.exe
154-
155-
Run the tests:
156-
157-
% esy test
152+
opam exec -- dune runtest
158153

159154
[rescript]: https://rescript-lang.org/
160155
[reason]: https://reasonml.github.io

Diff for: bin/dune

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
(executable
2-
(name Extract)
3-
(public_name Extract.exe)
4-
(libraries lib)
5-
)
2+
(name Extract)
3+
(public_name Extract.exe)
4+
(libraries lib))

Diff for: docker/Dockerfile

-7
This file was deleted.

Diff for: docker/README.md

-1
This file was deleted.

Diff for: dune-project

+35-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,36 @@
1-
(lang dune 2.0)
1+
(lang dune 2.7)
2+
3+
(name rescript-react-intl-extractor)
4+
5+
(version 0.12.0)
6+
7+
(generate_opam_files true)
8+
9+
(license MIT)
10+
11+
(authors "Christoph Knittel <[email protected]>")
12+
13+
(maintainers "Christoph Knittel <[email protected]>")
14+
15+
(source
16+
(github cca-io/rescript-react-intl-extractor))
17+
18+
(bug_reports
19+
"https://github.com/cca-io/rescript-react-intl-extractor/issues")
20+
21+
(homepage "https://github.com/cca-io/rescript-react-intl-extractor")
22+
23+
(documentation "https://github.com/cca-io/rescript-react-intl-extractor")
24+
25+
(package
226
(name rescript-react-intl-extractor)
27+
(synopsis "Extracts messages for localization from ReScript source files")
28+
(depends
29+
(alcotest :with-test)
30+
(ocaml
31+
(= 4.06.1))
32+
(reason
33+
(= 3.7.0))
34+
(yojson
35+
(= 1.7.0))
36+
dune))

Diff for: esy.lock/.gitattributes

-3
This file was deleted.

Diff for: esy.lock/.gitignore

-3
This file was deleted.

0 commit comments

Comments
 (0)