summaryrefslogtreecommitdiff
path: root/azure-pipelines/templates/release.yml
blob: f6a00b7cf26ae0adc9b803d3af4ef1fe131160e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
parameters:
  # If this is false, not all targets are triggered. For example:
  # The NSIS installer for Windows and the creation of debs only work for
  # releases. Not for any other type of binary. So they are skilled if this
  # is set to false.
  IsStableRelease: false

jobs:
- job: source
  displayName: 'Source'
  pool:
    vmImage: 'ubuntu-16.04'

  steps:
  - template: release-prepare-source.yml
  - script: |
      set -ex

      # Rename the folder to openttd-NNN-source
      mkdir openttd-$(Build.BuildNumber)
      find . -maxdepth 1 -not -name . -not -name openttd-$(Build.BuildNumber) -exec mv {} openttd-$(Build.BuildNumber)/ \;
      # Copy back release_date, as it is needed for the template 'release-bundles'
      cp openttd-$(Build.BuildNumber)/.release_date .release_date

      mkdir -p build/bundles
      tar --xz -cf build/bundles/openttd-$(Build.BuildNumber)-source.tar.xz openttd-$(Build.BuildNumber)
      zip -9 -r -q build/bundles/openttd-$(Build.BuildNumber)-source.zip openttd-$(Build.BuildNumber)
    displayName: 'Create bundle'
  - template: release-bundles.yml

- job: meta
  displayName: 'Metadata'
  pool:
    vmImage: 'ubuntu-16.04'
  dependsOn: source

  steps:
  - template: release-fetch-source.yml
  - script: |
      set -ex

      mkdir -p build/bundles
      cp .changelog build/bundles/changelog.txt
      cp .release_date build/bundles/released.txt
      cp README.md build/bundles/README.md
    displayName: 'Copy meta files'
  - template: release-bundles.yml
    parameters:
      CalculateChecksums: false

- job: docs
  displayName: 'Docs'
  pool:
    vmImage: 'ubuntu-16.04'
  dependsOn: source

  steps:
    - template: release-fetch-source.yml
    - template: linux-build.yml
      parameters:
        Image: compile-farm
        ContainerCommand: '$(Build.BuildNumber)'
        Tag: docs
    - template: linux-claim-bundles.yml
    - template: release-bundles.yml

- job: windows
  displayName: 'Windows'
  pool:
    vmImage: 'VS2017-Win2016'
  dependsOn: source

  strategy:
    matrix:
      Win32:
        BundlePlatform: 'win32'
        BuildArch: 'Win32'
        VcpkgTargetTriplet: 'x86-windows-static'
      Win64:
        BundlePlatform: 'win64'
        BuildArch: 'x64'
        VcpkgTargetTriplet: 'x64-windows-static'

  steps:
  - template: release-fetch-source.yml
  - template: windows-dependencies.yml
  - template: windows-dependency-zip.yml
  - template: windows-build.yml
    parameters:
      BuildArch: $(BuildArch)
      VcpkgTargetTriplet: $(VcpkgTargetTriplet)
      BuildConfiguration: 'RelWithDebInfo'
      ${{ if eq(parameters.IsStableRelease, true) }}:
        OptionUseNSIS: "ON"
  - task: VSBuild@1
    displayName: 'Create bundles'
    inputs:
      solution: build/PACKAGE.vcxproj
      configuration: 'RelWithDebInfo'
  - bash: |
      set -ex

      cp build/RelWithDebInfo/openttd.pdb build/bundles/openttd-$(Build.BuildNumber)-windows-$(BundlePlatform).pdb
      xz -9 build/bundles/openttd-$(Build.BuildNumber)-windows-$(BundlePlatform).pdb
    displayName: 'Copy PDB to bundles folder'
  - template: release-bundles.yml

- ${{ if eq(parameters.IsStableRelease, true) }}:
  - job: linux_stable
    displayName: 'Linux'
    pool:
      vmImage: 'ubuntu-16.04'
    dependsOn: source

    strategy:
      matrix:
        linux-ubuntu-xenial-i386-gcc:
          Tag: 'linux-ubuntu-xenial-i386-gcc'
        linux-ubuntu-xenial-amd64-gcc:
          Tag: 'linux-ubuntu-xenial-amd64-gcc'
        linux-ubuntu-bionic-i386-gcc:
          Tag: 'linux-ubuntu-bionic-i386-gcc'
        linux-ubuntu-bionic-amd64-gcc:
          Tag: 'linux-ubuntu-bionic-amd64-gcc'
        linux-ubuntu-focal-amd64-gcc:
          Tag: 'linux-ubuntu-focal-amd64-gcc'
        linux-debian-stretch-i386-gcc:
          Tag: 'linux-debian-stretch-i386-gcc'
        linux-debian-stretch-amd64-gcc:
          Tag: 'linux-debian-stretch-amd64-gcc'
        linux-debian-buster-i386-gcc:
          Tag: 'linux-debian-buster-i386-gcc'
        linux-debian-buster-amd64-gcc:
          Tag: 'linux-debian-buster-amd64-gcc'

    steps:
    - template: release-fetch-source.yml
    - template: linux-build.yml
      parameters:
        Image: compile-farm
        ContainerCommand: '$(Build.BuildNumber)'
        Tag: $(Tag)
    - template: linux-claim-bundles.yml
    - template: release-bundles.yml

- job: macos
  displayName: 'MacOS'
  pool:
    vmImage: 'macOS-10.14'
  dependsOn: source

  variables:
    MACOSX_DEPLOYMENT_TARGET: 10.9

  steps:
  - template: release-fetch-source.yml
  - template: osx-dependencies.yml
  - template: osx-build.yml
  - script: |
      set -ex

      cd build
      make package
    displayName: 'Create bundles'
  - template: release-bundles.yml

- job: manifest
  displayName: 'Manifest'
  pool:
    vmImage: 'ubuntu-16.04'
  dependsOn:
  - source
  - docs
  - windows
  - ${{ if eq(parameters.IsStableRelease, true) }}:
    - linux_stable
  - macos
  # "Skipped" is not a status, and is not succeeded. So it seems to be
  # considered failed. So we trigger if all the earlier jobs are done (which
  # might be succeeded, failed, or skipped), and run this job. This is not
  # optimal, but given the rules, it is the only way to get this to work (as
  # some jobs might be skipped).
  condition: succeededOrFailed()

  steps:
  - template: release-fetch-source.yml
  - template: release-manifest.yml
    ${{ if eq(parameters.IsStableRelease, true) }}:
      parameters:
        IsStableRelease: true
  - template: release-bundles.yml
    parameters:
      CalculateChecksums: false