Skip to content

V0.14.0 #506

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export ZIGLER_TEST_BLAS=true
72 changes: 72 additions & 0 deletions .github/workflows/freebsd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Elixir CI - FreeBSD

on: push

jobs:
freebsd:
runs-on: ubuntu-latest
name: FreeBSD / Elixir
steps:
- uses: actions/checkout@v4

- uses: erlef/setup-beam@v1
name: Setup Erlang
with:
otp-version: '27.3'
elixir-version: '1.18.3'

- uses: actions/cache@v3
id: deps-cache
with:
path: deps
key: mix-${{ hashFiles('/mix.lock') }}

- name: get deps
run: mix deps.get

- uses: actions/cache@v3
id: zig-cache
with:
path: zig
key: zig-freebsd

- name: get zig
run: |
if [ ! -d zig ]; then
git clone -b 0.14.0 https://github.com/ziglang/zig.git
fi

- name: Test in FreeBSD
id: test
uses: vmactions/freebsd-vm@v1
with:
mem: 8192
usesh: true
prepare: |
pkg install -y erlang-runtime27
pkg install -y elixir-devel
pkg install -y llvm19
pkg install -y ca_root_nss

pkg install -y cmake zstd libxml2 lzma ninja

ldconfig /usr/local/lib

run: |
cd zig
mkdir build

cd build
cmake .. -G Ninja -DZIG_STATIC_LLVM=ON -DCMAKE_PREFIX_PATH="/usr/local/llvm19;/usr/local;/usr/local/lib" -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/lib" -DCMAKE_BUILD_TYPE=ReleaseSafe

ninja -C .

export ZIG_EXECUTABLE_PATH="$(pwd)/stage3/bin/zig"
export PATH="/usr/local/lib/erlang27/bin:$PATH"
export SSL_CACERTFILE=/usr/local/etc/ssl/cert.pem

cd ../..

mix local.hex --force

mix test --exclude no_ci --exclude skip_freebsd
23 changes: 13 additions & 10 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,37 @@ jobs:
strategy:
matrix:
pair:
- otp-version: '27.0'
elixir-version: '1.17.2'
- otp-version: '27.3'
elixir-version: '1.18.3'
- otp-version: '27.3'
elixir-version: '1.17.3'
- otp-version: '26.2'
elixir-version: '1.16.3'
- otp-version: '25.3'
elixir-version: '1.15.2'
elixir-version: '1.15.8'
- otp-version: '24.3'
elixir-version: '1.14.5'
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
with:
otp-version: ${{matrix.pair.otp-version}}
elixir-version: ${{matrix.pair.elixir-version}}

- uses: actions/cache@v1
- uses: actions/cache@v3
id: deps-cache
with:
path: deps
key: ${{ runner.os }}-mix-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
key: ${{ runner.os }}-mix-${{ matrix.pair.otp-version }}-${{ matrix.pair.elixir-version }}-${{ hashFiles('/mix.lock') }}-${{ hashfiles('installer/**/*') }}

- name: Install dependencies
run: mix deps.get

- uses: actions/cache@v1
- uses: actions/cache@v3
id: build-cache
with:
path: _build
key: ${{ runner.os }}-build-${{ matrix.otp }}-${{ matrix.elixir }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
key: ${{ runner.os }}-build-${{ matrix.pair.otp-version }}-${{ matrix.elixir-version }}-${{ hashFiles('/mix.lock') }}

- name: Compile base
run: mix compile
Expand All @@ -46,7 +48,7 @@ jobs:
id: zig-version
run: mix eval "IO.puts(Zig.version())"

- uses: actions/cache@v1
- uses: actions/cache@v3
id: zig-cache
with:
path: zig
Expand All @@ -57,5 +59,6 @@ jobs:

- name: Run Tests
env:
RUNNING_CI: "true"
RUNNING_CI: "TRUE"
ZIGLER_TEST_BLAS: "TRUE"
run: mix test --exclude no_ci
20 changes: 13 additions & 7 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jobs:
runs-on: macos-latest
name: MacOS-latest-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: update-brew
run: brew update
Expand All @@ -23,33 +23,39 @@ jobs:
id: elixir-version
run: elixir --version | tail -n 1 | awk '{ print $2 }'

- uses: actions/cache@v1
- uses: actions/cache@v3
id: deps-cache
with:
path: deps
key: ${{ runner.os }}-mix-${{ steps.elixir-version.outputs.stdout }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
key: ${{ runner.os }}-mix-${{ steps.elixir-version.outputs.stdout }}-${{ hashFiles('/mix.lock')) }}

- name: Install dependencies
run: mix deps.get

- uses: actions/cache@v1
- uses: actions/cache@v3
id: build-cache
with:
path: _build
key: ${{ runner.os }}-build-${{ steps.elixir-version.outputs.stdout }}-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }}
key: ${{ runner.os }}-build-${{ steps.elixir-version.outputs.stdout }}-${{ hashFiles('/mix.lock')) }}

