Skip to content

Commit df91547

Browse files
authored
chore: removed travis yml and added git action support (#454)
1 parent 193cc00 commit df91547

16 files changed

+366
-210
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Reusable action of Integration tests
2+
3+
on:
4+
workflow_call:
5+
secrets:
6+
CI_USER_TOKEN:
7+
required: true
8+
TRAVIS_COM_TOKEN:
9+
required: true
10+
11+
jobs:
12+
integration_tests:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
with:
17+
# You should create a personal access token and store it in your repository
18+
token: ${{ secrets.CI_USER_TOKEN }}
19+
repository: 'optimizely/travisci-tools'
20+
path: 'home/runner/travisci-tools'
21+
ref: 'master'
22+
- name: set SDK Branch if PR
23+
if: ${{ github.event_name == 'pull_request' }}
24+
run: |
25+
echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
26+
- name: set SDK Branch if not pull request
27+
if: ${{ github.event_name != 'pull_request' }}
28+
run: |
29+
echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
30+
echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
31+
- name: Trigger build
32+
env:
33+
SDK: swift
34+
TESTAPP_TAG: master
35+
BUILD_NUMBER: ${{ github.run_id }}
36+
TESTAPP_BRANCH: master
37+
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
38+
TRAVIS_EVENT_TYPE: ${{ github.event_name }}
39+
TRAVIS_REPO_SLUG: ${{ github.repository }}
40+
TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }}
41+
UPSTREAM_REPO: ${{ github.repository }}
42+
TRAVIS_COMMIT: ${{ github.sha }}
43+
TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }}
44+
TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }}
45+
UPSTREAM_SHA: ${{ github.sha }}
46+
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
47+
EVENT_MESSAGE: ${{ github.event.message }}
48+
HOME: 'home/runner'
49+
run: |
50+
home/runner/travisci-tools/trigger-script-with-status-update.sh

.github/workflows/lint_markdown.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Reusable action of linting markdown files
2+
3+
on: [workflow_call]
4+
5+
jobs:
6+
lint_markdown:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v3
10+
- name: Set up Ruby
11+
uses: ruby/setup-ruby@v1
12+
with:
13+
ruby-version: '2.6'
14+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
15+
- name: Install gem and Run tests
16+
run: |
17+
cd ../../
18+
gem install awesome_bot
19+
find . -type f -name '*.md' -exec awesome_bot {} \;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Source clear
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
schedule:
7+
# Runs "weekly"
8+
- cron: '0 0 * * 0'
9+
10+
jobs:
11+
source_clear:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
- name: Source clear scan
16+
env:
17+
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
18+
run: curl -sSL https://download.sourceclear.com/ci.sh | bash -s - scan

.github/workflows/swift.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Swift
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
workflow_dispatch:
9+
inputs:
10+
PREP:
11+
required: false
12+
type: boolean
13+
description: prepare to release
14+
RELEASE:
15+
required: false
16+
type: boolean
17+
description: release
18+
19+
env:
20+
VERSION: 3.10.1
21+
22+
jobs:
23+
24+
lint_markdown_files:
25+
uses: optimizely/swift-sdk/.github/workflows/lint_markdown.yml@yasir/gitAction
26+
27+
integration_tests:
28+
if: "${{ github.event.inputs.PREP == '' && github.event.inputs.RELEASE == '' }}"
29+
uses: optimizely/swift-sdk/.github/workflows/integration_tests.yml@yasir/gitAction
30+
secrets:
31+
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
32+
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
33+
34+
lint:
35+
runs-on: macos-latest
36+
steps:
37+
- uses: actions/checkout@v3
38+
- uses: maxim-lobanov/setup-xcode@v1
39+
with:
40+
xcode-version: '12.4'
41+
- env:
42+
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
43+
run: |
44+
gem install cocoapods -v '1.9.3'
45+
pod spec lint --quick
46+
curl -sSL https://download.sourceclear.com/ci.sh | bash
47+
48+
unittests:
49+
if: "${{ github.event.inputs.PREP == '' && github.event.inputs.RELEASE == '' }}"
50+
uses: optimizely/swift-sdk/.github/workflows/unit_tests.yml@yasir/gitAction
51+
52+
prepare_for_release:
53+
runs-on: macos-latest
54+
if: "${{ github.event.inputs.PREP == 'true' && github.event_name == 'workflow_dispatch' }}"
55+
steps:
56+
- uses: actions/checkout@v3
57+
- uses: maxim-lobanov/setup-xcode@v1
58+
with:
59+
xcode-version: '12.4'
60+
- id: prepare_for_release
61+
name: Prepare for release
62+
env:
63+
HOME: 'home/runner'
64+
REPO_SLUG: ${{ github.repository }}
65+
BRANCH: ${{ github.ref_name }}
66+
GITHUB_USER: optibot
67+
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
68+
run: |
69+
gem install cocoapods -v '1.9.3'
70+
Scripts/run_prep.sh
71+
- name: Check prepare for release failure
72+
if: steps.prepare_for_release.conclusion == 'failure'
73+
run: cat /tmp/build.out
74+
75+
release:
76+
if: "${{github.event.inputs.RELEASE == 'true' && github.event_name == 'workflow_dispatch' }}"
77+
runs-on: macos-latest
78+
steps:
79+
- uses: actions/checkout@v3
80+
- uses: maxim-lobanov/setup-xcode@v1
81+
with:
82+
xcode-version: '12.4'
83+
- name: Push to cocoapods.org
84+
env:
85+
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
86+
BRANCH: ${{ github.ref_name }}
87+
run: |
88+
gem install cocoapods -v '1.9.3'
89+
Scripts/run_release.sh

