forked from requarks/wiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
158 lines (139 loc) · 4.64 KB
/
azure-pipelines.yml
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
name: 2.6.$(Rev:r)
trigger:
- dev
- latest
stages:
- stage: build
displayName: Build stage
jobs:
# -------------------------------
# BUILD - LINUX
# -------------------------------
- job: buildLinux
displayName: Linux Build
timeoutInMinutes: 60
cancelTimeoutInMinutes: 1
pool:
name: Azure Pipelines
vmImage: ubuntu-latest
steps:
- task: CmdLine@2
displayName: Disable dev flag
inputs:
script: |
sudo apt-get install jq -y
mv package.json pkg-temp.json
jq -r '.dev |= false' pkg-temp.json > package.json
rm pkg-temp.json
workingDirectory: '$(Build.SourcesDirectory)'
- task: CmdLine@2
displayName: Set Package Version
inputs:
script: |
mv package.json pkg-temp.json
jq -r '.version |= "$(Build.BuildNumber)"' pkg-temp.json > package.json
rm pkg-temp.json
cat package.json
workingDirectory: '$(Build.SourcesDirectory)'
- task: Docker@2
displayName: Build Docker image
inputs:
containerRegistry: Docker Hub
repository: requarks/wiki
Dockerfile: dev/build/Dockerfile
buildContext: '$(System.DefaultWorkingDirectory)'
tags: |
canary
canary-$(Build.BuildNumber)
addPipelineData: false
- task: CmdLine@2
displayName: Extract compiled files
inputs:
script: |
docker create --name wiki requarks/wiki:canary
docker cp wiki:/wiki $(Build.StagingDirectory)
docker rm wiki
rm $(Build.StagingDirectory)/wiki/config.yml
cp $(System.DefaultWorkingDirectory)/config.sample.yml $(Build.StagingDirectory)/wiki/config.sample.yml
find $(Build.StagingDirectory)/wiki/ -printf "%P\n" | tar -czf wiki-js.tar.gz --no-recursion -C $(Build.StagingDirectory)/wiki/ -T -
workingDirectory: '$(Build.SourcesDirectory)'
- task: PublishBuildArtifacts@1
displayName: Publish Build Artifacts
inputs:
PathtoPublish: 'wiki-js.tar.gz'
ArtifactName: 'drop'
# -------------------------------
# TESTS - CYPRESS E2E TESTS
# -------------------------------
- job: testCypress
displayName: Cypress E2E Tests
dependsOn: buildLinux
strategy:
maxParallel: 5
matrix:
MariaDB:
MATRIXENV: mariadb
MySQL:
MATRIXENV: mysql
MSSQLServer:
MATRIXENV: mssql
PostgreSQL:
MATRIXENV: postgres
SQLite:
MATRIXENV: sqlite
timeoutInMinutes: 30
cancelTimeoutInMinutes: 1
pool:
name: Azure Pipelines
vmImage: ubuntu-latest
steps:
- task: Bash@3
displayName: Setup Environment
inputs:
targetType: filePath
filePath: './dev/cypress/ci-setup.sh'
workingDirectory: '$(Build.SourcesDirectory)'
- script: |
docker run --name cypress --ipc=host --shm-size 1G -v $BUILD_SOURCESDIRECTORY:/e2e -w /e2e cypress/included:4.9.0 --record --key "$(CYPRESS_KEY)" --headless --group "$MATRIXENV" --ci-build-id "$BUILD_BUILDNUMBER" --config baseUrl=http://172.17.0.1:3000
displayName: 'Run Tests'
# -------------------------------
# BUILD - WINDOWS
# -------------------------------
- job: buildWindows
displayName: Windows Build
dependsOn: buildLinux
pool:
name: Azure Pipelines
vmImage: windows-latest
timeoutInMinutes: 30
cancelTimeoutInMinutes: 1
steps:
- task: NodeTool@0
displayName: 'Use Node 14.x'
inputs:
versionSpec: 14.x
- task: 'geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@3'
displayName: 'Use Yarn 1.x'
- task: DownloadBuildArtifacts@0
displayName: 'Download Build Artifacts'
inputs:
artifactName: drop
- script: |
mkdir -p $(Build.SourcesDirectory)\win
tar -xzf $(System.ArtifactsDirectory)\drop\wiki-js.tar.gz -C $(Build.SourcesDirectory)\win --exclude=node_modules
displayName: 'Extract build'
- script: 'yarn --production --frozen-lockfile --non-interactive'
workingDirectory: win
displayName: 'Install dependencies'
- task: ArchiveFiles@2
displayName: 'Archive app'
inputs:
rootFolderOrFile: '$(System.DefaultWorkingDirectory)\win'
includeRootFolder: false
archiveType: tar
archiveFile: 'wiki-js-windows.tar.gz'
- task: PublishBuildArtifacts@1
displayName: Publish Build Artifacts
inputs:
PathtoPublish: 'wiki-js-windows.tar.gz'
ArtifactName: 'drop-win'