Skip to content

Commit

Permalink
build: fix workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhgray committed Oct 1, 2024
1 parent 921b4b1 commit 83427d5
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 20 deletions.
68 changes: 56 additions & 12 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,36 +17,80 @@ jobs:
uses: actions/checkout@v2

- name: Set up GraalVM
uses: DeLaGuardo/setup-graalvm@v4
uses: graalvm/setup-graalvm@v1
with:
version: 'latest'
java-version: '21'

- name: Install Native Image tool
run: gu install native-image

- name: Build jar with Gradle
run: ./gradlew build
run: |
cd tahini
./gradlew build
- name: Compile native image
run: native-image -jar app/build/libs/tahini.jar tahini
run: |
cd tahini
native-image -jar app/build/libs/app.jar tahini
- name: Rename binary for unique names on Macos and Linux
if: matrix.os != 'windows-latest'
run: |
cd tahini
if [[ "${{ matrix.os }}" == "ubuntu-latest" ]]; then
mv tahini tahini-linux
elif [[ "${{ matrix.os }}" == "macos-latest" ]]; then
mv tahini tahini-macos
fi
- name: Upload binary
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: tahini-${{ matrix.os }}
path: tahini*
path: tahini

release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download all binaries
uses: actions/download-artifact@v4
with:
path: .

- name: List files
run: |
echo "Listing files in current directory:"
ls -l
check_directory() {
local dir=$1
local file=$2
if [ -d "$dir" ]; then
echo "$dir directory exists."
if [ -f "$dir/$file" ]; then
echo "$file exists in $dir."
else
echo "$file does not exist in $dir. Listing files in $dir:"
ls -l "$dir"
fi
else
echo "$dir directory does not exist."
fi
}
check_directory "tahini-ubuntu-latest" "tahini"
check_directory "tahini-ubuntu-latest" "tahini-linux"
check_directory "tahini-macos-latest" "tahini"
check_directory "tahini-macos-latest" "tahini-macos"
check_directory "tahini-windows-latest" "tahini.exe"
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
tahini-ubuntu-latest
tahini-macos-latest
tahini-windows-latest.exe
tahini-ubuntu-latest/tahini-macos
tahini-macos-latest/tahini-linux
tahini-windows-latest/tahini.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ java -jar app/build/libs/app.jar "../test.tah"

### Variables

All variables in Tahini are dynamically typed, and you can declare them using the `var` keyword. Variables can be reassigned, and their scope is determined by the block in which they are declared.

```
var a = "global a";
{
Expand Down
11 changes: 3 additions & 8 deletions test.tah
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Fibonacci function
fun fib(n) {
fun fib(n)
precondition: n >= 0
{
if (n <= 1) return n;
return fib(n - 2) + fib(n - 1);
}
Expand All @@ -17,10 +19,3 @@ test "checking this out" {
assertion: fib(4) == 3;
assertion: fib(5) == 5;
}

// Test block that should fail
test "this should fail" {
assertion: fib(0) == 0;
assertion: fib(2) == 1222; // This will fail
assertion: fib(3) == 2;
}

0 comments on commit 83427d5

Please sign in to comment.