.github/workflows/unit_tests.yml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Reusable action of Unit tests
2+
3+
on: [workflow_call]
4+
5+
env:
6+
COVERAGE_DIR: ./COVERAGE
7+
8+
jobs:
9+
unittests:
10+
runs-on: macos-10.15
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
include:
15+
- os: 14.4
16+
device: "iPhone 11"
17+
scheme: "OptimizelySwiftSDK-iOS"
18+
test_sdk: "iphonesimulator"
19+
platform: "iOS Simulator"
20+
os_type: "iOS"
21+
simulator_xcode_version: 12.4
22+
- os: 13.3
23+
device: "iPhone 8"
24+
scheme: "OptimizelySwiftSDK-iOS"
25+
test_sdk: "iphonesimulator"
26+
platform: "iOS Simulator"
27+
os_type: "iOS"
28+
simulator_xcode_version: 11.3.1
29+
- os: 12.4
30+
device: "iPad Air"
31+
scheme: "OptimizelySwiftSDK-iOS"
32+
test_sdk: "iphonesimulator"
33+
platform: "iOS Simulator"
34+
os_type: "iOS"
35+
simulator_xcode_version: 10.3
36+
- os: 12.4
37+
device: "Apple TV 4K"
38+
scheme: "OptimizelySwiftSDK-tvOS"
39+
test_sdk: "appletvsimulator"
40+
platform: "tvOS Simulator"
41+
os_type: "tvOS"
42+
simulator_xcode_version: 10.3
43+
steps:
44+
- uses: actions/checkout@v3
45+
- uses: maxim-lobanov/setup-xcode@v1
46+
with:
47+
xcode-version: 12.4
48+
- name: set SDK Branch if PR
49+
if: ${{ github.event_name == 'pull_request' }}
50+
run: |
51+
echo "BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV
52+
- name: set SDK Branch if not pull request
53+
if: ${{ github.event_name != 'pull_request' }}
54+
run: |
55+
echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
56+
- id: unit_tests
57+
env:
58+
SCHEME: ${{ matrix.scheme }}
59+
TEST_SDK: ${{ matrix.test_sdk }}
60+
PLATFORM: ${{ matrix.platform }}
61+
OS: ${{ matrix.os }}
62+
OS_TYPE: ${{ matrix.os_type }}
63+
SIMULATOR_XCODE_VERSION: ${{ matrix.simulator_xcode_version }}
64+
NAME: ${{ matrix.device }}
65+
run: |
66+
gem install coveralls-lcov
67+
gem install cocoapods -v '1.9.3'
68+
pod repo update
69+
pod install
70+
HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq
71+
Scripts/prepare_simulator.sh
72+
Scripts/run_unit_tests.sh
73+
- name: Check on failures (Archive Test Results)
74+
uses: actions/upload-artifact@v3
75+
if: steps.unit_tests.outcome != 'success'
76+
with:
77+
name: build-logs-${{ matrix.device }}-${{ matrix.os }}
78+
path: build/Logs
79+
- # - report coverage for PR and iPhone 11 only (avoid redundant ones)
80+
# - use Xcode12.4+ (older Xcode reports a wrong number)
81+
name: Check on success
82+
id: coveralls
83+
if: ${{ steps.unit_tests.outcome == 'success' && env.BRANCH == 'master' && env.PLATFORM == 'iOS Simulator' && env.NAME == 'iPhone 11' }}
84+
env:
85+
PLATFORM: ${{ matrix.platform }}
86+
NAME: ${{ matrix.device }}
87+
run: |
88+
Scripts/prepare_coveralls_report.sh
89+
sleep 5
90+
- name: Upload coveralls report
91+
if: steps.coveralls.outcome == 'success'
92+
uses: coverallsapp/github-action@master
93+
with:
94+
github-token: ${{ secrets.GITHUB_TOKEN }}
95+
path-to-lcov: ./xccov2lcov/lcov.info

0 commit comments

Comments
 (0)