Merge pull request #547 from RealDeviceMap/development #213
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
if: github.event_name == 'push' | |
with: | |
accessToken: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish Commit | |
uses: 123FLO321/[email protected] | |
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 | |