Skip to content
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

update CI workflows, let's hope for the best #469

Merged
merged 3 commits into from
Sep 20, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@ jobs:
strategy:
fail-fast: false
matrix:
otp: [24.3, 25.2, 26.0]
elixir: [1.12.3, 1.13.4, 1.14.4]
otp: [24.3, 25.2, 26.1]
elixir: [1.13.4, 1.14.5, 1.15.6]
exclude:
- otp: 25.2
elixir: 1.12.3
- otp: 26.0
elixir: 1.12.3
- otp: 26.0
- otp: 26.1
elixir: 1.13.4
steps:
- uses: actions/checkout@v3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
- main

env:
ELIXIR_VERSION: 1.14.4
OTP_VERSION: 26.0
ELIXIR_VERSION: 1.15.6
OTP_VERSION: 26.1
MIX_ENV: test
WASMEX_BUILD: true

Expand Down
164 changes: 0 additions & 164 deletions .github/workflows/release.yaml

This file was deleted.

92 changes: 92 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Precompile NIFs

on:
push:
branches:
# Always run on main branch.
- main
tags:
# Tags will always run.
- '*'
pull_request:
paths:
- ".github/workflows/release.yml"
workflow_dispatch:

jobs:
build_release:
name: NIF ${{ matrix.nif }} - ${{ matrix.job.target }} (${{ matrix.job.os }})
runs-on: ${{ matrix.job.os }}
permissions:
contents: write
strategy:
fail-fast: false
matrix:
# we list the oldest OTP version that supports all features needed, have a look at the
# erlang docs for the OTP version to see which NIF version is in which OTP release
# https://github.com/erlang/otp/blob/master/erts/emulator/beam/erl_nif.h
# - "2.15" # OTP 22, OTP 23
# - "2.16" # OTP 24, OTP 25
# - "2.17" # OTP 26
nif: ["2.15"]
job:
# cranelift-codegen panics at 'error when identifying target: "no supported isa found for arch `arm`"'
# - { target: arm-unknown-linux-gnueabihf , os: ubuntu-20.04 , use-cross: true }
- { target: aarch64-unknown-linux-gnu, os: ubuntu-20.04, use-cross: true }
- { target: aarch64-unknown-linux-musl, os: ubuntu-20.04, use-cross: true }
- { target: aarch64-apple-darwin, os: macos-11 }
- { target: x86_64-apple-darwin, os: macos-11 }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04 }
- { target: x86_64-unknown-linux-musl, os: ubuntu-20.04, use-cross: true }
- { target: riscv64gc-unknown-linux-gnu, os: ubuntu-20.04, use-cross: true, cargo-args: "--no-default-features"}
- { target: x86_64-pc-windows-gnu, os: windows-2022 }
- { target: x86_64-pc-windows-msvc, os: windows-2022 }
- { target: x86_64-unknown-freebsd, os: ubuntu-22.04, use-cross: true, cross-version: v0.2.5 }

steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Extract crate information
shell: bash
run: |
# Get the project version from mix.exs
echo "PROJECT_VERSION=$(sed -n 's/^ @version "\(.*\)"/\1/p' mix.exs | head -n1)" >> $GITHUB_ENV

- name: Add target
shell: bash
run: |
rustup target add ${{ matrix.job.target }}

- uses: Swatinem/rust-cache@v2
with:
prefix-key: v0-precomp
shared-key: ${{ matrix.job.target }}-${{ matrix.nif }}
workspaces: |
native/wasmex

- name: Build the project
id: build-crate
uses: philss/rustler-precompiled-action@52c1b8dd1ed8c7fcd90ca71b177aabbd3b29b95b
with:
project-name: wasmex
project-version: ${{ env.PROJECT_VERSION }}
target: ${{ matrix.job.target }}
nif-version: ${{ matrix.nif }}
use-cross: ${{ matrix.job.use-cross }}
cross-version: ${{ matrix.job.cross-version || 'v0.2.4' }}
project-dir: "native/wasmex"
cargo-args: ${{ matrix.job.cargo-args }}

- name: Artifact upload
uses: actions/upload-artifact@v3
with:
name: ${{ steps.build-crate.outputs.file-name }}
path: ${{ steps.build-crate.outputs.file-path }}

- name: Publish archives and packages
uses: softprops/action-gh-release@v1
with:
files: |
${{ steps.build-crate.outputs.file-path }}
if: startsWith(github.ref, 'refs/tags/')
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: Rust CI

on:
pull_request:
paths:
- "native/wasmex/**"
push:
branches:
- main
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
erlang 25.3.2
elixir 1.14.5
erlang 26.1
elixir 1.15.6
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ Types of changes

put your changes here

### Changes
### Added

* official support for Elixir 1.15 (though it did work before, but now we test on CI)

### Removed

* official support for Elixir 1.12

### Changed

* Dependency updates (most notably wasmtime and rustler)

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<a href="https://github.com/tessi/wasmex/blob/master/LICENSE">
<img src="https://img.shields.io/github/license/tessi/wasmex.svg" alt="License">
</a>
<a href="https://github.com/tessi/wasmex/actions/workflows/elixir-ci.yaml">
<img src="https://github.com/tessi/wasmex/actions/workflows/elixir-ci.yaml/badge.svg?branch=main" alt="CI">
<a href="https://github.com/tessi/wasmex/actions/workflows/elixir-ci.yml">
<img src="https://github.com/tessi/wasmex/actions/workflows/elixir-ci.yml/badge.svg?branch=main" alt="CI">
</a>
</p>

Expand Down
2 changes: 1 addition & 1 deletion native/wasmex/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ path = "src/lib.rs"
crate-type = ["dylib"]

[dependencies]
rustler = "0.29.1"
rustler = { version = "0.29", default-features = false, features = ["derive", "nif_version_2_15"] }
once_cell = "1.18.0"
rand = "0.8.5"
wasmtime = "12.0.2"
Expand Down
4 changes: 0 additions & 4 deletions native/wasmex/Cross.toml

This file was deleted.