Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: removed travis yml and added git action support #454

Merged
merged 83 commits into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from 79 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
8ad3ace
Initial commit
yasirfolio3 Apr 13, 2022
0671c23
Work in progress.
yasirfolio3 Apr 13, 2022
ba4bc67
WIP.
yasirfolio3 Apr 13, 2022
f938fea
Implementing git action.
yasirfolio3 Apr 14, 2022
2589339
fixes.
yasirfolio3 Apr 14, 2022
62d7d3f
fixes.
yasirfolio3 Apr 14, 2022
cfc07ba
fixes.
yasirfolio3 Apr 14, 2022
f0f47f3
fixes.
yasirfolio3 Apr 14, 2022
fe68edf
fixes.
yasirfolio3 Apr 14, 2022
37cd6a9
fixes.
yasirfolio3 Apr 14, 2022
5525d2a
fixes.
yasirfolio3 Apr 14, 2022
ea18040
fixes.
yasirfolio3 Apr 14, 2022
bf81c48
fixes
yasirfolio3 Apr 14, 2022
35cfa3a
fixes
yasirfolio3 Apr 14, 2022
d199827
fixes.
yasirfolio3 Apr 14, 2022
640a68b
fixes
yasirfolio3 Apr 14, 2022
41bd868
fixes
yasirfolio3 Apr 14, 2022
6b8a79a
fixes.
yasirfolio3 Apr 14, 2022
c9e5de6
fixes
yasirfolio3 Apr 14, 2022
17f3db7
fixes
yasirfolio3 Apr 14, 2022
3855e80
fixes
yasirfolio3 Apr 14, 2022
7b7ba15
fixes
yasirfolio3 Apr 14, 2022
e1d6175
fixes
yasirfolio3 Apr 14, 2022
8d6642d
checking directory structure.
yasirfolio3 Apr 14, 2022
1d75400
fixes.
yasirfolio3 Apr 14, 2022
c956ea5
fixes
yasirfolio3 Apr 14, 2022
5963aaf
fixes.
yasirfolio3 Apr 14, 2022
4bc52fd
fixes
yasirfolio3 Apr 14, 2022
4eb2a51
fixes.
yasirfolio3 Apr 15, 2022
c9d29a6
fixes.
yasirfolio3 Apr 15, 2022
39731d9
fixes
yasirfolio3 Apr 15, 2022
5dc1a0a
fixes.
yasirfolio3 Apr 15, 2022
70977ca
fixes.
yasirfolio3 Apr 15, 2022
c027a16
fixes.
yasirfolio3 Apr 15, 2022
9ff845e
testing.
yasirfolio3 Apr 15, 2022
b7cc912
fixes.
yasirfolio3 Apr 15, 2022
8a5af17
fixes.
yasirfolio3 Apr 15, 2022
286781b
fixes.
yasirfolio3 Apr 15, 2022
3f4156f
fixes.
yasirfolio3 Apr 15, 2022
30de938
fixes.
yasirfolio3 Apr 15, 2022
62ee6a0
fixes.
yasirfolio3 Apr 15, 2022
c26f22d
cleanup.
yasirfolio3 Apr 15, 2022
e2cc6d9
cleanup.
yasirfolio3 Apr 15, 2022
fff7e6f
clean up.
yasirfolio3 Apr 15, 2022
3dbfac6
fixes.
yasirfolio3 Apr 15, 2022
79bba9d
fixes.
yasirfolio3 Apr 15, 2022
50250d4
fixing.
yasirfolio3 Apr 18, 2022
1082cd6
fixes.
yasirfolio3 Apr 18, 2022
6cdda21
fixes.
yasirfolio3 Apr 18, 2022
a5cbf0e
testing.
yasirfolio3 Apr 18, 2022
d4f6e5b
testing
yasirfolio3 Apr 18, 2022
de0a23b
testing.
yasirfolio3 Apr 18, 2022
f5a6cff
testing.
yasirfolio3 Apr 18, 2022
ef4a3ab
fixes.
yasirfolio3 Apr 18, 2022
1cb7504
testing.
yasirfolio3 Apr 18, 2022
c452932
fixes
yasirfolio3 Apr 18, 2022
b9739f7
fixes.
yasirfolio3 Apr 18, 2022
f3eabe7
fixes
yasirfolio3 Apr 18, 2022
c16d6e6
fixes
yasirfolio3 Apr 18, 2022
14d7973
fixes.
yasirfolio3 Apr 18, 2022
86c6b88
fixes.
yasirfolio3 Apr 18, 2022
0fdf4c5
fixes
yasirfolio3 Apr 18, 2022
3b3e157
fixes.
yasirfolio3 Apr 18, 2022
8b0cd39
debug.
yasirfolio3 Apr 18, 2022
1ffdada
fixes.
yasirfolio3 Apr 18, 2022
76f75ad
testing.
yasirfolio3 Apr 18, 2022
c53ba93
fixes.
yasirfolio3 Apr 18, 2022
49c1fd8
testing.
yasirfolio3 Apr 18, 2022
8cfa448
testing.
yasirfolio3 Apr 18, 2022
2c8415c
fixes
yasirfolio3 Apr 19, 2022
b6a9634
cleanup.
yasirfolio3 Apr 19, 2022
39b7edd
Suggested changes made.
yasirfolio3 Apr 20, 2022
f0e90c6
fix coveralls.
yasirfolio3 Apr 20, 2022
c97248d
Testing coveralls.
yasirfolio3 Apr 21, 2022
1915d01
testing coveralls.
yasirfolio3 Apr 21, 2022
12c43c4
nits fixed.
yasirfolio3 Apr 21, 2022
fb5acbc
fixes.
yasirfolio3 Apr 21, 2022
ada51b2
fixes.
yasirfolio3 Apr 21, 2022
2648b0f
fixes
yasirfolio3 Apr 21, 2022
97f59b3
suggested changes made.
yasirfolio3 Apr 25, 2022
2adb67c
fixing env issues
yasirfolio3 Apr 25, 2022
baccced
fixing env issues
yasirfolio3 Apr 25, 2022
6b83858
suggested changes made.
yasirfolio3 Apr 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Reusable action of Integration tests

