Skip to content

Commit 87847c8

Browse files
authored
CAL-52: Deploy tests on GitHub
feat: - Added script to build and run test with github actions fix: - Updated package settings to make it possible to build project with github tools Ticket: https://mijick.atlassian.net/browse/CAL-52
1 parent 37974bb commit 87847c8

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

.github/workflows/Swift_Tests.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# This workflow will build a Swift project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift
3+
4+
name: Swift
5+
6+
on:
7+
push:
8+
branches: [ "main" ]
9+
pull_request:
10+
branches: [ "main" ]
11+
12+
jobs:
13+
build:
14+
runs-on: macos-latest
15+
16+
outputs:
17+
STATUS: ${{ steps.set_status.outputs.STATUS }}
18+
19+
steps:
20+
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
21+
- uses: actions/checkout@v3
22+
23+
- name: Build project and run tests
24+
run: xcodebuild test -quiet -scheme MijickCalendarView -destination 'platform=iOS Simulator,name=iPhone 13 Pro' -resultBundlePath TestResults
25+
26+
- name: Set env STATUS
27+
if: always()
28+
id: set_status
29+
run: |
30+
if [[ ${{ job.status }} == 'success' ]]; then
31+
echo "STATUS=success" >> $GITHUB_OUTPUT
32+
else
33+
echo "STATUS=failure" >> $GITHUB_OUTPUT
34+
fi
35+
36+
slackNotification:
37+
name: Slack Notification
38+
needs: build
39+
if: always()
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
- uses: actions/checkout@v2
44+
45+
- name: Set env ICON
46+
run: |
47+
if [[ ${{ needs.build.outputs.STATUS }} == 'success' ]]; then
48+
echo "ICON=https://cdn-icons-png.flaticon.com/512/148/148767.png" >> $GITHUB_ENV
49+
else
50+
echo "ICON=https://cdn-icons-png.flaticon.com/512/4436/4436559.png" >> $GITHUB_ENV
51+
fi
52+
53+
- name: Slack Notification
54+
uses: rtCamp/action-slack-notify@v2
55+
env:
56+
SLACK_ICON: ${{ env.ICON }}
57+
SLACK_COLOR: ${{ needs.build.outputs.STATUS }}
58+
SLACK_TITLE: "Branch ${{ github.head_ref }}"
59+
SLACK_MESSAGE: "Test status is ${{ needs.build.outputs.STATUS }}"
60+
SLACK_WEBHOOK: "${{ secrets.SLACK_INCOMMING_WEBHOOK }}"

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version: 5.9
1+
// swift-tools-version: 5.7
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription

0 commit comments

Comments
 (0)