Skip to content

Commit

Permalink
Add slack notification
Browse files Browse the repository at this point in the history
  • Loading branch information
souzamari committed Nov 28, 2024
1 parent 3478306 commit eb7d1b6
Showing 1 changed file with 126 additions and 69 deletions.
195 changes: 126 additions & 69 deletions .github/workflows/ios-sdk-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,79 +7,136 @@ on:
- "v[0-9]+.[0-9]+.[0-9]+(-[a-zA-Z0-9]+)?"

jobs:
setup:
name: "Setup"
runs-on: macos-13
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Install ruby and gem dependencies
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0.7
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
# setup:
# name: "Setup"
# runs-on: macos-13
# steps:
# - name: Checkout Code
# uses: actions/checkout@v4
# - name: Install ruby and gem dependencies
# uses: ruby/setup-ruby@v1
# with:
# ruby-version: 3.0.7
# bundler-cache: true # runs 'bundle install' and caches installed gems automatically

sdk-tests:
name: "SDK Tests"
runs-on: macos-13
needs: [setup]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Bundle install
run: bundle install
- name: Run Tests
run: bundle exec fastlane tests
- name: Store Artifacts
uses: actions/upload-artifact@v4
with:
name: test-results
path: ./fastlane/test_output
# sdk-tests:
# name: "SDK Tests"
# runs-on: macos-13
# needs: [setup]
# steps:
# - name: Checkout Code
# uses: actions/checkout@v4
# - name: Bundle install
# run: bundle install
# - name: Run Tests
# run: bundle exec fastlane tests
# - name: Store Artifacts
# uses: actions/upload-artifact@v4
# with:
# name: test-results
# path: ./fastlane/test_output

build-demo-swift:
name: "Build Demo Swift"
runs-on: macos-14
needs: [setup, sdk-tests]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Bundle install
run: bundle install
- name: Build Demo Swift
id: build-demo-swift
run: bundle exec fastlane demo_swift
- name: Store Artifacts
uses: actions/upload-artifact@v4
with:
name: demo-swift
path: ./demo-ios-swift/Pods
- name: Store build log
uses: actions/upload-artifact@v4
with:
name: build-log-swift
path: /Users/runner/Library/Logs/gym
# build-demo-swift:
# name: "Build Demo Swift"
# runs-on: macos-14
# needs: [setup, sdk-tests]
# steps:
# - name: Checkout Code
# uses: actions/checkout@v4
# - name: Bundle install
# run: bundle install
# - name: Build Demo Swift
# id: build-demo-swift
# run: bundle exec fastlane demo_swift
# - name: Store Artifacts
# uses: actions/upload-artifact@v4
# with:
# name: demo-swift
# path: ./demo-ios-swift/Pods
# - name: Store build log
# uses: actions/upload-artifact@v4
# with:
# name: build-log-swift
# path: /Users/runner/Library/Logs/gym


build-demo-objc:
name: "Build Demo Objective-C"
runs-on: macos-14
env:
FL_OUTPUT_DIR: output
needs: [setup, sdk-tests]
# build-demo-objc:
# name: "Build Demo Objective-C"
# runs-on: macos-14
# env:
# FL_OUTPUT_DIR: output
# needs: [setup, sdk-tests]
# steps:
# - name: Checkout Code
# uses: actions/checkout@v4
# - name: Bundle install
# run: bundle install
# - name: Build Demo Objective-C
# run: bundle exec fastlane demo_objc
# - name: Store Artifacts
# uses: actions/upload-artifact@v4
# with:
# name: demo-objc
# path: ./demo-ios-objc/Pods
# - name: Store build log
# uses: actions/upload-artifact@v4
# with:
# name: build-log-objc
# path: /Users/runner/Library/Logs/gym

slack-notification:
runs-on: ubuntu-22.04
# needs: [build-demo-swift, build-demo-objc]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Bundle install
run: bundle install
- name: Build Demo Objective-C
run: bundle exec fastlane demo_objc
- name: Store Artifacts
uses: actions/upload-artifact@v4
- name: Successful Release Post to Slack
uses: slackapi/[email protected]
if: ${{ success() && (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) }}
with:
name: demo-objc
path: ./demo-ios-objc/Pods
- name: Store build log
uses: actions/upload-artifact@v4
method: chat.postMessage
token: "${{ secrets.SLACK_MESSENGER_APP_TOKEN }}"
payload: |
channel: "${{ secrets.ALERTS_SLACK_CHANNEL_ID }}"
text: "iOS SDK release: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
blocks:
- type: "header"
text:
type: "plain_text"
text: ":certified: iOS SDK release"
emoji: true
- type: "section"
fields:
- type: "mrkdwn"
text: "*Status:*\n${{ job.status }}"
- type: "mrkdwn"
text: "*Branch:*\n${{ github.ref_name }}"
- type: "mrkdwn"
text: "*Author:*\n${{ github.actor || github.triggering_actor }}"
- type: "mrkdwn"
text: ":white_check_mark: *iOS SDK release:*\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
- name: Build failure Post to Slack
uses: slackapi/[email protected]
# if: ${{ failure() && github.event_name == 'pull_request' }}
if: ${{ always()}}
with:
name: build-log-objc
path: /Users/runner/Library/Logs/gym
method: chat.postMessage
token: "${{ secrets.SLACK_MESSENGER_APP_TOKEN }}"
payload: |
channel: "${{ secrets.ALERTS_SLACK_CHANNEL_ID }}"
text: "iOS SDK release: ${{ job.status }}\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
blocks:
- type: "header"
text:
type: "plain_text"
text: ":certified: iOS SDK release"
emoji: true
- type: "section"
fields:
- type: "mrkdwn"
text: "*Status:*\n${{ job.status }}"
- type: "mrkdwn"
text: "*Branch:*\n${{ github.ref_name }}"
- type: "mrkdwn"
text: "*Author:*\n${{ github.actor || github.triggering_actor }}"
- type: "mrkdwn"
text: ":x: *iOS SDK release:*\n${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"

0 comments on commit eb7d1b6

Please sign in to comment.