diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7495fd9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -dist: trusty -language: rust -services: docker -env: - global: - - CRATE_NAME=kickstart - - secure: qPDFXwphU9qJ3zZbWhbk1AbBPCFkbl8ZphceJ8JAJQmHbwC6nF4NBpdEKyY3O+0C4zmOa24tFZYC2exN9SyEtrsqRwR/KWRqSkEt1lZ0c7k/Vq7PihR2/q9maH8qfJ1kLNvE5D3bM1m2hvrqMPv2pVZlK4iZFCsEulO4Bv9v1yDt8CEU8ijRqBk5/HlKQKTA5wJKQmyr6t5/hr4WGnTx8B27Cf28WXqia0MNTcTOEtcr6URuuNMN6Nh+Ifz80+inSWGEzQ/HXR7W1MDllAhtd5hormWlgPSllAUfkHqQ3AjFdw01ahgHivqUdPiB9WAIOu1qRusfX91OBn1tcCtYPp9CQI6okKq8T/BAOKuKHWrbAbNPZlqRp6fEDisStAZK+55I6lanN0OYDvKdY07/txhF2BnvqvIzbxzpiJmTMcNzd6rUeY2O6qxATXr2eI900o8uGNxFcL0qri/gt6Vj+Hp2fbOObXD2B9yhP1ZSTEsctuMMU0NfdYz8p/JL25ZihC/6jECx/HLvh+Z2IprSvUJk/DL39dEQHrI9Ghu5EBuYLIjCf/jOl8610ha7B6pWoc3TRRu/D1KDEOABkj06kNeCqfb4DMKYyIprFzL72r4aWsApgYAvHZQrDgGR7kFetHknU7QIWyRQCsbwPk19tL85SN8VhgFP4WZ0H05CVHY= -matrix: - include: - - env: TARGET=x86_64-unknown-linux-gnu - - env: TARGET=x86_64-apple-darwin - os: osx -before_install: set -e -install: -- sh ci/install.sh -- source ~/.cargo/env || true -script: -- bash ci/script.sh -after_script: set +e -before_deploy: -- sh ci/before_deploy.sh -deploy: - api_key: - secure: "j1q8qWi9KgFOgalsJOeHKq0fKuDTzc9uldWe3Ld12gDXnqrUwJa1vtShogjZSY2qY9K+cbxQPuavU+hZPVPtC5dyw8ozT+uHsaHQ6Lhg/WMKgYXZaAIPWoBvFCw24VjizT2RBUd6fQ6VAC7n6/CEZ5ZT+70KHCc0x8HarEYpa2Rd73fG4ZMaAORHCowv0P5aqqOaUOJycBKuKZTRYNXpvHQk0DJdhqh6ZdSNA7KBOQSdNsf2//iwerH1E7rccRSEI6xvaT6LUyN+0k27b2e9hwTQ0tMJ2+JhKTUVdqoFReSrWd/umFp7pHGEEueJe9ATVhd+71mfQbQNZbh33FLRDZORJCliL0PyHZSKHYH8BZVPt1Na6ACUItBS5rO3olLnt0kVbcKDgdP2L1vrZ2Tydsu42w6XpclBAKSIQJgydYDxGEbFn1tGdEIITk/TerpWawJ5vhz1JNolC4bWPkGRGaNxF3hIgm8auyWesqYFGFyjMn9CcWObFLcO32lNfyMx60EP7QoIzGWlifyNAp0GnN1gCU+GBeVJKnwpFCtmiS5bBqcawrlRm6+wyN8SDE8Ndy3a8jO0bwFAiCVy6bW5Bkx3HIFkRTc5UfINptN7STPatqhiIMTrgPWDIKRngw38HzcilBO2+FQKle44wq1MmMizb0IODDzQ0f8FrhQYEoI=" - file_glob: true - file: "$CRATE_NAME-$TRAVIS_TAG-$TARGET.*" - on: - condition: "$TRAVIS_RUST_VERSION = stable" - tags: true - provider: releases - skip_cleanup: true -cache: cargo -before_cache: -- chmod -R a+r $HOME/.cargo -branches: - only: - - "/^v\\d+\\.\\d+\\.\\d+.*$/" - - master -notifications: - email: false diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index cc40d5f..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,63 +0,0 @@ -# Based on the "trust" template v0.1.2 -# https://github.com/japaric/trust/tree/v0.1.2 - -environment: - global: - # TODO This is the Rust channel that build jobs will use by default but can be - # overridden on a case by case basis down below - RUST_VERSION: stable - - # TODO Update this to match the name of your project. - CRATE_NAME: kickstart - - # TODO These are all the build jobs. Adjust as necessary. Comment out what you - # don't need - matrix: - - TARGET: x86_64-pc-windows-msvc - -install: - - ps: >- - If ($Env:TARGET -eq 'x86_64-pc-windows-gnu') { - $Env:PATH += ';C:\msys64\mingw64\bin' - } ElseIf ($Env:TARGET -eq 'i686-pc-windows-gnu') { - $Env:PATH += ';C:\msys64\mingw32\bin' - } - - curl -sSf -o rustup-init.exe https://win.rustup.rs/ - - rustup-init.exe -y --default-host %TARGET% --default-toolchain %RUST_VERSION% - - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin - - rustc -Vv - - cargo -V - -# TODO This is the "test phase", tweak it as you see fit -test_script: - # we don't run the "test phase" when doing deploys - - if [%APPVEYOR_REPO_TAG%]==[false] ( - cargo test --target %TARGET% - ) - -before_deploy: - # TODO Update this to build the artifacts that matter to you - - cargo rustc --target %TARGET% --release --bin kickstart -- -C lto - - ps: ci\before_deploy.ps1 - -deploy: - artifact: /.*\.zip/ - auth_token: - secure: l8+ttrhwBm0ezI1fX8d+OfCeizJ1s3UMZxsRUcJF52S4D9JHU49nd4uQNth5ZP6k - description: '' - on: - RUST_VERSION: stable - appveyor_repo_tag: true - provider: GitHub - -cache: - - C:\Users\appveyor\.cargo\registry - -branches: - only: - # Release tags - - /^v\d+\.\d+\.\d+.*$/ - - master - -# Building is done in the test phase, so we disable Appveyor's build phase. -build: false diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..78a4f59 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,146 @@ +trigger: + branches: + include: ['*'] + tags: + include: ['*'] + +stages: + - stage: Tests + jobs: + - job: + strategy: + matrix: + windows-stable: + imageName: 'vs2017-win2016' + rustup_toolchain: stable + mac-stable: + imageName: 'macos-10.14' + rustup_toolchain: stable + linux-stable: + imageName: 'ubuntu-16.04' + rustup_toolchain: stable + linux-msrv: + imageName: 'ubuntu-16.04' + rustup_toolchain: 1.36.0 + pool: + vmImage: $(imageName) + steps: + - script: | + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN + echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" + displayName: Install rust + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + - script: | + curl -sSf -o rustup-init.exe https://win.rustup.rs + rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN% + echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin" + displayName: Windows install rust + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + - script: cargo build --all + displayName: Cargo build + - script: cargo test --all + displayName: Cargo test + + + - stage: Release + dependsOn: Tests + condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') + jobs: + - job: + strategy: + matrix: + windows-stable: + imageName: 'vs2017-win2016' + rustup_toolchain: stable + target: 'x86_64-pc-windows-msvc' + mac-stable: + imageName: 'macos-10.14' + rustup_toolchain: stable + target: 'x86_64-apple-darwin' + linux-stable: + imageName: 'ubuntu-16.04' + rustup_toolchain: stable + target: 'x86_64-unknown-linux-gnu' + pool: + vmImage: $(imageName) + steps: + - script: | + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $RUSTUP_TOOLCHAIN + echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" + displayName: Install rust + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + - script: | + curl -sSf -o rustup-init.exe https://win.rustup.rs + rustup-init.exe -y --default-toolchain %RUSTUP_TOOLCHAIN% + echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin" + displayName: Windows install rust + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + + - script: | + rustup target add $TARGET + cargo build --release --target $TARGET + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + displayName: Build + - script: | + rustup target add %TARGET% + cargo build --release --target %TARGET% + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + displayName: Build on Windows + + - task: CopyFiles@2 + displayName: Copy assets + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + inputs: + sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release' + contents: kickstart + targetFolder: '$(Build.BinariesDirectory)/' + - task: CopyFiles@2 + displayName: Copy assets on Windows + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + inputs: + sourceFolder: '$(Build.SourcesDirectory)/target/$(TARGET)/release' + contents: kickstart.exe + targetFolder: '$(Build.BinariesDirectory)/' + + - task: ArchiveFiles@2 + displayName: Gather assets + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + inputs: + rootFolderOrFile: '$(Build.BinariesDirectory)/kickstart' + archiveType: 'tar' + tarCompression: 'gz' + archiveFile: '$(Build.ArtifactStagingDirectory)/kickstart-$(Build.SourceBranchName)-$(TARGET).tar.gz' + - task: ArchiveFiles@2 + displayName: Gather assets + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + inputs: + rootFolderOrFile: '$(Build.BinariesDirectory)/kickstart.exe' + archiveType: 'zip' + archiveFile: '$(Build.ArtifactStagingDirectory)/kickstart-$(Build.SourceBranchName)-$(TARGET).zip' + + - task: GithubRelease@0 + condition: ne( variables['Agent.OS'], 'Windows_NT' ) + inputs: + gitHubConnection: 'kickstart' + repositoryName: 'keats/kickstart' + action: 'edit' + target: '$(build.sourceVersion)' + tagSource: 'manual' + tag: '$(Build.SourceBranchName)' + assets: '$(Build.ArtifactStagingDirectory)/kickstart-$(Build.SourceBranchName)-$(TARGET).tar.gz' + title: '$(Build.SourceBranchName)' + assetUploadMode: 'replace' + addChangeLog: true + - task: GithubRelease@0 + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + inputs: + gitHubConnection: 'kickstart' + repositoryName: 'keats/kickstart' + action: 'edit' + target: '$(build.sourceVersion)' + tagSource: 'manual' + tag: '$(Build.SourceBranchName)' + assets: '$(Build.ArtifactStagingDirectory)/kickstart-$(Build.SourceBranchName)-$(TARGET).zip' + title: '$(Build.SourceBranchName)' + assetUploadMode: 'replace' + addChangeLog: true \ No newline at end of file diff --git a/ci/before_deploy.ps1 b/ci/before_deploy.ps1 deleted file mode 100644 index 4818b9f..0000000 --- a/ci/before_deploy.ps1 +++ /dev/null @@ -1,23 +0,0 @@ -# This script takes care of packaging the build artifacts that will go in the -# release zipfile - -$SRC_DIR = $PWD.Path -$STAGE = [System.Guid]::NewGuid().ToString() - -Set-Location $ENV:Temp -New-Item -Type Directory -Name $STAGE -Set-Location $STAGE - -$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip" - -# TODO Update this to package the right artifacts -Copy-Item "$SRC_DIR\target\$($Env:TARGET)\release\kickstart.exe" '.\' - -7z a "$ZIP" * - -Push-AppveyorArtifact "$ZIP" - -Remove-Item *.* -Force -Set-Location .. -Remove-Item $STAGE -Set-Location $SRC_DIR diff --git a/ci/before_deploy.sh b/ci/before_deploy.sh deleted file mode 100644 index a54f022..0000000 --- a/ci/before_deploy.sh +++ /dev/null @@ -1,33 +0,0 @@ -# This script takes care of building your crate and packaging it for release - -set -ex - -main() { - local src=$(pwd) \ - stage= - - case $TRAVIS_OS_NAME in - linux) - stage=$(mktemp -d) - ;; - osx) - stage=$(mktemp -d -t tmp) - ;; - esac - - test -f Cargo.lock || cargo generate-lockfile - - # TODO Update this to build the artifacts that matter to you - cross rustc --bin kickstart --target $TARGET --release -- -C lto - - # TODO Update this to package the right artifacts - cp target/$TARGET/release/kickstart $stage/ - - cd $stage - tar czf $src/$CRATE_NAME-$TRAVIS_TAG-$TARGET.tar.gz * - cd $src - - rm -rf $stage -} - -main diff --git a/ci/install.sh b/ci/install.sh deleted file mode 100644 index 80e18e4..0000000 --- a/ci/install.sh +++ /dev/null @@ -1,47 +0,0 @@ -set -ex - -main() { - local target= - if [ $TRAVIS_OS_NAME = linux ]; then - target=x86_64-unknown-linux-musl - sort=sort - else - target=x86_64-apple-darwin - sort=gsort # for `sort --sort-version`, from brew's coreutils. - fi - - # Builds for iOS are done on OSX, but require the specific target to be - # installed. - case $TARGET in - aarch64-apple-ios) - rustup target install aarch64-apple-ios - ;; - armv7-apple-ios) - rustup target install armv7-apple-ios - ;; - armv7s-apple-ios) - rustup target install armv7s-apple-ios - ;; - i386-apple-ios) - rustup target install i386-apple-ios - ;; - x86_64-apple-ios) - rustup target install x86_64-apple-ios - ;; - esac - - # This fetches latest stable release - local tag=$(git ls-remote --tags --refs --exit-code https://github.com/japaric/cross \ - | cut -d/ -f3 \ - | grep -E '^v[0.1.0-9.]+$' \ - | $sort --version-sort \ - | tail -n1) - curl -LSfs https://japaric.github.io/trust/install.sh | \ - sh -s -- \ - --force \ - --git japaric/cross \ - --tag $tag \ - --target $target -} - -main diff --git a/ci/script.sh b/ci/script.sh deleted file mode 100644 index 9d08682..0000000 --- a/ci/script.sh +++ /dev/null @@ -1,21 +0,0 @@ -# This script takes care of testing your crate - -set -ex - -# TODO This is the "test phase", tweak it as you see fit -main() { - cross build --target $TARGET - cross build --target $TARGET --release - - if [ ! -z $DISABLE_TESTS ]; then - return - fi - - cross test --all --target $TARGET - cross test --all --target $TARGET --release -} - -# we don't run the "test phase" when doing deploys -if [ -z $TRAVIS_TAG ]; then - main -fi diff --git a/src/generation.rs b/src/generation.rs index 044a5de..06dfde5 100644 --- a/src/generation.rs +++ b/src/generation.rs @@ -37,11 +37,11 @@ impl Template { pub fn from_git(remote: &str, sub_dir: Option<&str>) -> Result