Skip to content

Commit

Permalink
Publish binary files for all platforms (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
lenguyenthanh authored Jun 26, 2022
1 parent 3125048 commit 82c13dc
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 3 deletions.
26 changes: 26 additions & 0 deletions .github/scripts/package.sc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//> using scala "3.1.2"
//> using lib "com.lihaoyi::os-lib:0.8.0"

import scala.util.Properties

val platformSuffix: String = {
val os =
if (Properties.isWin) "pc-win32"
else if (Properties.isLinux) "pc-linux"
else if (Properties.isMac) "apple-darwin"
else sys.error(s"Unrecognized OS: ${sys.props("os.name")}")
os
}
val artifactsPath = os.Path("artifacts", os.pwd)
val destPath =
if (Properties.isWin) artifactsPath / s"ulc-$platformSuffix.exe"
else artifactsPath / s"ulc-$platformSuffix"
val scalaCLILauncher =
if (Properties.isWin) "scala-cli.bat" else "scala-cli"

os.makeDir(artifactsPath)
os.proc(scalaCLILauncher, "package", "./ulc", "-o", destPath, "--native-image")
.call(cwd = os.pwd)
.out
.text()
.trim
15 changes: 13 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ on:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
build:
runs-on: ${{ matrix.OS }}
strategy:
matrix:
OS: ["ubuntu-latest", "macos-latest", "windows-latest"]
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -18,6 +21,14 @@ jobs:
- uses: VirtusLab/scala-cli-setup@v0.1
- name: Test
run: scala-cli test ulc --cross
- name: Package app
run: scala-cli .github/scripts/package.sc
- uses: actions/upload-artifact@v3
with:
name: artifacts
path: artifacts
if-no-files-found: error
retention-days: 2
format:
runs-on: "ubuntu-latest"
steps:
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish

on:
release:
types: [published]

jobs:
publish:
name: Publish for ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: ulc-pc-linux
asset_name: ulc-linux
- os: windows-latest
artifact_name: ulc-pc-win32.exe
asset_name: ulc-pc-win32.exe
- os: macos-latest
artifact_name: ulc-apple-darwin
asset_name: ulc-apple

steps:
- uses: actions/checkout@v3
- uses: coursier/cache-action@v6.3
- uses: VirtusLab/scala-cli-setup@v0.1
- name: Package app
run: scala-cli .github/scripts/package.sc
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./artifacts/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ github.ref }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.bsp
.metals
.ammonite
.npmrc
.scala
*.js
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# TODO
# README

A playground where I learn about interpreters, compilers, type theory and everything that related to those.

Expand Down
7 changes: 7 additions & 0 deletions ulc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

An interpreter for [untyped lambda calculus](https://en.wikipedia.org/wiki/Lambda_calculus) (ulc) with some extended grammars implemented in Scala 3. I added some extended syntax to make it easier to use (for example let binding or \ can be used instead of λ). You can check the formal grammar definition [here](./grammar.md)

## Try

If you want to try it locally, the fastest way it is go to [releases](https://github.com/lenguyenthanh/compilers/releases) page and download the binary file that works for your platform.

Another the way is clone this repo and use [scala-cli]() to build or run project with the instructions in [here](../README.md).

## Features

- REPL
Expand Down Expand Up @@ -80,3 +86,4 @@ We show the final result in de Bruijn form, which is not easy to read. I can imp
- Coloring the output
- Better error messages
- Recursion scheme
- Fully functional for repl/main

0 comments on commit 82c13dc

Please sign in to comment.