forked from RealDeviceMap/RealDeviceMap
-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (51 loc) · 2.07 KB
/
Copy pathswift.yml
File metadata and controls
53 lines (51 loc) · 2.07 KB
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
name: Swift
on: [push, pull_request]
jobs:
Test:
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@v2
- uses: YOCKOW/Action-setup-swift@master
- name: Install Requirements
run: sudo apt-get update && sudo apt-get install -y libssl-dev libcurl4-openssl-dev libmysqlclient-dev uuid-dev imagemagick mysql-client-5.7 && sudo sed -i -e 's/-fabi-version=2 -fno-omit-frame-pointer//g' /usr/lib/x86_64-linux-gnu/pkgconfig/mysqlclient.pc && sudo cp /usr/bin/convert /usr/local/bin
- name: Resolve
run: swift package resolve
- uses: actions/cache@v1
with:
path: .build
key: ${{ runner.os }}-debug-5-spm-${{ hashFiles('Package.resolved') }}
- name: Build
run: swift build --enable-test-discovery -Xswiftc -g -c debug
- name: Test
run: swift test --enable-test-discovery -Xswiftc -g -c debug
Deploy:
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@v2
- name: Set .gitsha
if: github.event_name == 'push'
run: "echo ${{github.sha}} > .gitsha"
- name: Set .gitref
if: github.event_name == 'push'
run: "echo ${{github.ref}} > .gitref"
- name: Publish
uses: 123FLO321/github-docker-temp@0.5.0
if: github.event_name == 'push'
with:
accessToken: ${{ secrets.GITHUB_TOKEN }}
- name: Start MR Build System
if: github.event_name == 'pull_request'
run: 'curl https://build.realdevicemap.com/workflow/build -X POST -H "Content-Type: application/json" -d "{\"ref\":\"${{github.ref}}\",\"sha\":\"${{github.sha}}\",\"swift_version\":\"5\"}" --fail'
- name: Wait for MR Build System
if: github.event_name == 'pull_request'
run: |
while true; do
status=$(curl https://build.realdevicemap.com/workflow/status -X POST -H "Content-Type: application/json" -d '{"ref":"${{github.ref}}","sha":"${{github.sha}}","swift_version":"5"}' --fail -s)
if [[ $status == "failed" ]]; then
exit 1
fi
if [[ $status == "success" ]]; then
exit 0
fi
sleep 5
done