Skip to content

Commit

Permalink
add ci files
Browse files Browse the repository at this point in the history
  • Loading branch information
yeastplume committed Feb 19, 2020
1 parent 4be48a6 commit c2bff1e
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .ci/general-jobs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash

# Copyright 2020 Revcore Technologies Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# This script contains test-related jobs.

case "${CI_JOB}" in
"test")
for dir in ${CI_JOB_ARGS}; do
printf "executing tests in directory \`%s\`...\n" "${dir}"
cd "${dir}" && \
cargo test --release && \
cd - > /dev/null || exit 1
done
;;
esac
9 changes: 9 additions & 0 deletions .ci/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
steps:
- script: |
choco install -y llvm
displayName: Windows Install LLVM
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- script: |
brew uninstall llvm
displayName: macOS Uninstall LLVM
condition: eq( variables['Agent.OS'], 'Darwin' )
50 changes: 50 additions & 0 deletions .ci/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
steps:
- script: 'cargo test --all'
displayName: Cargo Test All
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- script: 'cargo build --release'
displayName: Build Release
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- script: |
MY_TAG="$(Build.SourceBranch)"
MY_TAG=${MY_TAG#refs/tags/}
echo $MY_TAG
echo "##vso[task.setvariable variable=build.my_tag]$MY_TAG"
echo "##vso[task.setvariable variable=build.platform]$PLATFORM"
displayName: "Create my tag variable"
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- task: CopyFiles@2
displayName: Copy assets
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
inputs:
sourceFolder: '$(Build.SourcesDirectory)/target/release'
contents: 'aloevera'
targetFolder: '$(Build.BinariesDirectory)/aloevera'
- task: ArchiveFiles@2
displayName: Gather assets
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)/aloevera'
archiveType: 'tar'
tarCompression: 'gz'
archiveFile: '$(Build.ArtifactStagingDirectory)/aloevera-$(build.my_tag)-$(build.platform).tar.gz'
- script: |
openssl sha256 $(Build.ArtifactStagingDirectory)/aloevera-$(build.my_tag)-$(build.platform).tar.gz > $(Build.ArtifactStagingDirectory)/aloevera-$(build.my_tag)-$(build.platform)-sha256sum.txt
displayName: Create Checksum
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- task: GithubRelease@0
displayName: Github release
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
inputs:
gitHubConnection: 'yeastplume'
repositoryName: 'yeastplume/aloevera'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(build.my_tag)'
assets: |
$(Build.ArtifactStagingDirectory)/aloevera-$(build.my_tag)-$(build.platform).tar.gz
$(Build.ArtifactStagingDirectory)/aloevera-$(build.my_tag)-$(build.platform)-sha256sum.txt
title: '$(build.my_tag)'
assetUploadMode: 'replace'
addChangeLog: true
10 changes: 10 additions & 0 deletions .ci/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
steps:
- script: 'cargo test --all'
displayName: Windows Cargo Test
condition: and(eq( variables['Agent.OS'], 'Windows_NT' ), eq( variables['CI_JOB'], 'test-all' ))
- script: 'cargo test --all'
displayName: macOS Cargo Test
condition: and(eq( variables['Agent.OS'], 'Darwin' ), eq( variables['CI_JOB'], 'test-all' ))
- script: '.ci/general-jobs'
displayName: Linux Cargo Test
condition: eq( variables['Agent.OS'], 'Linux' )
53 changes: 53 additions & 0 deletions .ci/windows-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
steps:
- script: 'cargo test --all'
displayName: Cargo Test All
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- script: 'cargo clean'
displayName: Cargo Clean
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- script: 'cargo build --release'
displayName: Build Release
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- script: |
SET MY_TAG=$(Build.SourceBranch)
SET MY_TAG=%MY_TAG:~10%
echo %MY_TAG%
echo %PLATFORM%
echo ##vso[task.setvariable variable=build.my_tag]%MY_TAG%
echo ##vso[task.setvariable variable=build.platform]%PLATFORM%
displayName: "Create my tag variable"
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- task: CopyFiles@2
displayName: Copy assets
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
inputs:
sourceFolder: '$(Build.SourcesDirectory)\target\release'
contents: 'aloevera.exe'
targetFolder: '$(Build.BinariesDirectory)\aloevera'
- task: ArchiveFiles@2
displayName: Gather assets
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
inputs:
rootFolderOrFile: '$(Build.BinariesDirectory)\aloevera'
archiveType: 'zip'
archiveFile: '$(Build.ArtifactStagingDirectory)\aloevera-$(build.my_tag)-$(build.platform).zip'
- script: |
powershell -Command "get-filehash -algorithm sha256 $(Build.ArtifactStagingDirectory)\aloevera-$(build.my_tag)-$(build.platform).zip | Format-List |  Out-String | ForEach-Object { $_.Trim() } > $(Build.ArtifactStagingDirectory)\aloevera-$(build.my_tag)-$(build.platform)-sha256sum.txt"
displayName: Create Checksum
condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
- task: GithubRelease@0
displayName: Github release
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' ))
inputs:
gitHubConnection: 'yeastplume'
repositoryName: 'yeastplume/aloevera'
action: 'edit'
target: '$(build.sourceVersion)'
tagSource: 'manual'
tag: '$(build.my_tag)'
assets: |
$(Build.ArtifactStagingDirectory)\aloevera-$(build.my_tag)-$(build.platform).zip
$(Build.ArtifactStagingDirectory)\aloevera-$(build.my_tag)-$(build.platform)-sha256sum.txt
title: '$(build.my_tag)'
assetUploadMode: 'replace'
addChangeLog: true

0 comments on commit c2bff1e

Please sign in to comment.