Skip to content

Commit e23c819

Browse files
committed
Add Travis/AppVeyor deployments
1 parent ddf27f0 commit e23c819

File tree

5 files changed

+79
-9
lines changed

5 files changed

+79
-9
lines changed

.appveyor.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
environment:
2+
global:
3+
RUSTFLAGS: -Zunstable-options -Ctarget-feature=+crt-static
4+
matrix:
5+
- TARGET: x86_64-pc-windows-msvc
6+
DEPLOY: 1
7+
18
install:
29
- ps: Install-Product node 9
310
- appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
4-
- if not defined RUSTFLAGS rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly
11+
- rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly
512
- set PATH=%PATH%;C:\Users\appveyor\.cargo\bin
613
- rustc -V
714
- cargo -V
@@ -12,4 +19,27 @@ test_script:
1219
- rustup target add wasm32-unknown-unknown
1320
- yarn
1421
- cargo test
15-
- cargo install --debug --path crates/wasm-bindgen-cli
22+
- cargo build --release -p wasm-bindgen-cli
23+
24+
before_deploy:
25+
- ps: |
26+
$NAME = "wasm-bindgen-${env:APPVEYOR_REPO_TAG_NAME}-${env:TARGET}"
27+
New-Item -Path $NAME -ItemType directory
28+
Copy-Item target/release/wasm-bindgen.exe "${NAME}/"
29+
Copy-Item target/release/wasm2es6js.exe "${NAME}/"
30+
Copy-Item LICENSE-MIT "${NAME}/"
31+
Copy-Item LICENSE-APACHE "${NAME}/"
32+
Copy-Item README.md "${NAME}/"
33+
7z a -ttar "${NAME}.tar" "${NAME}"
34+
7z a "${NAME}.tar.gz" "${NAME}.tar"
35+
Push-AppveyorArtifact "${NAME}.tar.gz"
36+
37+
deploy:
38+
artifact: /.*\.tar.gz/
39+
auth_token:
40+
secure: dtHSvbZkdAFtL0J5YrSw8DpxjfYuHWgqD1SupmJT/yfYSjEBiX55RFXRoqBM2tx1
41+
description: ''
42+
on:
43+
appveyor_repo_tag: true
44+
provider: GitHub
45+

.travis.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,25 @@ sudo: false
33

44
matrix:
55
include:
6+
# CLI builds on stable
7+
- rust: stable
8+
install: true
9+
script: cargo build -p wasm-bindgen-cli
10+
11+
# Tests pass on nightly
612
- rust: nightly
713

14+
# Dist linux binary
15+
- env: TARGET=x86_64-unknown-linux-musl DEPLOY=1
16+
before_script: rustup target add $TARGET
17+
script: cargo build -p wasm-bindgen-cli --release --target $TARGET
18+
19+
# Dist OSX binary
20+
- os: osx
21+
env: MACOSX_DEPLOYMENT_TARGET=10.7 DEPLOY=1 TARGET=x86_64-apple-darwin
22+
script: cargo build -p wasm-bindgen-cli --release --target $TARGET
23+
before_install: brew install yarn --without-node
24+
825
install:
926
- curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
1027
- source ~/.nvm/nvm.sh
@@ -26,3 +43,21 @@ notifications:
2643
email:
2744
on_success: never
2845

