Skip to content

Commit

Permalink
CI: Automate building of Windows and macOS release binaries (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
letmaik authored Jul 4, 2019
1 parent 8034ad3 commit c0c049c
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 10 deletions.
7 changes: 5 additions & 2 deletions .ci/azure-pipelines/matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ parameters:
CC: gcc-8
FC: gfortran-8
macOS:
CC: gcc-8
FC: gfortran-8
CC: gcc-9
FC: gfortran-9
Windows:
CC: gcc
FC: gfortran
Expand All @@ -25,6 +25,8 @@ parameters:
NESTING: basic
GRIB1: 0
GRIB2: 1

RELEASE: false

# Loop/matrix parameters.
# Note that these may be overridden by the including yml (typically azure-pipelines.yml).
Expand All @@ -43,6 +45,7 @@ jobs:
- ${{ if not(and(eq(OS_NAME, 'Windows'), eq(BUILD_SYSTEM, 'Make'))) }}:
- template: ${{ parameters.templates[OS_NAME] }}
parameters:
RELEASE: ${{ parameters.RELEASE }}
OS_NAME: ${{ OS_NAME }}
BUILD_SYSTEM: ${{ BUILD_SYSTEM }}
BUILD_TYPE: ${{ BUILD_TYPE }}
Expand Down
47 changes: 47 additions & 0 deletions .ci/azure-pipelines/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
steps:
- ${{ if eq(parameters.OS_NAME, 'Windows') }}:
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: build/install
includeRootFolder: false
archiveType: zip
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.SourceBranchName)-$(NESTING)_nesting-$(MODE)-x64-$(OS_NAME)-$(BUILD_TYPE).zip'
displayName: Create distribution package

- ${{ if not(eq(parameters.OS_NAME, 'Windows')) }}:
- bash: bash .ci/unix/delocate.sh
displayName: Delocate

- task: ArchiveFiles@2
inputs:
rootFolderOrFile: build/install
includeRootFolder: false
archiveType: tar
tarCompression: xz
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.SourceBranchName)-$(NESTING)_nesting-$(MODE)-x64-$(OS_NAME)-$(BUILD_TYPE).tar.xz'
displayName: Create distribution package

- pwsh: |
dir $(Build.ArtifactStagingDirectory) -r | % { if ($_.Name -cne $_.Name.ToLower()) { ren $_.FullName $_.Name.ToLower() } }
displayName: Rename to lowercase

# not strictly needed
- task: PublishBuildArtifacts@1
displayName: Store distribution package
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)
artifactName: dist_$(OS_NAME)_$(BUILD_SYSTEM)_$(BUILD_TYPE)_$(MODE)

- task: GithubRelease@0
displayName: Create GitHub Draft Release
inputs:
gitHubConnection: WRF-CMake-releases
repositoryName: WRF-CMake/WRF
action: edit # will create if not existing
tag: $(Build.SourceBranchName)
isDraft: true
isPreRelease: true
addChangeLog: false
assetUploadMode: replace
assets: |
$(Build.ArtifactStagingDirectory)/*
5 changes: 5 additions & 0 deletions .ci/azure-pipelines/unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@ jobs:

- ${{ if eq(parameters.WATS_RUN, 'true') }}:
- template: wats_run.yml

- ${{ if eq(parameters.RELEASE, 'true') }}:
- template: release.yml
parameters:
${{ insert }}: ${{ parameters }}
5 changes: 5 additions & 0 deletions .ci/azure-pipelines/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,8 @@ jobs:

- ${{ if eq(parameters.WATS_RUN, 'true') }}:
- template: wats_run.yml

- ${{ if eq(parameters.RELEASE, 'true') }}:
- template: release.yml
parameters:
${{ insert }}: ${{ parameters }}
2 changes: 1 addition & 1 deletion .ci/unix/Brewfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
brew "coreutils"
brew "gcc@8"
brew "gcc"
brew "netcdf"
brew "jasper"
brew "libpng"
Expand Down
20 changes: 20 additions & 0 deletions .ci/unix/delocate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Copyright 2018 M. Riechert and D. Meyer. Licensed under the MIT License.

set -ex

SCRIPTDIR=$(dirname "$0")
cd $SCRIPTDIR/../..

if [ "$(uname)" == "Darwin" ]; then

pip3 install delocate
delocate-listdeps --all --depending build/install/main
delocate-path build/install/main
delocate-listdeps --all --depending build/install/main

else
echo "Unknown OS: $(uname)"
exit 1
fi
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
env:
- BUILD_SYSTEM=Make
- BUILD_TYPE=Debug
- CC=gcc-8 # GNU via Homebrew
- FC=gfortran-8
- CC=gcc-9 # GNU via Homebrew
- FC=gfortran-9
- MODE=serial

- stage: build
Expand All @@ -48,8 +48,8 @@ jobs:
env:
- BUILD_SYSTEM=Make
- BUILD_TYPE=Debug
- CC=gcc-8 # GNU via Homebrew
- FC=gfortran-8
- CC=gcc-9 # GNU via Homebrew
- FC=gfortran-9
- MODE=dmpar

# CMake builds
Expand Down Expand Up @@ -89,8 +89,8 @@ jobs:
env:
- BUILD_SYSTEM=CMake
- BUILD_TYPE=Debug
- CC=gcc-8 # GNU via Homebrew
- FC=gfortran-8
- CC=gcc-9 # GNU via Homebrew
- FC=gfortran-9
- GRIB1=1
- GRIB2=1
- MODE=serial
Expand All @@ -104,7 +104,7 @@ jobs:
- BUILD_SYSTEM=CMake
- BUILD_TYPE=Debug
- CC=clang # Apple Clang
- FC=gfortran-8
- FC=gfortran-9
- GRIB1=1
- GRIB2=1
- MODE=dmpar
Expand Down
19 changes: 19 additions & 0 deletions azure-pipelines-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# First, create a tag for the new version.
# Then, run this pipeline on the tag to store binaries in a draft GitHub release.

# Note that these values are also overridden to "none" in Azure DevOps's UI to
# prevent others to run this pipeline by changing the triggers below and opening a PR.
# It still wouldn't cause harm as secrets (GitHub credentials) are not available to PRs from forks.
trigger: none
pr: none

jobs:
- template: .ci/azure-pipelines/matrix.yml
parameters:
OS_NAMES: [Windows, macOS] # TODO Linux
BUILD_SYSTEMS: [CMake]
BUILD_TYPES: [Debug, Release]
MODES: [serial, dmpar]
WATS_DIFF: false
WATS_PLOTS: false
RELEASE: true

0 comments on commit c0c049c

Please sign in to comment.