on:
workflow_call:
secrets:
CI_USER_TOKEN:
required: true
TRAVIS_COM_TOKEN:
required: true

jobs:
integration_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# You should create a personal access token and store it in your repository
token: ${{ secrets.CI_USER_TOKEN }}
repository: 'optimizely/travisci-tools'
path: 'home/runner/travisci-tools'
ref: 'master'
- name: set SDK Branch if PR
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this line do?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of pull request, it exports the PR branch name to github env variables as SDK_BRANCH. This is required by travisci-tools/trigger-script-with-status-update.sh

echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV
- name: set SDK Branch if not pull request
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
Comment on lines +29 to +30
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these variables doesn't seem correct to set with refname.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ref_name has the The branch or tag name that triggered the workflow run. as per the official documentation, in case build was not triggered by pull request. This is required by travisci-tools/trigger-script-with-status-update.sh.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove it, we don't have any relation with the current repo to trigger-script-with-status-update.sh

- name: Trigger build
env:
SDK: swift
TESTAPP_TAG: master
BUILD_NUMBER: ${{ github.run_id }}
TESTAPP_BRANCH: master
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
TRAVIS_EVENT_TYPE: ${{ github.event_name }}
TRAVIS_REPO_SLUG: ${{ github.repository }}
TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }}
UPSTREAM_REPO: ${{ github.repository }}
TRAVIS_COMMIT: ${{ github.sha }}
TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }}
TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }}
UPSTREAM_SHA: ${{ github.sha }}
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
EVENT_MESSAGE: ${{ github.event.message }}
HOME: 'home/runner'
run: |
home/runner/travisci-tools/trigger-script-with-status-update.sh
19 changes: 19 additions & 0 deletions .github/workflows/lint_markdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Reusable action of linting markdown files

on: [workflow_call]

jobs:
lint_markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.6'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Install gem and Run tests
run: |
cd ../../
gem install awesome_bot
find . -type f -name '*.md' -exec awesome_bot {} \;
31 changes: 31 additions & 0 deletions .github/workflows/prepare_for_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Reusable action of Release preparation

on:
workflow_call:
secrets:
CI_USER_TOKEN:
required: true

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like these "prepare_for_release" is redundant with one in "swift.yml". I think we can keep this and clean up the other.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The one in swift.yml is just calling this one, it has no other purpose.

jobs:
prepare_for_release:
runs-on: macos-latest
steps:
- uses: maxim-lobanov/setup-xcode@v1
- uses: actions/checkout@v3
with:
xcode-version: '12.4'
- id: prepare_for_release
name: Prepare for release
env:
VERSION: 3.10.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value (SDK release version) should be passed as a parameter from the top level

Copy link
Contributor Author

@yasirfolio3 yasirfolio3 Apr 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I looked into it and have tried to make it a global env. For using reusable_workflows, we cannot pass env variables to them. Because of this, version is declared twice in swift.yml.

HOME: 'home/runner'
TRAVIS_REPO_SLUG: ${{ github.repository }}
TRAVIS_BRANCH: ${{ github.ref_name }}
GITHUB_USER: optibot
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
run: |
gem install cocoapods -v '1.9.3'
Scripts/run_prep.sh
- name: Check prepare for release failure
if: steps.prepare_for_release.conclusion == 'failure'
run: cat /tmp/build.out
18 changes: 18 additions & 0 deletions .github/workflows/source_clear_cron.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Source clear

on:
push:
branches: [ master ]
schedule:
# Runs "weekly"
- cron: '0 0 * * 0'

jobs:
source_clear:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Source clear scan
env:
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
run: curl -sSL https://download.sourceclear.com/ci.sh | bash -s - scan
70 changes: 70 additions & 0 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Swift

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
inputs:
PREP:
required: false
type: boolean
description: prepare to release
RELEASE:
required: false
type: boolean
description: release

jobs:

lint_markdown_files:
uses: optimizely/swift-sdk/.github/workflows/lint_markdown.yml@yasir/gitAction

