fix lock #1260
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build precompiled NIFs | |
on: | |
push: | |
branches: | |
- main | |
- release* | |
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 | |
with: | |
repository: beaver-lodge/kinda | |
path: kinda | |
- run: mv kinda .. | |
- 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: mlugg/setup-zig@v1 | |
with: | |
version: 0.13.0 | |
- uses: Jimver/cuda-toolkit@master | |
id: cuda-toolkit | |
with: | |
use-github-cache: false | |
log-file-suffix: '${{matrix.job.os}}-${{ matrix.job.otp }}-(${{ matrix.job.elixir }}).txt' | |
sub-packages: '["nvcc"]' | |
method: network | |
- 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 run bench/enif_add_benchmark.exs | |
arm_docker: | |
needs: [generate_id] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
image: | |
- { | |
platform: "linux/arm64/v8", | |
suffix: "arm64", | |
zig: "https://ziglang.org/download/0.13.0/zig-linux-aarch64-0.13.0.tar.xz" | |
} | |
- { | |
platform: "linux/amd64", | |
suffix: "amd64", | |
zig: "https://ziglang.org/download/0.13.0/zig-linux-x86_64-0.13.0.tar.xz" | |
} | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
if: ${{ matrix.image.platform != 'linux/amd64' }} | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
push: ${{ secrets.DOCKERHUB_USERNAME != '' }} | |
tags: jackalcooper/beaver-livebook-${{ matrix.image.suffix }}:latest | |
cache-from: type=registry,ref=jackalcooper/beaver-livebook-${{ matrix.image.suffix }}:latest | |
cache-to: type=inline | |
platforms: | | |
${{ matrix.image.platform }} | |
file: docker/livebook.dockerfile | |
target: base | |
build-args: | | |
ZIG_URL=${{ matrix.image.zig }} | |
- uses: actions/checkout@v3 | |
name: Check-out beaver | |
with: | |
repository: beaver-lodge/beaver | |
path: beaver | |
- uses: actions/checkout@v3 | |
name: Check-out kinda | |
with: | |
repository: beaver-lodge/kinda | |
path: kinda | |
- name: Build ARM | |
continue-on-error: true | |
if: ${{ matrix.image.platform == 'linux/arm64/v8' }} | |
run: docker run --platform ${{ matrix.image.platform }} -v $PWD:/src -w /src/beaver jackalcooper/beaver-livebook-${{ matrix.image.suffix }}:latest bash scripts/build-for-publish.sh | |
- name: Build x86 | |
if: ${{ matrix.image.platform == 'linux/amd64' }} | |
run: docker run -v $PWD:/src -w /src/beaver jackalcooper/beaver-livebook-${{ matrix.image.suffix }}:latest bash scripts/build-for-publish.sh |