Skip to content

Commit

Permalink
Attempt to split azure CI
Browse files Browse the repository at this point in the history
  • Loading branch information
lehins committed Mar 6, 2020
1 parent fd75693 commit 72dacbb
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 36 deletions.
50 changes: 25 additions & 25 deletions .azure/windows.yml → .azure/job.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
parameters:
- name: setupEnvironmentSteps
displayName: 'Setup stack and all other pre-build stuff'
type: stepList
default: []
- name: jobName
type: string
- name: vmImage
type: string
- name: os
type: string
- name: stackRoot
default: "$(System.DefaultWorkingDirectory)/.stack"
- name: stackWork
default: ".stack-work"
- name: stackWorkFull
default: "$(Build.SourcesDirectory)/massiv-io/${{ parameters.stackWork }}"

jobs:
- job: ${{ parameters.name }}
timeoutInMinutes: 120
variables:
STACK_ROOT: "$(System.DefaultWorkingDirectory)\\s"
STACK_WORK: ".w"
STACK_WORK_FULL: "$(Build.SourcesDirectory)\\massiv-io\\$(STACK_WORK)"
STACK_ROOT: "${{ parameters.stackRoot }}"
STACK_WORK: "${{ parameters.stackWork }}"
STACK_WORK_FULL: "${{ parameters.stackFullWork }}"
BUILD_ARGS: "-j 2 --no-terminal --bench --no-run-benchmarks"
pool:
vmImage: ${{ parameters.vmImage }}
Expand Down Expand Up @@ -34,11 +52,6 @@ jobs:
"${{ parameters.name }}" | "STACK_ROOT" | "$(RESOLVER) | $(Build.SourceBranch)"
"${{ parameters.name }}" | "STACK_ROOT" | "$(RESOLVER) | refs/heads/master"
cacheHitVar: STACK_ROOT_RESTORED
- powershell: |
xcopy "$env:STACK_ROOT\\bin" "$env:LOCALAPPDATA\\Programs\\stack" /l /s /r /k /i /h /y /b
displayName: Restore binaries
condition: eq(variables.STACK_ROOT_RESTORED, 'true')
continueOnError: true
- task: Cache@2
displayName: Cache STACK_WORK
inputs:
Expand All @@ -47,23 +60,10 @@ jobs:
restoreKeys: |
"${{ parameters.name }}" | "STACK_WORK" | "$(RESOLVER) | $(Build.SourceBranch)"
"${{ parameters.name }}" | "STACK_WORK" | "$(RESOLVER) | refs/heads/master"
- task: Bash@3
displayName: Setup environment
inputs:
targetType: 'inline'
script: |
set -x
# Install stack
curl -sSkL https://www.stackage.org/stack/windows-x86_64 -o stack.zip
7z x stack.zip stack.exe -aoa
# Script for restoring source files modification time from commit to avoid recompilation.
curl -sSkL https://gist.githubusercontent.com/lehins/fd36a8cc8bf853173437b17f6b6426ad/raw/d9ddb32cac2f0dc6800be4fa54d450f0dcda6c60/git-modtime.hs -o git-modtime.hs
# Restore mod time and setup ghc, if it wasn't restored from cache
./stack script --resolver ${RESOLVER} git-modtime.hs
- powershell: |
xcopy "$env:LOCALAPPDATA\\Programs\\stack" "$env:STACK_ROOT\\bin" /l /s /r /k /i /h /y /b
displayName: Save binaries
continueOnError: true
cacheHitVar: STACK_WORK_RESTORED
- ${{ each step in parameters.setupEnvironmentSteps }}:
- ${{ each pair in step }}:
${{ pair.key }}: ${{ pair.value }}
- task: Bash@3
displayName: 'stack build'
env:
Expand Down
62 changes: 51 additions & 11 deletions .azure/pipelines.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,58 @@
jobs:
# - template: ./osx.yml
# parameters:
# name: macOS
# vmImage: macOS-10.13
# os: osx
- template: ./windows.yml
parameters:
jobName: macOS
vmImage: macOS-latest
os: osx
setupEnvironmentSteps:
- task: Bash@3
displayName: Setup environment
inputs:
targetType: 'inline'
script: |
set -x
# Install stack
curl --insecure -L https://www.stackage.org/stack/osx-x86_64 | tar xz --strip-components=1 --include '*/stack' -C .
# Script for restoring source files modification time from commit to avoid recompilation.
curl -sSkL https://gist.githubusercontent.com/lehins/fd36a8cc8bf853173437b17f6b6426ad/raw/d9ddb32cac2f0dc6800be4fa54d450f0dcda6c60/git-modtime.hs -o git-modtime.hs
# Restore mod time and setup ghc, if it wasn't restored from cache
./stack script --resolver ${RESOLVER} git-modtime.hs
# For faster CI turnaround, linux builds are still on Travis
# - template: ./linux.yml
# parameters:
# name: Linux
# vmImage: ubuntu-18.04
# jobName: Linux
# vmImage: ubuntu-latest
# os: linux

- template: ./windows.yml
- template: ./job.yml
parameters:
name: Windows
vmImage: vs2017-win2016
os: windows
jobName: Windows
vmImage: vs2017-latest
os: windows
stackRoot: "$(System.DefaultWorkingDirectory)\\s"
stackWork: ".w"
stackWorkFull: "$(Build.SourcesDirectory)\\massiv-io\\$(STACK_WORK)"
setupEnvironmentSteps:
- powershell: |
xcopy "$env:STACK_ROOT\\bin" "$env:LOCALAPPDATA\\Programs\\stack" /l /s /r /k /i /h /y /b
displayName: Restore binaries
condition: eq(variables.STACK_ROOT_RESTORED, 'true')
continueOnError: true
- task: Bash@3
displayName: Setup environment
inputs:
targetType: 'inline'
script: |
set -x
# Install stack
curl -sSkL https://www.stackage.org/stack/windows-x86_64 -o stack.zip
7z x stack.zip stack.exe -aoa
# Script for restoring source files modification time from commit to avoid recompilation.
curl -sSkL https://gist.githubusercontent.com/lehins/fd36a8cc8bf853173437b17f6b6426ad/raw/d9ddb32cac2f0dc6800be4fa54d450f0dcda6c60/git-modtime.hs -o git-modtime.hs
# Restore mod time and setup ghc, if it wasn't restored from cache
./stack script --resolver ${RESOLVER} git-modtime.hs
- powershell: |
xcopy "$env:LOCALAPPDATA\\Programs\\stack" "$env:STACK_ROOT\\bin" /l /s /r /k /i /h /y /b
displayName: Save binaries
continueOnError: true

0 comments on commit 72dacbb

Please sign in to comment.