From 2696283e35f4bd5c19553012a39fc3561bf05298 Mon Sep 17 00:00:00 2001
From: Philipp Tessenow
Date: Wed, 15 Jan 2020 12:45:34 +0100
Subject: [PATCH] experiment with the circle config
---
.circleci/config.yml | 43 +++++++++++++++++++++++++++++--------
.gitignore | 1 -
README.md | 1 +
mix.exs | 4 ++--
test/wasm_source/Cargo.lock | 5 +++++
test/wasm_source/Cargo.toml | 10 +++++++++
6 files changed, 52 insertions(+), 12 deletions(-)
create mode 100644 test/wasm_source/Cargo.lock
create mode 100644 test/wasm_source/Cargo.toml
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 8ad63ab0..a7998ec9 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -2,23 +2,48 @@
version: 2
jobs:
build:
+ parallelism: 1
docker:
- # specify the version here
- image: circleci/elixir:1.9.1
+ environment:
+ MIX_ENV: test
working_directory: ~/repo
steps:
- checkout
+
+ - restore_cache:
+ keys:
+ - v1-dependency-cache-{{ checksum "mix.lock" }}
+ - v1-dependency-cache
+
+ - run: mix local.hex --force # install Hex locally (without prompt)
+ - run: mix local.rebar --force # fetch a copy of rebar (without prompt)
- run:
- name: "Install Rust and WASM toolchain"
+ name: "Install Rust"
command: |
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
+ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y
+ source $HOME/.cargo/env
rustup component add rustfmt
rustup target add wasm32-unknown-unknown # to compile our example WASM files for testing
- - run: mix deps.get
- - run: mix test
- - run: mix format --check-formatted
- - run: cargo fmt --manifest-path native/wasmex/Cargo.toml -- --check
- - run: mix dialyzer
- - run: mix docs
+ - run:
+ name: "Run Checks (Tests, Formatters, ..)"
+ command: |
+ source $HOME/.cargo/env
+ mix deps.get
+ mix test
+ mix format --check-formatted
+ cargo fmt --manifest-path native/wasmex/Cargo.toml -- --check
+ mix dialyzer
+ mix docs
+
+ - save_cache:
+ key: v1-dependency-cache-{{ checksum "mix.lock" }}
+ paths:
+ - _build
+ - deps
+ - ~/.mix
+
+ - store_test_results:
+ path: _build/test/lib/wasmex
diff --git a/.gitignore b/.gitignore
index 3f18ac48..765e6f2c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,5 +23,4 @@ erl_crash.dump
wasmex-*.tar
# Cargo things in the Rust part of this package
-Cargo.*
priv/native/libwasmex.so
diff --git a/README.md b/README.md
index 044b9fd2..89dd08b9 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,7 @@
+ [![CircleCI](https://circleci.com/gh/tessi/wasmex.svg?style=svg)](https://circleci.com/gh/tessi/wasmex)
Wasmex is an Elixir library for executing WebAssembly binaries:
diff --git a/mix.exs b/mix.exs
index 26473db1..476646a3 100644
--- a/mix.exs
+++ b/mix.exs
@@ -31,8 +31,8 @@ defmodule Wasmex.MixProject do
defp deps do
[
{:rustler, "~> 0.21.0"},
- {:ex_doc, "~> 0.21.2", only: :dev},
- {:dialyxir, "~> 1.0.0-rc.7", only: [:dev], runtime: false}
+ {:ex_doc, "~> 0.21.2", only: [:dev, :test]},
+ {:dialyxir, "~> 1.0.0-rc.7", only: [:dev, :test], runtime: false}
]
end
diff --git a/test/wasm_source/Cargo.lock b/test/wasm_source/Cargo.lock
new file mode 100644
index 00000000..417f9c93
--- /dev/null
+++ b/test/wasm_source/Cargo.lock
@@ -0,0 +1,5 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
+[[package]]
+name = "wasmex_test"
+version = "0.1.0"
diff --git a/test/wasm_source/Cargo.toml b/test/wasm_source/Cargo.toml
new file mode 100644
index 00000000..df2b3614
--- /dev/null
+++ b/test/wasm_source/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "wasmex_test"
+version = "0.1.0"
+authors = ["Philipp Tessenow "]
+edition = "2018"
+
+[dependencies]
+
+[lib]
+crate-type =["cdylib"]