integration_tests:
if: "${{ github.event.inputs.PREP == '' && github.event.inputs.RELEASE == '' }}"
uses: optimizely/swift-sdk/.github/workflows/integration_tests.yml@yasir/gitAction
secrets:
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}

lint:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '12.4'
- env:
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
run: |
gem install cocoapods -v '1.9.3'
pod spec lint --quick
curl -sSL https://download.sourceclear.com/ci.sh | bash

unittests:
if: "${{ github.event.inputs.PREP == '' && github.event.inputs.RELEASE == '' }}"
uses: optimizely/swift-sdk/.github/workflows/unit_tests.yml@yasir/gitAction

prepare_for_release:
if: "${{ github.event.inputs.PREP == 'true' && github.event_name == 'workflow_dispatch' }}"
uses: optimizely/swift-sdk/.github/workflows/prepare_for_release.yml@yasir/gitAction
secrets:
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}

release:
if: "${{github.event.inputs.RELEASE == 'true' && github.event_name == 'workflow_dispatch' }}"
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '12.4'
- name: Push to cocoapods.org
env:
VERSION: 3.10.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This SDK version may be confusing - one for "prepare-for-release" is defined in the workflow-call and the same for "release" is defined in this top level.
It'll be great if we can find a way to share a single variable at the top level and pass it to "prepare-for-release" as a parameter.

GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
TRAVIS_BRANCH: ${{ github.ref_name }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still use "TRAVIS" in the names? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed all env variables with previs TRAVIS_ leaving only those which are required by trigger-script-with-status-update script of travis-ci-tools.

run: |
gem install cocoapods -v '1.9.3'
Scripts/run_release.sh
94 changes: 94 additions & 0 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Reusable action of Unit tests

on: [workflow_call]

jobs:
unittests:
runs-on: macos-10.15
strategy:
fail-fast: false
matrix:
include:
- os: 14.4
device: "iPhone 11"
scheme: "OptimizelySwiftSDK-iOS"
test_sdk: "iphonesimulator"
platform: "iOS Simulator"
os_type: "iOS"
simulator_xcode_version: 12.4
- os: 13.3
device: "iPhone 8"
scheme: "OptimizelySwiftSDK-iOS"
test_sdk: "iphonesimulator"
platform: "iOS Simulator"
os_type: "iOS"
simulator_xcode_version: 11.3.1
- os: 12.4
device: "iPad Air"
scheme: "OptimizelySwiftSDK-iOS"
test_sdk: "iphonesimulator"
platform: "iOS Simulator"
os_type: "iOS"
simulator_xcode_version: 10.3
- os: 12.4
device: "Apple TV 4K"
scheme: "OptimizelySwiftSDK-tvOS"
test_sdk: "appletvsimulator"
platform: "tvOS Simulator"
os_type: "tvOS"
simulator_xcode_version: 10.3
steps:
- uses: actions/checkout@v3
- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 12.4
- name: set SDK Branch if PR
if: ${{ github.event_name == 'pull_request' }}
run: |
echo "TRAVIS_BRANCH=${{ github.base_ref }}" >> $GITHUB_ENV
- name: set SDK Branch if not pull request
if: ${{ github.event_name != 'pull_request' }}
run: |
echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
- id: unit_tests
env:
COVERAGE_DIR: ./COVERAGE
SCHEME: ${{ matrix.scheme }}
TEST_SDK: ${{ matrix.test_sdk }}
PLATFORM: ${{ matrix.platform }}
OS: ${{ matrix.os }}
OS_TYPE: ${{ matrix.os_type }}
SIMULATOR_XCODE_VERSION: ${{ matrix.simulator_xcode_version }}
NAME: ${{ matrix.device }}
run: |
gem install coveralls-lcov
gem install cocoapods -v '1.9.3'
pod repo update
pod install
HOMEBREW_NO_INSTALL_CLEANUP=true brew update && brew install jq
Scripts/prepare_simulator.sh
Scripts/run_unit_tests.sh
- name: Check on failures
if: steps.unit_tests.outcome != 'success'
run: |
sudo curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash
artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/xcodebuild_logs" $(find /Users/travis/Library/Developer/Xcode/ -name *.xcresult -o -name *.log)
artifacts upload --target-paths "/${TRAVIS_REPO_SLUG}/${TRAVIS_BUILD_NUMBER}/${TRAVIS_JOB_NUMBER}/buildoutput" "$TRAVIS_BUILD_DIR/buildoutput"
- # - report coverage for PR and iPhone 11 only (avoid redundant ones)
# - use Xcode12.4+ (older Xcode reports a wrong number)
name: Check on success
id: coveralls
if: ${{ steps.unit_tests.outcome == 'success' && env.TRAVIS_BRANCH == 'master' && env.PLATFORM == 'iOS Simulator' && env.NAME == 'iPhone 11' }}
env:
COVERAGE_DIR: ./COVERAGE
PLATFORM: ${{ matrix.platform }}
NAME: ${{ matrix.device }}
run: |
Scripts/prepare_coveralls_report.sh
sleep 5
- name: Upload coveralls report
if: steps.coveralls.outcome == 'success'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./xccov2lcov/lcov.info
Loading