diff --git a/.package b/.package index e219208..32d0ea3 100755 --- a/.package +++ b/.package @@ -1,5 +1,7 @@ #!/usr/bin/env bash +### Args + tag=$1 target=$2 @@ -14,27 +16,53 @@ if [[ -z "$target" ]]; then fi -cargo build --target $target --release +### Vars + +ext="" +windows="" +if [[ "$target" == *"windows"* ]]; then + choco install 7zip + ext=".exe" + windows="1" +fi project="cargo-watch" build_dir=$(mktemp -d 2>/dev/null || mktemp -d -t tmp) out_dir=$(pwd) name="$project-$tag-$target" -mkdir "$build_dir/$name" -cp target/$target/release/$project "$build_dir/$name/" +### Build + +cargo build --target $target --release + +### Decorate + +mkdir "$build_dir/$name" +cp "target/$target/release/$project$ext" "$build_dir/$name/" cp LICENSE "$build_dir/$name/" +ls -shal "$build_dir/$name/" + +### Strip -pushd $build_dir -strip "$name/$project" -tar cvf "$out_dir/$name.tar" "$name" -popd -xz -f9 "$name.tar" +cd "$build_dir" +strip "$name/$project$ext" +ls -shal "$name/" + +### Pack + +if [[ -z "$windows" ]]; then + tar cvf "$out_dir/$name.tar" "$name" + cd "$out_dir" + xz -f9 "$name.tar" +else + 7z a "$out_dir/$name.zip" "$name" +fi +### Debify if [[ "$target" == "x86_64-unknown-linux-gnu" ]]; then mkdir -p "$build_dir/deb/$name" - pushd "$build_dir/deb/$name" + cd "$build_dir/deb/$name" mkdir -p DEBIAN usr/bin cp "../../$name/$project" usr/bin/ @@ -51,6 +79,6 @@ CONTROL cd .. fakeroot dpkg -b "$name" mv "$name.deb" "$out_dir/" - popd fi +ls -shal "$out_dir/" diff --git a/.travis.yml b/.travis.yml index 5547a90..2fbf602 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,10 @@ env: matrix: include: - # Default test+release version + # Default test+release versions + - os: windows + rust: stable + env: TARGET=x86_64-pc-windows-msvc - os: osx rust: stable env: TARGET=x86_64-apple-darwin @@ -22,15 +25,21 @@ matrix: rust: stable env: TARGET=x86_64-unknown-linux-gnu - # Extra targets for linux only - - os: linux + # Extra targets, also released + - os: windows rust: stable - env: TARGET=i686-unknown-linux-musl + env: TARGET=x86_64-pc-windows-gnu - os: linux rust: stable env: TARGET=x86_64-unknown-linux-musl + - os: linux + rust: stable + env: TARGET=i686-unknown-linux-musl # Non-critical but interesting for upcoming Rust changes + - os: windows + rust: nightly + env: TARGET=x86_64-pc-windows-msvc - os: linux rust: nightly env: TARGET=x86_64-unknown-linux-gnu diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 9885a83..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,41 +0,0 @@ -environment: - global: - PROJECT_NAME: cargo-watch - matrix: - - TARGET: x86_64-pc-windows-gnu - CHANNEL: stable - -# Not MSBuild -build: false - -# Install Rust and Cargo -# (Based on from https://github.com/rust-lang/libc/blob/master/appveyor.yml) -install: - - curl -sSf -o rustup-init.exe https://win.rustup.rs/ - - rustup-init.exe --default-host %TARGET% --default-toolchain %CHANNEL% -y - - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - if defined MSYS2_BITS set PATH=%PATH%;C:\msys64\mingw%MSYS2_BITS%\bin - - rustc -V - - cargo -V - -test_script: - - cargo test --verbose - -before_deploy: - # Generate artifacts for release - - cargo build --release - - mkdir pack - - copy target\release\cargo-watch.exe pack - - copy LICENSE pack\LICENSE.txt - - cd pack - - 7z a ../%PROJECT_NAME%-%APPVEYOR_REPO_TAG_NAME%-%TARGET%.zip * - - appveyor PushArtifact ../%PROJECT_NAME%-%APPVEYOR_REPO_TAG_NAME%-%TARGET%.zip - -deploy: - description: 'Automatically deployed release' - artifact: /.*\.zip/ - provider: GitHub - auth_token: - secure: OkayPFKJ16PAH15rWQBdEQDgd3tlNP/ZcssaunpK9AHU+t9zZlO5qvUAok1JT3lR - on: - appveyor_repo_tag: true