- name: Compile base
run: mix compile

- name: Get Zig version
id: zig-version
run: mix eval "IO.puts(Zig.version())"

- uses: actions/cache@v3
id: zig-cache
with:
path: zig
key: ${{ runner.os }}-zig-${{ steps.zig-version.outputs.stdout }}

- name: Get Zig
run: mix zig.get

- name: Run Tests
env:
RUNNING_CI: "true"
RUNNING_CI: "TRUE"
CI_LOG_LEVEL: warning
run: mix test --exclude no_ci
56 changes: 56 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Elixir CI - Windows

on: push

jobs:
test:
runs-on: windows-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: '1.18.3' # adjust as needed
otp-version: '27.3' # adjust as needed

- uses: actions/cache@v3
id: deps-cache
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('/mix.lock') }}-${{ hashfiles('/installer/**/*') }}

- name: Install dependencies
run: mix deps.get

- uses: actions/cache@v3
id: build-cache
with:
path: _build
key: ${{ runner.os }}-build-${{ hashFiles('/mix.lock') }}

- name: Compile base
run: mix compile

- name: Get Zig version
id: zig-version
shell: bash
run: |
VERSION=$(mix eval "IO.puts(Zig.version())" | tail -n 1)
echo "zig_version=$VERSION" >> $GITHUB_OUTPUT

- uses: actions/cache@v3
id: zig-cache
with:
path: zig
key: ${{ runner.os }}-zig-${{ steps.zig-version.outputs.zig_version }}

- name: Get Zig
run: mix zig.get

- name: Run Tests
env:
RUNNING_CI: "TRUE"
run: mix test --exclude no_ci --exclude on_upgrade --exclude skip_windows --trace
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ Library test status:

- ![](https://github.com/ityonemo/zigler/workflows/Elixir%20CI%20-%20Linux/badge.svg)
- ![](https://github.com/ityonemo/zigler/workflows/Elixir%20CI%20-%20MacOS/badge.svg)
- ![](https://github.com/ityonemo/zigler/workflows/Elixir%20CI%20-%20Windows/badge.svg)
- ![](https://github.com/ityonemo/zigler/workflows/Elixir%20CI%20-%20FreeBSD/badge.svg)

## Installation: Elixir

### Obtaining Zig dependency

Run `mix zig.get`
Run `mix zig.get` after `mix deps.get`. This will provide a zig installation
in the directory pointed to by `:filename.basedir(:user_cache, "zigler")`.

You may also use a local installation of zig by specifying the environment variable
`ZIG_ARCHIVE_PATH`.

### Main Installation

Expand All @@ -30,7 +36,7 @@ end

TBD.

`~/.cache/zigler/zig-linux-<arch>-0.13.0`
`~/.cache/zigler/zig-linux-<arch>-0.14.0`

### Main Installation

Expand Down Expand Up @@ -100,7 +106,7 @@ defmodule ZigCollections do
}
return sum;
}
"""
""":nt}
end

test "type marshalling" do
Expand Down
19 changes: 15 additions & 4 deletions VERSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,24 @@ Thanks to Dave Cottlehuber @dch for testing.

## 0.13.0
- updated to zig 0.13.0
- Breaking changes:
- threadlocal `context` in function calls, optional passing `beam.env` into your functions
- makes `beam.get/make` functions `context`-aware, with all context-dependent things overridable.

## 0.14.0
- Breaking changes:
- deprecation of General Purpose Allocator in favor of DebugAllocator
- Windows support:
- Experimental windows support added.
- Error return traces not supported.
- on_upgrade hooks not supported pending module .so versioning changes.
- Features:
- adds ZIG_EXECUTABLE_PATH environment variable
- Outstanding issues:
- c_ulonglong doesn't work on windows; c_long doesn't work on other platforms.

## Upcoming
- `precompiled` mode that will let you obtain packages with precompiled assets.
- Breaking changes:
- threadlocal `context` in function calls, elimination of passing `beam.env` into your functions
- makes `beam.get/make` functions `context`-aware, with all context-dependent things overridable.

## Possible
- `beam.call` which lets you call back a beam function.
- `struct` which lets you declare a struct inside your zig code as the module's struct
1 change: 1 addition & 0 deletions guides/01-nifs.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ pub fn erroring() !void {
}
"""

@tag :erroring
test "erroring" do
assert_raise ErlangError, "Erlang error: :oops", fn -> erroring() end
end
Expand Down
Loading
Loading