This repository has been archived by the owner on Jun 1, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
azure pipeline CI to release native macos/windows versions (#2)
- Loading branch information
Showing
3 changed files
with
139 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Somse useful references found thus far: | ||
# https://docs.microsoft.com/en-us/azure/devops/pipelines/process/multiple-phases?view=azure-devops&tabs=yaml | ||
# https://github.com/peterheesterman/chit/blob/master/azure-pipelines.yml | ||
|
||
variables: | ||
scalafmt_version: v2.0.0-RC7 | ||
graalvm_version: 1.0.0-rc16 | ||
|
||
trigger: | ||
branches: | ||
include: | ||
- refs/heads/* | ||
- refs/tags/* | ||
|
||
jobs: | ||
# Initial task to compile a JAR, store as a pipeline artifact to be used by | ||
# downstream builders. | ||
- job: BuildJAR | ||
pool: | ||
vmImage: 'ubuntu-16.04' | ||
steps: | ||
- script: | | ||
echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list | ||
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823 | ||
sudo apt-get update | ||
sudo apt-get install sbt | ||
displayName: Install SBT | ||
- script: | | ||
git clone https://github.com/scalameta/scalafmt --branch ${SCALAFMT_VERSION} --single-branch | ||
cd scalafmt | ||
sbt cli/assembly | ||
displayName: Build scalafmt with assembly into JAR | ||
- task: PublishPipelineArtifact@0 | ||
inputs: | ||
targetPath: scalafmt/scalafmt-cli/target/scala-2.12/scalafmt.jar | ||
artifactName: jar | ||
|
||
# Parallel native builders using template, each builds on corresponding OS and | ||
# packages into archive, then sends results into artifact pipeline. | ||
- template: ci/native-build.yml | ||
parameters: | ||
name: BuildNative_Linux | ||
platform: linux-amd64 | ||
vmImage: ubuntu-16.04 | ||
binPath: bin | ||
buildFlags: '--static' | ||
|
||
- template: ci/native-build.yml | ||
parameters: | ||
name: BuildNative_macOS | ||
platform: macOS-amd64 | ||
vmImage: macOS-10.14 | ||
binPath: Contents/Home/bin | ||
|
||
# Releaser, gets everything from artifact pipeline, and then uploads to GitHub | ||
# Releases if there is a semver tag. | ||
# | ||
# Currently this requires the GitHub "release" to not already exist due to | ||
# 'create' action usage, TODO: if this can be made to work with 'edit' as well. | ||
# Prior the 'edit' action was not working with 'auto' tag(?). | ||
- job: UploadReleases | ||
dependsOn: | ||
- BuildNative_macOS | ||
- BuildNative_Linux | ||
steps: | ||
- task: DownloadPipelineArtifact@0 | ||
inputs: | ||
artifactName: dist_linux-amd64 | ||
targetPath: $(Build.ArtifactStagingDirectory) | ||
- task: DownloadPipelineArtifact@0 | ||
inputs: | ||
artifactName: dist_macOS-amd64 | ||
targetPath: $(Build.ArtifactStagingDirectory) | ||
- script: ls -lh $(Build.ArtifactStagingDirectory) | ||
- task: GithubRelease@0 | ||
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) | ||
inputs: | ||
gitHubConnection: 'GitHub-mroth-oauth' | ||
repositoryName: 'mroth/scalafmt-native' | ||
action: create | ||
target: '$(Build.SourceVersion)' | ||
tagSource: auto | ||
# By default, all files in the $(Build.ArtifactStagingDirectory) directory will be uploaded. | ||
# assets: '$(Build.ArtifactStagingDirectory)/*.tgz' | ||
assetUploadMode: replace | ||
addChangeLog: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
parameters: | ||
name: '' | ||
platform: linux-amd64 # currently macOS-amd64 or linux-amd64 | ||
vmImage: ubuntu-16.04 | ||
binPath: bin | ||
buildFlags: '' # any extra build flags requested | ||
|
||
jobs: | ||
- job: ${{ parameters.name }} | ||
dependsOn: | ||
- BuildJAR | ||
pool: | ||
vmImage: ${{ parameters.vmImage }} | ||
variables: | ||
platform: ${{ parameters.platform }} | ||
bin_path: ${{ parameters.binPath }} | ||
build_flags: ${{ parameters.buildFlags }} | ||
steps: | ||
- task: DownloadPipelineArtifact@0 | ||
inputs: | ||
artifactName: jar | ||
targetPath: $(System.DefaultWorkingDirectory) | ||
- script: | | ||
curl -fsL https://github.com/oracle/graal/releases/download/vm-$(graalvm_version)/graalvm-ce-${GRAALVM_VERSION}-${PLATFORM}.tar.gz \ | ||
--output graalvm.tgz | ||
tar xzf graalvm.tgz && rm -rf graalvm.tgz | ||
mv graalvm-ce-$(graalvm_version) graalvm | ||
displayName: Install GraalVM | ||
- script: | | ||
JAVA_OPTS="-Xmx=2g" ./graalvm/${BIN_PATH}/native-image \ | ||
${BUILD_FLAGS} \ | ||
--no-fallback \ | ||
-jar ./scalafmt.jar \ | ||
scalafmt-native | ||
ls -lh | ||
displayName: Build ${{ parameters.platform }} native image | ||
- task: ArchiveFiles@2 | ||
inputs: | ||
rootFolderOrFile: $(System.DefaultWorkingDirectory)/scalafmt-native | ||
archiveType: 'tar' | ||
tarCompression: 'gz' | ||
archiveFile: '$(Build.ArtifactStagingDirectory)/scalafmt-native_${{ parameters.platform }}.tgz' | ||
- task: PublishPipelineArtifact@0 | ||
inputs: | ||
artifactName: dist_${{ parameters.platform }} | ||
targetPath: $(Build.ArtifactStagingDirectory) |
2d96673
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My brain broke when writing this commit message. I mean "macos/linux" releases, obviously.
But since this has already been "released" I'm not going to rewrite the commit and force push.