Skip to content

Replace refAllDeclsRecursive with direct import for Zig 0.16.0 #31

Replace refAllDeclsRecursive with direct import for Zig 0.16.0

Replace refAllDeclsRecursive with direct import for Zig 0.16.0 #31

Workflow file for this run

name: Release
on:
push:
tags:
- "v*"
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
ci:
name: CI (${{ matrix.target }})
runs-on: ${{ matrix.runner }}
defaults:
run:
shell: bash
strategy:
fail-fast: true
matrix:
include:
- target: x86_64-linux
runner: ubuntu-latest
- target: aarch64-linux
runner: ubuntu-24.04-arm
- target: aarch64-macos
runner: macos-15
- target: x86_64-windows
runner: windows-latest
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v2
with:
version: 0.16.0
- name: Build Zig library
run: zig build -Doptimize=ReleaseFast
- name: Run Zig tests
run: zig build test
- name: Set up Erlang/Elixir
uses: erlef/setup-beam@v1
with:
otp-version: "27"
elixir-version: "1.17"
- name: Install Elixir deps
run: |
mix local.hex --force
mix local.rebar --force
mix deps.get
- name: Fix Zigler Windows NIF headers
if: runner.os == 'Windows'
run: |
mkdir -p deps/zigler/priv/erl_nif_win
curl -sL "https://raw.githubusercontent.com/bcardarella/zigler/main/priv/erl_nif_win/erl_nif_win.h" \
-o deps/zigler/priv/erl_nif_win/erl_nif_win.h
curl -sL "https://raw.githubusercontent.com/bcardarella/zigler/main/priv/erl_nif_win/erl_nif_api_funcs_win.h" \
-o deps/zigler/priv/erl_nif_win/erl_nif_api_funcs_win.h
- name: Run Elixir tests
env:
TAILWIND_COMPILER_PATH: "true"
run: mix test
build_nif:
name: Build NIF (${{ matrix.target }})
needs: ci
runs-on: ${{ matrix.runner }}
defaults:
run:
shell: bash
strategy:
fail-fast: true
matrix:
include:
- target: x86_64-linux
runner: ubuntu-latest
nif_ext: so
- target: aarch64-linux
runner: ubuntu-24.04-arm
nif_ext: so
- target: aarch64-macos
runner: macos-15
nif_ext: so
- target: x86_64-windows
runner: windows-latest
nif_ext: dll
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v2
with:
version: 0.16.0
- name: Set up Erlang/Elixir
uses: erlef/setup-beam@v1
with:
otp-version: "27"
elixir-version: "1.17"
- name: Install Elixir deps
run: |
mix local.hex --force
mix local.rebar --force
mix deps.get
- name: Fix Zigler Windows NIF headers
if: runner.os == 'Windows'
run: |
mkdir -p deps/zigler/priv/erl_nif_win
curl -sL "https://raw.githubusercontent.com/bcardarella/zigler/main/priv/erl_nif_win/erl_nif_win.h" \
-o deps/zigler/priv/erl_nif_win/erl_nif_win.h
curl -sL "https://raw.githubusercontent.com/bcardarella/zigler/main/priv/erl_nif_win/erl_nif_api_funcs_win.h" \
-o deps/zigler/priv/erl_nif_win/erl_nif_api_funcs_win.h
- name: Build NIF
env:
TAILWIND_COMPILER_PATH: "true"
run: mix compile
- name: Package NIF
run: |
NIF_FILE=$(find _build -name "Elixir.TailwindCompiler.NIF.${{ matrix.nif_ext }}" -type f | head -1)
if [ -z "$NIF_FILE" ]; then
echo "ERROR: Could not find compiled NIF file"
find _build -name "*NIF*" -type f
exit 1
fi
echo "Found NIF at: $NIF_FILE"
mkdir -p release
cp "$NIF_FILE" "release/Elixir.TailwindCompiler.NIF.${{ matrix.nif_ext }}"
cd release
tar czf "tailwind_compiler-nif-${{ matrix.target }}.tar.gz" "Elixir.TailwindCompiler.NIF.${{ matrix.nif_ext }}"
openssl dgst -sha256 "tailwind_compiler-nif-${{ matrix.target }}.tar.gz" | sed 's/.*= //' | tee "tailwind_compiler-nif-${{ matrix.target }}.tar.gz.sha256"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nif-${{ matrix.target }}
path: release/tailwind_compiler-nif-*
build_wasm:
name: Build WASM
needs: ci
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v2
with:
version: 0.16.0
- name: Build WASM
run: zig build -Doptimize=ReleaseSmall -Dtarget=wasm32-freestanding
- name: Package WASM
run: |
mkdir -p release
cp zig-out/bin/tailwind_compiler.wasm release/tailwind_compiler.wasm
cd release
tar czf tailwind_compiler-wasm.tar.gz tailwind_compiler.wasm
openssl dgst -sha256 tailwind_compiler-wasm.tar.gz | sed 's/.*= //' | tee tailwind_compiler-wasm.tar.gz.sha256
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: wasm
path: release/tailwind_compiler-wasm*
release:
name: Create Release
needs: [build_nif, build_wasm]
runs-on: ubuntu-latest
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
generate_release_notes: true