-
Notifications
You must be signed in to change notification settings - Fork 30
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
Changes from 79 commits
8ad3ace
0671c23
ba4bc67
f938fea
2589339
62d7d3f
cfc07ba
f0f47f3
fe68edf
37cd6a9
5525d2a
ea18040
bf81c48
35cfa3a
d199827
640a68b
41bd868
6b8a79a
c9e5de6
17f3db7
3855e80
7b7ba15
e1d6175
8d6642d
1d75400
c956ea5
5963aaf
4bc52fd
4eb2a51
c9d29a6
39731d9
5dc1a0a
70977ca
c027a16
9ff845e
b7cc912
8a5af17
286781b
3f4156f
30de938
62ee6a0
c26f22d
e2cc6d9
fff7e6f
3dbfac6
79bba9d
50250d4
1082cd6
6cdda21
a5cbf0e
d4f6e5b
de0a23b
f5a6cff
ef4a3ab
1cb7504
c452932
b9739f7
f3eabe7
c16d6e6
14d7973
86c6b88
0fdf4c5
3b3e157
8b0cd39
1ffdada
76f75ad
c53ba93
49c1fd8
8cfa448
2c8415c
b6a9634
39b7edd
f0e90c6
c97248d
1915d01
12c43c4
fb5acbc
ada51b2
2648b0f
97f59b3
2adb67c
baccced
6b83858
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 | ||
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these variables doesn't seem correct to set with refname. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
- 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 |
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 {} \; |
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 | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The one in |
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
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 |
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 |
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} | ||
TRAVIS_BRANCH: ${{ github.ref_name }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we still use "TRAVIS" in the names? :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed all env variables with previs |
||
run: | | ||
gem install cocoapods -v '1.9.3' | ||
Scripts/run_release.sh |
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 bytravisci-tools/trigger-script-with-status-update.sh