generated from esy-packages/template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 3509988
Showing
9 changed files
with
795 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Build and test the esy package | ||
|
||
on: | ||
- push | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- macos-13 | ||
- macos-latest | ||
- ubuntu-latest | ||
- windows-latest | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
|
||
- name: Install esy, verdaccio and esy-package | ||
run: npm install -g esy esy-package | ||
|
||
- name: Run end-to-end tests on the package | ||
run: DEBUG=bale*,verdaccio* esy-package | ||
shell: bash | ||
env: | ||
SHELL: "bash.exe" # HACK!! For some weird reason, $SHELL in Github actions' Windows' bash shell doesn't set this environment variable. We rely on it to figure if path normalisation is necessary on Gitbash Windows | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: release | ||
path: package.tar.gz |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
*~ | ||
node_modules | ||
_esy | ||
_esy-package | ||
.log | ||
package.tar.gz | ||
package.tgz | ||
verdaccio-storage |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
//localhost:4873/:_authToken="+vVrDzq8gudTDDEoQOS+PQ==" |
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 |
---|---|---|
@@ -0,0 +1,139 @@ | ||
![Build and test the esy | ||
package](https://github.com/ManasJayanth/esy-packages-template/workflows/Build%20and%20test%20the%20esy%20package/badge.svg) | ||
|
||
# esy-zlib | ||
|
||
`esy-zlib` is sample package, [`zlib`](https://www.zlib.net/), packaged for [`esy`](https://esy.sh/). | ||
|
||
## Why | ||
`esy` can not only fetch and install Reason and OCaml libraries and tools, | ||
but also those written in C. This extends reproducibility benefits to | ||
packages written in C, like `skia`, `libffi`, `pkg-config` | ||
etc. Users don't have to install them separately, nor have to worry if | ||
they have installed the correct version. Read more at the docs about | ||
[benefits for opting for esy packages](https://esy.sh#TODO). | ||
|
||
## How to use `esy-zlib`? | ||
|
||
`esy-zlib` can be used from both NPM and directly from Github. | ||
|
||
### From NPM | ||
|
||
`esy-zlib` is deployed on NPM can be found | ||
[here](https://www.npmjs.com/package/TODO). | ||
|
||
You can simply run `esy add esy-zlib` to install it, or specify it in | ||
`package.json` and run `esy`. | ||
|
||
```diff | ||
{ | ||
"dependencies": { | ||
+ "esy-zlib": "*" | ||
} | ||
} | ||
``` | ||
|
||
### Directly from Github | ||
|
||
```json | ||
{ | ||
"dependencies": { | ||
"esy-zlib": "esy-packages/esy-zlib" | ||
} | ||
} | ||
``` | ||
|
||
i.e. `<GITHUB_ORG or USERNAME>/<REPO NAME>` | ||
|
||
To use a specific commit, | ||
|
||
```diff | ||
"dependencies": { | ||
+ "esy-zlib": "esy-packages/esy-zlib#<commit hash>" | ||
} | ||
``` | ||
|
||
## How to package for esy? | ||
|
||
### For the experienced | ||
|
||
**The gist** | ||
Specify the configure and build commands in `esy.build` property of | ||
`esy.json` and the install step in `esy.install`. If the package | ||
builds "in source", set `esy.buildsInSource` property to `true`. Use | ||
`$cur__install` environment variable to set the install location. | ||
|
||
See [docs](TODO) for reference. | ||
|
||
The CI will take care of fetching the sources and creating an NPM | ||
package for you. See [script.js](TODO) to see how it works. | ||
|
||
You can download it or auto publish via CI. | ||
|
||
### For beginners | ||
|
||
> Note: you'll need Node.js for this tutorial. If you're experienced | ||
> with bash, you can use it instead. | ||
Fundamentally, packaging for esy works like in other Linux distros, | ||
except ofcourse, such that packages become available on MacOS and | ||
Windows too. | ||
|
||
You would typically have to specify the instructions to build the | ||
package in the `esy.json`. For example, everyone's favourite http | ||
tool, [curl](https://curl.se/), needs the following instructions ([as | ||
described on their website](https://curl.se/docs/install.html)) | ||
|
||
```sh | ||
./configure | ||
make | ||
make install | ||
``` | ||
|
||
Many packages have similar instructions! | ||
|
||
Configure and build steps are specified in the `esy.build` property in | ||
the `esy.json` and install steps in `esy.install`. Example, | ||
|
||
```json | ||
{ | ||
"esy": { | ||
"build": [ | ||
"./configure", | ||
"make" | ||
], | ||
"install": [ | ||
"make install" | ||
] | ||
} | ||
} | ||
``` | ||
|
||
|
||
## Testing and making sure the package works as expected | ||
|
||
To test if the package works, we recommend an end-to-end test by | ||
publishing it to local | ||
[`verdaccio`](https://github.com/verdaccio/verdaccio), and using the | ||
package with a `package.json` or `esy.json` depends on it. | ||
|
||
```json | ||
{ | ||
"dependencies": { | ||
esy-zlib": "*" | ||
} | ||
} | ||
``` | ||
|
||
And pointing `esy` to the local npm registry | ||
|
||
```sh | ||
esy i --npm-registry http://localhost:4873 | ||
esy b | ||
``` | ||
|
||
If the package is a library, it's a good idea to write a small program | ||
to actually check if the library works. Referring how the | ||
corresponding package is being tested in Homebrew or Arch Linux. | ||
|
||
Checkout [ci-test.sh](./ci-test.sh) for reference, used on the CI. |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
esy.lock | ||
_esy | ||
node_modules |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
See [Readme in the root][../Readme.md#testing-and-making-sure-package-works-as-expected] |
Oops, something went wrong.