Skip to content

Commit

Permalink
CAL-52: Deploy tests on GitHub
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jay-jay-lama authored Dec 3, 2023
1 parent 37974bb commit 87847c8
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 1 deletion.
60 changes: 60 additions & 0 deletions .github/workflows/Swift_Tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This workflow will build a Swift project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-swift

name: Swift

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: macos-latest

outputs:
STATUS: ${{ steps.set_status.outputs.STATUS }}

steps:
- run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
- uses: actions/checkout@v3

- name: Build project and run tests
run: xcodebuild test -quiet -scheme MijickCalendarView -destination 'platform=iOS Simulator,name=iPhone 13 Pro' -resultBundlePath TestResults

- name: Set env STATUS
if: always()
id: set_status
run: |
if [[ ${{ job.status }} == 'success' ]]; then
echo "STATUS=success" >> $GITHUB_OUTPUT
else
echo "STATUS=failure" >> $GITHUB_OUTPUT
fi
slackNotification:
name: Slack Notification
needs: build
if: always()
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set env ICON
run: |
if [[ ${{ needs.build.outputs.STATUS }} == 'success' ]]; then
echo "ICON=https://cdn-icons-png.flaticon.com/512/148/148767.png" >> $GITHUB_ENV
else
echo "ICON=https://cdn-icons-png.flaticon.com/512/4436/4436559.png" >> $GITHUB_ENV
fi
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_ICON: ${{ env.ICON }}
SLACK_COLOR: ${{ needs.build.outputs.STATUS }}
SLACK_TITLE: "Branch ${{ github.head_ref }}"
SLACK_MESSAGE: "Test status is ${{ needs.build.outputs.STATUS }}"
SLACK_WEBHOOK: "${{ secrets.SLACK_INCOMMING_WEBHOOK }}"
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version: 5.9
// swift-tools-version: 5.7
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
Expand Down

0 comments on commit 87847c8

Please sign in to comment.