Skip to content

Commit

Permalink
Upgrade ci to use latest from hello-reason (#361)
Browse files Browse the repository at this point in the history
* Upgrade ci to use latest from hello-reason

* esy-build-steps->build-platform

* Add publish-build-cache template
  • Loading branch information
jchavarri authored and jaredly committed Dec 11, 2019
1 parent 0b3226a commit fcac32a
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 190 deletions.
37 changes: 37 additions & 0 deletions .ci/build-platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Cross-platform set of build steps for building esy projects

parameters:
platform: "macOS"
vmImage: "macOS-10.13"

jobs:
- job: ${{ parameters.platform }}
pool:
vmImage: ${{ parameters.vmImage }}
demands: node.js
timeoutInMinutes: 120 # This is mostly for Windows
variables:
ESY__CACHE_INSTALL_PATH: ${{ parameters.ESY__CACHE_INSTALL_PATH }}
CACHE_FOLDER: $(Pipeline.Workspace)/cache
steps:
- template: utils/use-node.yml
- template: utils/use-esy.yml
- template: utils/restore-build-cache.yml
- script: "esy install"
displayName: "esy install"
- script: "esy build"
displayName: "esy build"
# - script: "esy test"
# displayName: "Test command"
- template: utils/publish-build-cache.yml
- bash: ./_build/default/src/analyze_example_tests/ExamplesTests.exe
- bash: ./_build/default/util_tests/UtilTests.exe
- bash: mkdir -p rls-release
- bash: cp _build/default/bin/Bin.exe rls-release/reason-language-server.exe
- task: PublishBuildArtifacts@1
displayName: 'Upload binary'
inputs:
pathToPublish: 'rls-release'
artifactName: 'rls-$(Agent.OS)'
parallel: true
parallelCount: 8
22 changes: 0 additions & 22 deletions .ci/esy-build-steps.yml

This file was deleted.

25 changes: 0 additions & 25 deletions .ci/publish-build-cache.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .ci/restore-build-cache.yml

This file was deleted.

32 changes: 0 additions & 32 deletions .ci/use-calc-esy-install-path.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .ci/utils/publish-build-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
steps:
- pwsh: Copy-Item -Path $(ESY__CACHE_INSTALL_PATH) -Destination $(CACHE_FOLDER) -Recurse
displayName: '[Cache][Publish] Copy builds to be cached'
45 changes: 45 additions & 0 deletions .ci/utils/restore-build-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# The cache key is built up of the following:
# We use a string that we can change to bust the cache
# The string "esy"
# The string for the OS
# The hash of the lock file
steps:
- bash: |
# COMPUTE THE ESY INSTALL CACHE LOCATION AHEAD OF TIME
DESIRED_LEN="86"
# Note: This will need to change when upgrading esy version
# that reenables long paths on windows.
if [ "$AGENT_OS" == "Windows_NT" ]; then
DESIRED_LEN="33"
fi
HOME_ESY3="$HOME/.esy/3"
HOME_ESY3_LEN=${#HOME_ESY3}
NUM_UNDERS=$(echo "$(($DESIRED_LEN-$HOME_ESY3_LEN))")
UNDERS=$(printf "%-${NUM_UNDERS}s" "_")
UNDERS="${UNDERS// /_}"
THE_ESY__CACHE_INSTALL_PATH=${HOME_ESY3}${UNDERS}/i
if [ "$AGENT_OS" == "Windows_NT" ]; then
THE_ESY__CACHE_INSTALL_PATH=$( cygpath --mixed --absolute "$THE_ESY__CACHE_INSTALL_PATH")
fi
echo "THE_ESY__CACHE_INSTALL_PATH: $THE_ESY__CACHE_INSTALL_PATH"
# This will be exposed as an env var ESY__CACHE_INSTALL_PATH, or an
# Azure var esy__cache_install_path
echo "##vso[task.setvariable variable=esy__cache_install_path]$THE_ESY__CACHE_INSTALL_PATH"
displayName: '[Cache] calculate esy store path'
- task: Cache@2
inputs:
# "v1" prefix added just to keep the ability to clear a cache without having to wait 7 days
key: v1 | esy | $(Agent.OS) | esy.lock/index.json
restoreKeys: v1 | esy | $(Agent.OS)
path: $(CACHE_FOLDER)
cacheHitVar: CACHE_RESTORED
displayName: '[Cache] esy packages'

- pwsh: 'New-Item $(ESY__CACHE_INSTALL_PATH) -ItemType Directory'
condition: eq(variables.CACHE_RESTORED, 'true')
displayName: '[Cache][Restore] Create esy cache directory'

- pwsh: Move-Item -Path $(CACHE_FOLDER)/* -Destination $(ESY__CACHE_INSTALL_PATH)
displayName: '[Cache][Restore] Move downloaded cache in place'
condition: eq(variables.CACHE_RESTORED, 'true')
5 changes: 5 additions & 0 deletions .ci/utils/use-esy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# steps to install esy globally

steps:
- script: "npm install -g esy@0.5.8"
displayName: "install esy"
7 changes: 7 additions & 0 deletions .ci/utils/use-node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# steps to use node on agent

steps:
- task: NodeTool@0
displayName: "Use Node 8.x"
inputs:
versionSpec: 8.x
112 changes: 41 additions & 71 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,81 +1,51 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml


name: $(Build.SourceVersion)
jobs:
- job: Linux
timeoutInMinutes: 0
pool:
vmImage: 'Ubuntu 16.04'

variables:
STAGING_DIRECTORY: /home/vsts/STAGING
STAGING_DIRECTORY_UNIX: /home/vsts/STAGING
ESY__CACHE_INSTALL_PATH: /home/vsts/.esy/3_____________________________________________________________________/i
ESY__CACHE_SOURCE_TARBALL_PATH: /home/vsts/.esy/source/i
# ESY__NPM_ROOT: /opt/hostedtoolcache/node/8.14.0/x64/lib/node_modules/esy

steps:
- template: .ci/use-node.yml
- template: .ci/restore-build-cache.yml
- template: .ci/esy-build-steps.yml
- template: .ci/publish-build-cache.yml
trigger:
branches:
include:
- master

- job: MacOS
timeoutInMinutes: 0
pool:
vmImage: 'macOS 10.13'
pr:
branches:
include:
- "*"

variables:
STAGING_DIRECTORY: /Users/runner/STAGING
STAGING_DIRECTORY_UNIX: /Users/runner/STAGING
ESY__CACHE_SOURCE_TARBALL_PATH: /Users/runner/.esy/source/i
# ESY__NPM_ROOT: /usr/local/lib/node_modules/esy

steps:
- template: .ci/use-calc-esy-install-path.yml
- template: .ci/use-node.yml
- template: .ci/restore-build-cache.yml
- template: .ci/esy-build-steps.yml
- template: .ci/publish-build-cache.yml

- job: Windows
timeoutInMinutes: 0
pool:
vmImage: 'vs2017-win2016'
jobs:
- template: .ci/build-platform.yml
parameters:
platform: Linux
vmImage: ubuntu-16.04

variables:
STAGING_DIRECTORY: C:\Users\VssAdministrator\STAGING
STAGING_DIRECTORY_UNIX: /C/Users/VssAdministrator/STAGING
ESY__CACHE_INSTALL_PATH: /C/Users/VssAdministrator/.esy/3_/i
ESY__CACHE_SOURCE_TARBALL_PATH: /C/Users/VssAdministrator/.esy/source/i
# ESY__NPM_ROOT: /C/npm/prefix/node_modules/esy
- template: .ci/build-platform.yml
parameters:
platform: macOS
vmImage: macOS-10.13

steps:
- template: .ci/use-node.yml
- template: .ci/restore-build-cache.yml
- template: .ci/esy-build-steps.yml
- template: .ci/publish-build-cache.yml
# Need windows-2019 to do esy import/export-dependencies
# which assumes you have bsdtar (tar.exe) in your system
# otherwise it will end up using the esy-bash tar which doesn't
# understand drives like D:/ (thinks it's an scp path).
- template: .ci/build-platform.yml
parameters:
platform: Windows
vmImage: windows-2019

- job: Release
timeoutInMinutes: 0
displayName: Release
dependsOn:
- Linux
- MacOS
- Windows
condition: succeeded()
pool:
vmImage: ubuntu-16.04
steps:
- task: PublishBuildArtifacts@1
displayName: 'Release Package'
inputs:
PathtoPublish: './editor-extensions/vscode/'
ArtifactName: npm-package
- job: Release
timeoutInMinutes: 0
displayName: Release
dependsOn:
- Linux
- MacOS
- Windows
condition: succeeded()
pool:
vmImage: ubuntu-16.04
steps:
- task: PublishBuildArtifacts@1
displayName: 'Release Package'
inputs:
PathtoPublish: './editor-extensions/vscode/'
ArtifactName: npm-package


# - name: release
Expand Down

0 comments on commit fcac32a

Please sign in to comment.