Skip to content

Commit fc625f0

Browse files
authored
chore: removed travis yml and added git action support (#753)
- integrated git actions
1 parent e092f81 commit fc625f0

File tree

6 files changed

+222
-96
lines changed

6 files changed

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

.github/workflows/javascript.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Javascript
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
lint_markdown_files:
11+
uses: optimizely/javascript-sdk/.github/workflows/lint_markdown.yml@master
12+
13+
lint:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Set up Node
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: 12
21+
cache-dependency-path: packages/optimizely-sdk/package-lock.json
22+
cache: 'npm'
23+
- name: Run linting
24+
working-directory: ./packages/optimizely-sdk
25+
run: |
26+
npm install
27+
npm run lint
28+
29+
integration_tests:
30+
uses: optimizely/javascript-sdk/.github/workflows/integration_test.yml@master
31+
secrets:
32+
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
33+
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
34+
35+
fullstack_production_suite:
36+
uses: optimizely/javascript-sdk/.github/workflows/integration_test.yml@master
37+
with:
38+
FULLSTACK_TEST_REPO: ProdTesting
39+
secrets:
40+
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
41+
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
42+
43+
crossbrowser_and_umd_unit_tests:
44+
runs-on: ubuntu-latest
45+
env:
46+
BROWSER_STACK_USERNAME: ${{ secrets.BROWSERSTACK_USERNAME }}
47+
BROWSER_STACK_ACCESS_KEY: ${{ secrets.BROWSERSTACK_ACCESS_KEY }}
48+
steps:
49+
- uses: actions/checkout@v3
50+
- name: Move to package
51+
run: |
52+
cd packages/optimizely-sdk
53+
- name: Set up Node
54+
uses: actions/setup-node@v3
55+
with:
56+
node-version: 8
57+
cache: 'npm'
58+
cache-dependency-path: packages/optimizely-sdk/package-lock.json
59+
- name: Cross-browser and umd unit tests
60+
working-directory: ./packages/optimizely-sdk
61+
run: |
62+
npm install
63+
npm run test-ci
64+
65+
unit_tests:
66+
runs-on: ubuntu-latest
67+
strategy:
68+
matrix:
69+
node: [ '8', '9', '10', '12', '14' ]
70+
steps:
71+
- uses: actions/checkout@v3
72+
- name: Set up Node ${{ matrix.node }}
73+
uses: actions/setup-node@v3
74+
with:
75+
node-version: ${{ matrix.node }}
76+
cache: 'npm'
77+
cache-dependency-path: packages/optimizely-sdk/package-lock.json
78+
- name: Unit tests
79+
working-directory: ./packages/optimizely-sdk
80+
run: |
81+
npm install
82+
npm run coveralls
83+
- name: Coveralls Parallel
84+
uses: coverallsapp/github-action@master
85+
with:
86+
github-token: ${{ secrets.GITHUB_TOKEN }}
87+
path-to-lcov: ./packages/optimizely-sdk/coverage/lcov.info
88+
flag-name: run-${{ matrix.node }}
89+
# This is a parallel build so need this
90+
parallel: true
91+
base-path: ./packages/optimizely-sdk
92+
93+
# As testing against multiple versions need this to
94+
# finish the parallel build
95+
finish:
96+
name: Coveralls coverage
97+
needs: unit_tests
98+
runs-on: ubuntu-latest
99+
steps:
100+
- name: Coveralls Finished
101+
uses: coverallsapp/github-action@master
102+
with:
103+
github-token: ${{ secrets.github_token }}
104+
path-to-lcov: ./packages/optimizely-sdk/coverage/lcov.info
105+
parallel-finished: true
106+
base-path: ./packages/optimizely-sdk
107+
108+
test_sub_packages:
109+
runs-on: ubuntu-latest
110+
strategy:
111+
matrix:
112+
package: [ 'packages/utils', 'packages/event-processor', 'packages/logging', 'packages/datafile-manager']
113+
steps:
114+
- uses: actions/checkout@v3
115+
- name: Move to package ${{ matrix.package }}
116+
run: |
117+
cd ${{ matrix.package }}
118+
- name: Set up Node
119+
uses: actions/setup-node@v3
120+
with:
121+
node-version: 12
122+
cache: 'npm'
123+
cache-dependency-path: ${{ matrix.package }}/package-lock.json
124+
- name: Test sub packages
125+
working-directory: ./${{ matrix.package }}
126+
run: |
127+
npm install
128+
npm test

.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:
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
16+
run: |
17+
gem install awesome_bot
18+
- name: Run tests
19+
run: 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

.travis.yml

Lines changed: 0 additions & 92 deletions
This file was deleted.

packages/optimizely-sdk/package.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,7 @@
1919
"prebuild": "npm run clean",
2020
"build": "rollup -c && cp dist/index.lite.d.ts dist/optimizely.lite.es.d.ts && cp dist/index.lite.d.ts dist/optimizely.lite.es.min.d.ts && cp dist/index.lite.d.ts dist/optimizely.lite.min.d.ts",
2121
"build-browser-umd": "rollup -c --config-umd",
22-
"precover": "nyc npm test",
23-
"cover": "nyc report -r lcov",
24-
"precoveralls": "npm run cover",
25-
"coveralls": "< coverage/lcov.info coveralls",
22+
"coveralls": "nyc --reporter=lcov npm test",
2623
"prepare": "npm run build",
2724
"prepublishOnly": "npm test && npm run test-ci"
2825
},

0 commit comments

Comments
 (0)