46+
before_deploy:
47+
- name="wasm-bindgen-$TRAVIS_TAG-$TARGET"
48+
- mkdir $name
49+
- cp target/$TARGET/release/{wasm-bindgen,wasm2es6js} $name/
50+
- cp README.md LICENSE-MIT LICENSE-APACHE $name/
51+
- tar czvf $name.tar.gz $name
52+
53+
deploy:
54+
api_key:
55+
secure: "qCiELnEnvyKpWHDttgTNf+ElZGbWlvthu5aOIj5nYfov+h6g1+mkWnDFP6at/WPlE78zE/f/z/dL2KB2I7w/cxH/T4P1nWh0A9DvrpY6hqWkK2pgN5dPeWE/a4flI7AdH0A6wMRw7m00uMgDjlzN78v7XueccpJCxSO5allQN5jweAQvMX2QA07TbLRJc7Lq6lfVwSf8OfrcO8qCbcIzJTsC4vtbh6jkUYg1OAaU2tAYlskBy9ZYmHWCExIAu/zxzcJY9OpApPD9Ea4CyrsfjniAyRBJ87Weh/sP4XhiWeRPVmvA4HAzv4Pps9ps+Ar5QmsX53rhKQ3id7/VPR8ggaAHxrYUiJPvJRtbP6cKKOlDiK0ooP+vI4vjxWeNVj9ibEolSYOlT0ENIvPK1BppA6VgAoJOjwPr0Q16Ma4AmvLkIkowJiXCm2Jlje/5c0vPEAGJVgUtkj3jFQzgXwyEMpzxUlhHmYpmnfeaM0tK/Kiiwe1monL/ydMlyfV55kNylylCg+XoTnf420AFChKbD4DM5Z7ZsjU9g8fF3LUoN0sKpmLDp+GvwjLi9YtGogWB71Q2MFp43MSL0YLshkyYYoZKrVMiy5J9hKNUxhT2jNEq53Z69syIHHMCxHL9GoAcuHxIKOA7uTMW0aCoyy2I+dfAKKsrUGwGYaNC5LZdUQI="
56+
file_glob: true
57+
file:
58+
- wasm-bindgen-$TRAVIS_TAG-$TARGET.tar.gz
59+
on:
60+
condition: $DEPLOY = 1
61+
tags: true
62+
provider: releases
63+
skip_cleanup: true

crates/wasm-bindgen-cli-support/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ authors = ["Alex Crichton <[email protected]>"]
55

66
[dependencies]
77
base64 = "0.9"
8-
failure = "0.1"
98
parity-wasm = "0.27"
109
serde_json = "1.0"
1110
wasm-bindgen-shared = { path = "../wasm-bindgen-shared" }

crates/wasm-bindgen-cli-support/src/lib.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#[macro_use]
2-
extern crate failure;
31
extern crate parity_wasm;
42
extern crate wasm_bindgen_shared as shared;
53
extern crate serde_json;
@@ -11,7 +9,6 @@ use std::io::Write;
119
use std::path::{Path, PathBuf};
1210
use std::slice;
1311

14-
use failure::Error;
1512
use parity_wasm::elements::*;
1613

1714
mod js;
@@ -24,6 +21,15 @@ pub struct Bindgen {
2421
typescript: bool,
2522
}
2623

24+
#[derive(Debug)]
25+
pub struct Error(String);
26+
27+
impl<E: std::error::Error> From<E> for Error {
28+
fn from(e: E) -> Error {
29+
Error(e.to_string())
30+
}
31+
}
32+
2733
impl Bindgen {
2834
pub fn new() -> Bindgen {
2935
Bindgen {
@@ -65,7 +71,7 @@ impl Bindgen {
6571
};
6672
let stem = input.file_stem().unwrap().to_str().unwrap();
6773
let mut module = parity_wasm::deserialize_file(input).map_err(|e| {
68-
format_err!("{:?}", e)
74+
Error(format!("{:?}", e))
6975
})?;
7076
let programs = extract_programs(&mut module);
7177

@@ -107,7 +113,7 @@ impl Bindgen {
107113

108114
let wasm_path = out_dir.join(format!("{}_bg", stem)).with_extension("wasm");
109115
let wasm_bytes = parity_wasm::serialize(module).map_err(|e| {
110-
format_err!("{:?}", e)
116+
Error(format!("{:?}", e))
111117
})?;
112118
let bytes = wasm_gc::Config::new()
113119
.demangle(false)

crates/wasm-bindgen-cli-support/src/wasm2es6js.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl Config {
3030
pub fn generate(&mut self, wasm: &[u8]) -> Result<Output, Error> {
3131
assert!(self.base64);
3232
let module = deserialize_buffer(wasm).map_err(|e| {
33-
format_err!("{:?}", e)
33+
::Error(format!("{:?}", e))
3434
})?;
3535
Ok(Output {
3636
module,

0 commit comments

Comments
 (0)