-
Notifications
You must be signed in to change notification settings - Fork 22
173 lines (156 loc) · 6.87 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
# 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:
## TODO: Re-enable once memory usage while reducing Agora is reduced
## Currently it takes 7GB+ which OOM on the CI.
## See https://github.com/ldc-developers/ldc/issues/3702
# os: [ ubuntu-20.04, macOS-11, windows-2019 ]
os: [ ubuntu-20.04, macOS-11]
dc: [ ldc-1.28.1 ]
# Define job-specific parameters
include:
# By default, don't generate artifacts nor run extra checks for push
- { artifacts: false, run_extra_checks: false }
# Only generate when the latest ldc is used
# IMPORTANT: Update this when the compiler support is changed!
- { dc: ldc-1.28.1, artifacts: true, run_extra_checks: true }
runs-on: ${{ matrix.os }}
timeout-minutes: 60
env:
TRACY_NO_INVARIANT_CHECK: 1
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 libsodium pkg-config
echo "LIBRARY_PATH=${LD_LIBRARY_PATH-}:/usr/local/lib/" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=/usr/local/opt/sqlite/lib/pkgconfig:/usr/local/opt/[email protected]/lib/pkgconfig/" >> $GITHUB_ENV
- name: '[Linux] Install dependencies & setup environment'
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install libsodium-dev libsqlite3-dev clang
- 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\
# Add whatever debugging information can be useful in the long run here
- name: Print system information
shell: bash
run: |
${DC} --version
dub --version
# GeoIP is required for one of the integration test
# We cache it via the cache action, and otherwise download it,
# but this requires a license key (which is a secret in the repository).
- name: 'Get the current date'
id: get-date
shell: bash
run: |
echo "::set-output name=date::$(/bin/date -u '+%Y%m')"
- name: 'Load GeoIP from cache'
id: cache-geoip
if: runner.os != 'Windows'
uses: actions/cache@v2
with:
path: ${{ github.workspace }}/build/geoip/
# Note: Cached data gets evicted after 7 days of being unused
# In order to avoid being stuck with a very old MMDB,
# we use the month as an index to the cache.
key: cache-geoip-${{ steps.get-date.outputs.date }}
- name: 'Download GeoIP database'
if: runner.os != 'Windows' && steps.cache-geoip.outputs.cache-hit != 'true'
env:
GEOIP_OUTPUT_DIR: ${{ github.workspace }}/build/geoip/
run: |
mkdir ${GEOIP_OUTPUT_DIR}
wget --no-verbose -O ${GEOIP_OUTPUT_DIR}/geoip.city.tar.gz 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=${{ secrets.GEOIP_SECRET }}&suffix=tar.gz'
tar -xzvf ${GEOIP_OUTPUT_DIR}/geoip.city.tar.gz --directory ${GEOIP_OUTPUT_DIR} --strip-components 1
# 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'
env:
LIB: ${{ github.workspace }}\lib\libsodium\x64\Release\v142\static\;${{ github.workspace }}\submodules\d2sqlite3\lib\win64\;$LIB
INCLUDE: ${{ github.workspace }}\lib\libsodium\include\;$INCLUDE
#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
- name: Test example configuration file
if: matrix.run_extra_checks && runner.os != 'Windows'
run: |
./build/agora -c doc/config.example.yaml --config-check
./build/agora -c devel/config-single.yaml --config-check
./build/agora -c devel/testnet/config.yaml --config-check
- name: Check vtable offset
if: matrix.run_extra_checks && runner.os != 'Windows'
env:
AGORA_VERSION: HEAD
run: ci/check_vtable_test.d
- name: 'Upload code coverage'
uses: codecov/codecov-action@v1
with:
flags: unittests
# 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/bosagora/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/