From ef735eb94228423e367f36900225c57c6eb8d9b9 Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Tue, 15 Jan 2019 19:18:33 -0800 Subject: [PATCH] Upload binary artifacts from CI builds --- .appveyor.yml | 21 +++++++++++++++++++++ .travis.yml | 21 +++++++++++++++++++++ cli/src/util.rs | 3 ++- lib/build.rs | 14 +++++++++++--- 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 29193a53..0c9de3ac 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -10,6 +10,10 @@ install: # Install dependencies - git submodule update --init +platform: + - x64 + - x86 + test_script: # Fetch and regenerate the fixture parsers - script\fetch-fixtures.cmd @@ -23,6 +27,23 @@ test_script: branches: only: - master + - /\d+\.\d+\.\d+.*/ + +before_deploy: + - move target\release\tree-sitter.exe tree-sitter.exe + - 7z a tree-sitter-windows-%PLATFORM%.zip tree-sitter.exe + - appveyor PushArtifact tree-sitter-windows-%PLATFORM%.zip + +deploy: + description: '' + provider: GitHub + auth_token: + secure: VC9ntV5+inKoNteZyLQksKzWMKXF46P+Jx3JHKVSfF+o1rWtZn2iIHAVsQv5LaUi + artifact: /tree-sitter-windows-.*.zip/ + draft: true + force_update: true + on: + APPVEYOR_REPO_TAG: true cache: - target diff --git a/.travis.yml b/.travis.yml index 5f981ce9..55fc9276 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,10 @@ language: rust rust: - stable +os: + - linux + - osx + script: # Fetch and regenerate the fixture parsers - script/fetch-fixtures @@ -15,6 +19,23 @@ script: branches: only: - master + - /\d+\.\d+\.\d+/ + +before_deploy: + - mv target/release/tree-sitter . + - tar czf tree-sitter-${TRAVIS_OS_NAME}-x64.tar.gz tree-sitter + +deploy: + provider: releases + api_key: + secure: "cAd2mQP+Q55v3zedo5ZyOVc3hq3XKMW93lp5LuXV6CYKYbIhkyfym4qfs+C9GJQiIP27cnePYM7B3+OMIFwSPIgXHWWSsuloMtDgYSc/PAwb2dZnJqAyog3BohW/QiGTSnvbVlxPF6P9RMQU6+JP0HJzEJy6QBTa4Und/j0jm24=" + file_glob: true + file: "tree-sitter-*.tar.gz" + draft: true + overwrite: true + skip_cleanup: true + on: + tags: true cache: cargo: true diff --git a/cli/src/util.rs b/cli/src/util.rs index 5c1bc39c..166e54d0 100644 --- a/cli/src/util.rs +++ b/cli/src/util.rs @@ -4,6 +4,7 @@ use std::path::PathBuf; use std::process::{Child, ChildStdin, Command, Stdio}; use tree_sitter::Parser; +#[cfg(unix)] const HTML_HEADER: &[u8] = b"\n\n\n"; #[cfg(windows)] @@ -13,7 +14,7 @@ pub(crate) struct LogSession(); pub(crate) struct LogSession(PathBuf, Option, Option); #[cfg(windows)] -pub(crate) fn log_graphs(parser: &mut Parser, path: &str) -> std::io::Result { +pub(crate) fn log_graphs(_parser: &mut Parser, _path: &str) -> std::io::Result { Ok(LogSession()) } diff --git a/lib/build.rs b/lib/build.rs index eb6fea8b..2a121001 100644 --- a/lib/build.rs +++ b/lib/build.rs @@ -6,9 +6,17 @@ use std::path::{Path, PathBuf}; fn main() { println!("cargo:rerun-if-env-changed=TREE_SITTER_STATIC_ANALYSIS"); if env::var("TREE_SITTER_STATIC_ANALYSIS").is_ok() { - let clang_path = which("clang").unwrap(); - let clang_path = clang_path.to_str().unwrap(); - env::set_var("CC", &format!("scan-build -analyze-headers --use-analyzer={} cc", clang_path)); + if let (Some(clang_path), Some(scan_build_path)) = (which("clang"), which("scan-build")) { + let clang_path = clang_path.to_str().unwrap(); + let scan_build_path = scan_build_path.to_str().unwrap(); + env::set_var( + "CC", + &format!( + "{} -analyze-headers --use-analyzer={} cc", + scan_build_path, clang_path + ), + ); + } } let mut config = cc::Build::new();