forked from RealDeviceMap/RealDeviceMap
-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (56 loc) · 2.13 KB
/
swift.yml
File metadata and controls
59 lines (56 loc) · 2.13 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
54
55
56
57
58
name: Swift
on: [push, pull_request]
jobs:
Test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: YOCKOW/Action-setup-swift@main
- name: Install Requirements
run: sudo apt-get -y update &&
sudo apt-get install -y libcurl4-openssl-dev libmysqlclient-dev &&
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
- 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-20.04
steps:
- uses: actions/checkout@v3
- 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 Version
uses: 123FLO321/github-docker-temp@0.5.0
if: github.event_name == 'push'
with:
accessToken: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Commit
uses: 123FLO321/github-docker-temp@0.5.0
if: github.event_name == 'push'
with:
imageTag: ${{ github.sha }}
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
sleep 5
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
done