Skip to content

Upgrade MLIR with Ptr dialect (#322) #1014

Upgrade MLIR with Ptr dialect (#322)

Upgrade MLIR with Ptr dialect (#322) #1014

Workflow file for this run

name: Build precompiled NIFs
on:
push:
branches:
- main
tags:
- "*"
pull_request:
branches: ["main"]
paths-ignore:
- "*.md"
- "**/*.md"
- "LICENSE*"
concurrency:
group: precompiled-${{ github.ref }}
cancel-in-progress: true
env:
PRE_BUILT_RELEASE_GITHUB_TOKEN: ${{ secrets.PRE_BUILT_RELEASE_GITHUB_TOKEN }}
jobs:
generate_id:
name: Generate ID of release
runs-on: ubuntu-latest
outputs:
formatted_date: ${{ steps.date.outputs.formatted_date }}
steps:
- name: Get current date
id: date
run: echo "formatted_date=$(date +'%Y-%m-%d-%H%M')" >> $GITHUB_OUTPUT
build_release:
needs: [generate_id]
name: NIF ${{ matrix.job.otp }} (${{ matrix.job.elixir }})
runs-on: ${{ matrix.job.os }}
strategy:
fail-fast: false
matrix:
job:
- { otp: 24.2, os: ubuntu-22.04, elixir: 1.14 }
- { otp: 26, os: ubuntu-22.04, elixir: 1.15 }
steps:
- uses: actions/checkout@v3
name: Check-out beaver
- uses: actions/checkout@v3
name: Check-out Kinda
if: contains(github.event.pull_request.labels.*.name, 'checkout_kinda')
with:
repository: beaver-lodge/kinda
path: kinda_local
ref: remove-meta
- run: echo "BEAVER_KINDA_PATH=${PWD}/kinda_local" >> $GITHUB_ENV
if: contains(github.event.pull_request.labels.*.name, 'checkout_kinda')
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: ${{ matrix.job.elixir }} # Define the elixir version [required]
otp-version: ${{ matrix.job.otp }} # Define the OTP version [required]
- run: elixir --eval ":erlang.system_info(:nif_version) |> IO.puts"
- name: Set up Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.13.0
- uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Restore dependencies cache
uses: actions/cache@v3
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Install dependencies
run: mix deps.get
- name: Strip dev suffix
run: sed -i 's/-dev//g' mix.exs
- uses: seanmiddleditch/gha-setup-ninja@master
- name: Install pre-build LLVM
run: |
python3 -m pip install -r dev-requirements.txt
echo "LLVM_CONFIG_PATH=$(python3 -c 'import mlir;print(mlir.__path__[0])')/bin/llvm-config" >> "$GITHUB_ENV"
- name: Production build
env:
MIX_ENV: prod
ELIXIR_MAKE_CACHE_DIR: .
run: |
mix elixir_make.precompile
- name: Purge artifacts
run: |
python3 -m pip uninstall -y mlir
mix clean
- name: Start mock server in the background
run: |
python3 -m http.server --directory . &> /dev/null &
sleep 3
ps aux
- run: curl http://127.0.0.1:8000/
- name: Run tests with prebuilt
env:
BEAVER_ARTEFACT_URL: http://127.0.0.1:8000/@{artefact_filename}
run: |
MIX_ENV=prod mix elixir_make.checksum --all --ignore-unavailable --only-local --print
mix clean
mix test --exclude vulkan --exclude todo
- name: Publish archives and packages
uses: softprops/action-gh-release@v1
if: ${{ github.repository == 'beaver-lodge/beaver' && env.PRE_BUILT_RELEASE_GITHUB_TOKEN != null }}
with:
files: |
*.tar.gz
repository: beaver-lodge/beaver-prebuilt
token: ${{ secrets.PRE_BUILT_RELEASE_GITHUB_TOKEN }}
tag_name: ${{ needs.generate_id.outputs.formatted_date }}
- name: Test dev compile
if: ${{ github.repository == 'beaver-lodge/beaver' && env.PRE_BUILT_RELEASE_GITHUB_TOKEN != null }}
env:
BEAVER_ARTEFACT_URL: "https://github.com/beaver-lodge/beaver-prebuilt/releases/download/${{ needs.generate_id.outputs.formatted_date }}/@{artefact_filename}"
run: |
mix compile