-
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.
Merge pull request #39 from shakacode/linux-arm64
Add Linux arm64 binary
- Loading branch information
Showing
15 changed files
with
350 additions
and
55 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
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
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
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,22 @@ | ||
{ | ||
"packages": [ | ||
"path:./nix/ocaml#ocaml", | ||
"path:./nix/ocaml#dune", | ||
"path:./nix/ocaml#findlib", | ||
"path:./nix/ocaml#ppxlib", | ||
"path:./nix/ocaml#merlin", | ||
"path:./nix/ocaml#lsp", | ||
"nodejs", | ||
"yarn", | ||
"awscli2" | ||
], | ||
"shell": { | ||
"init_hook": [ | ||
"export PATH=$PATH:node_modules/.bin" | ||
], | ||
"scripts": { | ||
"build": "dune build", | ||
"test": "dune exec test.exe" | ||
} | ||
} | ||
} |
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,23 @@ | ||
{ | ||
"lockfile_version": "1", | ||
"packages": { | ||
"awscli2": { | ||
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#awscli2", | ||
"source": "nixpkg" | ||
}, | ||
"nodejs": { | ||
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#nodejs", | ||
"source": "nixpkg" | ||
}, | ||
"path:./nix/ocaml#dune": {}, | ||
"path:./nix/ocaml#findlib": {}, | ||
"path:./nix/ocaml#lsp": {}, | ||
"path:./nix/ocaml#merlin": {}, | ||
"path:./nix/ocaml#ocaml": {}, | ||
"path:./nix/ocaml#ppxlib": {}, | ||
"yarn": { | ||
"resolved": "github:NixOS/nixpkgs/f80ac848e3d6f0c12c52758c0f25c10c97ca3b62#yarn", | ||
"source": "nixpkg" | ||
} | ||
} | ||
} |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,47 @@ | ||
{ | ||
description = "OCaml 4.12 packages for ReScript PPX development"; | ||
|
||
inputs = { | ||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
flake-utils.url = "github:numtide/flake-utils"; | ||
}; | ||
|
||
outputs = { self, nixpkgs, flake-utils }: | ||
flake-utils.lib.eachDefaultSystem (system: | ||
let | ||
overlay = (final: prev: { | ||
ocaml-ng = prev.ocaml-ng // { | ||
ocamlPackages_4_12 = prev.ocaml-ng.ocamlPackages_4_12 // { | ||
ppxlib = prev.ocaml-ng.ocamlPackages_4_12.ppxlib.overrideAttrs (_: { | ||
version = "git"; | ||
src = pkgs.fetchFromGitHub { | ||
owner = "zth"; | ||
repo = "ppxlib"; | ||
rev = "32f83395fb89693a873541298b6367449f23bc4a"; | ||
sha256 = "sha256-8bkmeFh5Unda8n3F2MQWi81QPt2NdkwFcy4wZTJ0STo="; | ||
}; | ||
patches = []; | ||
}); | ||
}; | ||
}; | ||
}); | ||
|
||
pkgs = import nixpkgs { | ||
inherit system; | ||
overlays = [ overlay ]; | ||
}; | ||
|
||
ocamlPackages = pkgs.ocaml-ng.ocamlPackages_4_12; | ||
in | ||
{ | ||
packages = { | ||
ocaml = ocamlPackages.ocaml; | ||
dune = ocamlPackages.dune_3; | ||
findlib = ocamlPackages.findlib; | ||
ppxlib = ocamlPackages.ppxlib; | ||
merlin = ocamlPackages.merlin; | ||
lsp = ocamlPackages.ocaml-lsp; | ||
}; | ||
} | ||
); | ||
} |
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
This file was deleted.
Oops, something went wrong.
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,69 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
export $(cat scripts/aws.env | xargs) | ||
|
||
ARCH="arm64" | ||
PLATFORM="linux" | ||
|
||
BIN="$LIB-$PLATFORM-$ARCH.exe" | ||
REMOTE_BIN="~/rescript-logger/$RELEASE_DIR/$BIN" | ||
RELEASE_BIN="$RELEASE_BIN_DIR/$BIN" | ||
|
||
echo "" | ||
echo "=== Preparing $PLATFORM $ARCH binary" | ||
|
||
echo "Creating EC2 instance" | ||
INSTANCE_ID=$( | ||
aws ec2 run-instances \ | ||
--image-id ami-0f69dd1d0d03ad669 \ | ||
--count 1 \ | ||
--instance-type m6g.medium \ | ||
--key-name rescript-logger \ | ||
--user-data file://scripts/user-data.linux-arm64.sh \ | ||
--tag-specifications="ResourceType=instance,Tags=[{Key=rescript-logger,Value=''}]" \ | ||
| jq -r ".Instances[0].InstanceId" | ||
) | ||
echo "EC2 instance $INSTANCE_ID created" | ||
|
||
echo "Getting public IP" | ||
while : | ||
do | ||
INSTANCE_IP=$( | ||
aws ec2 describe-instances --instance-ids $INSTANCE_ID | jq -r ".Reservations[0].Instances[0].PublicIpAddress" | ||
) | ||
if [ -n "$INSTANCE_IP" ]; | ||
then | ||
echo "Instance is available at $INSTANCE_IP" | ||
break; | ||
else | ||
sleep 5; | ||
fi | ||
done | ||
|
||
echo "Waiting for the build to complete" | ||
|
||
sleep 300 | ||
|
||
USER="ubuntu" | ||
|
||
while : | ||
do | ||
if ssh -o StrictHostKeyChecking=no -q -i scripts/aws.pem $USER@$INSTANCE_IP test -f "$REMOTE_BIN"; | ||
then | ||
echo "Binary is ready. Downloading." | ||
break | ||
else | ||
sleep 5 | ||
fi | ||
done | ||
|
||
scp -i scripts/aws.pem $USER@$INSTANCE_IP:$REMOTE_BIN $RELEASE_BIN | ||
echo "Downloaded." | ||
|
||
chmod $CHMOD $RELEASE_BIN | ||
|
||
echo "Terminating instance." | ||
aws ec2 terminate-instances --instance-ids $INSTANCE_ID | ||
echo "Instance terminated." |
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,16 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
ARCH=$(uname -m) | ||
PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]') | ||
|
||
echo "" | ||
echo "=== Preparing $PLATFORM $ARCH binary" | ||
|
||
SOURCE_BIN="_build/default/ppx/bin/bin.exe" | ||
RELEASE_BIN="$RELEASE_BIN_DIR/$LIB-$PLATFORM-$ARCH.exe" | ||
|
||
dune build | ||
cp $SOURCE_BIN $RELEASE_BIN | ||
chmod $CHMOD $RELEASE_BIN |
Oops, something went wrong.