-
Notifications
You must be signed in to change notification settings - Fork 22
187 lines (168 loc) · 7.02 KB
/
main.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
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
# Github worflow to test Agora on a variety of platforms
#
# Also uploads the documentation to Github pages.
#
# Note:
# - Try to use the native Github action syntax (${{ expression }}) when possible,
# as they are substituted with their value in the logs, unlike env variable.
# For example use `${{ github.workspace }}` over `${GITHUB_WORKSPACE}`
name: CI
on: [push, pull_request]
jobs:
main:
name: Run
# The configuration matrix: We define all possible combinations here,
# then add excludes for things we don't want to test,
# and include to specify job-specific data.
strategy:
# Disable `fail-fast` because we want the whole test suite to run even if one
# of the nigthly is broken
fail-fast: false
matrix:
os: [ ubuntu-18.04, macOS-10.15, windows-2019 ]
dc: [ ldc-master, ldc-1.22.0, ldc-1.21.0 ]
# Define job-specific parameters
include:
# By default, don't generate artifacts for push
- { artifacts: false }
# Only generate when `ldc-1.21.0` is used
# IMPORTANT: Update this when the compiler support is changed!
- { dc: ldc-1.22.0, artifacts: true }
runs-on: ${{ matrix.os }}
timeout-minutes: 30
steps:
# Checkout this repository and its submodules
- uses: actions/checkout@v2
with:
submodules: true
persist-credentials: false
# Install the D compiler
- name: Prepare compiler
uses: dlang-community/setup-dlang@v1
with:
compiler: ${{ matrix.dc }}
# Install os-specific packages
# Those will show up in the list of steps, but be grayed out,
# hence the usage of the `[OSX]` tag
- name: '[OSX] Install dependencies & setup environment'
if: runner.os == 'macOS'
run: |
brew install coreutils pkg-config
./ci/ci_osx_setup.sh
echo ::set-env name=LIBRARY_PATH::${LD_LIBRARY_PATH-}:/usr/local/lib/
echo ::set-env name=PKG_CONFIG_PATH::/usr/local/opt/sqlite/lib/pkgconfig:/usr/local/opt/openssl@1.1/lib/pkgconfig/
- name: '[Linux] Install dependencies & setup environment'
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libsqlite3-dev
sudo apt-get install libsodium-dev
sudo apt-get install g++-9
- name: '[Windows] Install dependencies & setup environment'
if: runner.os == 'Windows'
shell: powershell
run: |
$url = "https://github.com/jedisct1/libsodium/releases/download/1.0.18-RELEASE/libsodium-1.0.18-msvc.zip"
$sha256hash = "C1D48D85C9361E350931FFE5067559CD7405A697C655D26955FB568D1084A5F4"
Write-Host ('Downloading {0} ...' -f $url)
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
# See https://github.com/PowerShell/PowerShell/issues/2138
$ProgressPreference = 'SilentlyContinue'
New-Item -ItemType directory -Path ${{ github.workspace }}\lib\
Invoke-WebRequest -Uri $url -OutFile '${{ github.workspace }}\lib\libsodium.zip'
if ((Get-FileHash '${{ github.workspace }}\lib\libsodium.zip' -Algorithm "SHA256").Hash -ne $sha256hash) {
exit 1
}
Expand-Archive '${{ github.workspace }}\lib\libsodium.zip' -DestinationPath ${{ github.workspace }}\lib\
echo "::set-env name=LIB::${{ github.workspace }}\lib\libsodium\x64\Release\v142\static\;${{ github.workspace }}\submodules\d2sqlite3\lib\win64\;$LIB"
echo "::set-env name=INCLUDE::${{ github.workspace }}\lib\libsodium\include\;$INCLUDE"
# Add whatever debugging information can be useful in the long run here
- name: Print system information
shell: bash
run: |
${DC} --version
dub --version
# Build and run the tests
- name: '[POSIX] Build & test Agora'
if: runner.os != 'Windows'
#continue-on-error: matrix.dc == 'ldc-master'
run: ./ci/run.sh
- name: '[Windows] Build & test Agora'
if: runner.os == 'Windows'
#continue-on-error: matrix.dc == 'ldc-master'
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
call ci\run.bat
# Finally, upload the artifacts
#
# For push event, we need to select which compiler to use
# This is defined in the build matrix so the condition here
# doesn't have to be edited.
#
# We used to upload artifacts for all pull request events as well,
# but it provide to be too flakey and would often lead to spurious
# failures. See https://github.com/bpfkorea/agora/issues/882
- name: 'Upload build artifacts'
if: github.event_name == 'push' && matrix.artifacts
uses: actions/upload-artifact@v2
with:
name: agora-${{ matrix.os }}
path: build/
# Documentation build: Only runs on Linux
# Still need to install dependencies and the compiler because DDOX
# does a full build
doc:
name: Build and upload documentation
needs: main
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
# Checkout this repository and its submodules
- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: true
# Install the D compiler
- name: Prepare compiler
uses: dlang-community/setup-dlang@v1
with:
compiler: ldc-latest
- name: 'Install dependencies & setup environment'
run: |
sudo apt-get update
sudo apt-get install libsqlite3-dev
sudo apt-get install libsodium-dev
sudo apt-get install g++-9
- name: Build documentation
run: |
dub build -b ddox
# Filter out libraries
# `x:ddocFilterArgs` in `dub.json` does not seem to work,
# so we do it manually
jq '[ .[] | select(.file|startswith("source/")) ]' docs.json > docs.filtered.json
# Generate the HTML to docs
dub run ddox -- generate-html docs.filtered.json ./docs/
- name: Upload documentation artifact
uses: actions/upload-artifact@v2
with:
name: documentation
path: docs/
- name: Deploy documentation
if: github.event_name == 'push'
run: |
# Remove gh-branch if it already exists, check it out
git branch -D gh-pages || true
git checkout --orphan gh-pages
# Remove all staged files - We only need the docs
git rm -rf $(git ls-files)
# We can have some leftover files (e.g. build)
# So add docs (which is only what we need), then `git mv` it.
git add docs/
git mv -k docs/* ./
# Configure user (because persist-credentials does not persist everything...)
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
# We're done
git commit -m "Documentation for commit ${{ github.sha }}"
git push -f ${{ github.event.repository.clone_url }} gh-pages:gh-pages