Skip to content

Commit 53171be

Browse files
authored
chore: removed travis yml and added git action support (#380)
- git actions integrated.
1 parent b6c2c63 commit 53171be

File tree

4 files changed

+151
-84
lines changed

4 files changed

+151
-84
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
- name: set SDK Branch if not pull request
30+
if: ${{ github.event_name != 'pull_request' }}
31+
run: |
32+
echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
33+
echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV
34+
- name: Trigger build
35+
env:
36+
SDK: python
37+
FULLSTACK_TEST_REPO: ${{ inputs.FULLSTACK_TEST_REPO }}
38+
BUILD_NUMBER: ${{ github.run_id }}
39+
TESTAPP_BRANCH: master
40+
GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }}
41+
TRAVIS_EVENT_TYPE: ${{ github.event_name }}
42+
GITHUB_CONTEXT: ${{ toJson(github) }}
43+
TRAVIS_REPO_SLUG: ${{ github.repository }}
44+
TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }}
45+
UPSTREAM_REPO: ${{ github.repository }}
46+
TRAVIS_COMMIT: ${{ github.sha }}
47+
TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }}
48+
TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }}
49+
UPSTREAM_SHA: ${{ github.sha }}
50+
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
51+
EVENT_MESSAGE: ${{ github.event.message }}
52+
HOME: 'home/runner'
53+
run: |
54+
echo "$GITHUB_CONTEXT"
55+
home/runner/travisci-tools/trigger-script-with-status-update.sh

.github/workflows/python.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python package
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
lint_markdown_files:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Set up Ruby
18+
uses: ruby/setup-ruby@v1
19+
with:
20+
ruby-version: '2.6'
21+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
22+
- name: Install gem
23+
run: |
24+
gem install awesome_bot
25+
- name: Run tests
26+
run: find . -type f -name '*.md' -exec awesome_bot {} \;
27+
28+
linting:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v3
32+
- name: Set up Python 3.9
33+
uses: actions/setup-python@v3
34+
with:
35+
python-version: 3.9
36+
# flake8 version should be same as the version in requirements/test.txt
37+
# to avoid lint errors on CI
38+
- name: pip install flak8
39+
run: pip install flake8>=4.1.0
40+
- name: Lint with flake8
41+
run: |
42+
flake8
43+
# stop the build if there are Python syntax errors or undefined names
44+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
45+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
46+
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
47+
48+
integration_tests:
49+
uses: optimizely/python-sdk/.github/workflows/integration_test.yml@master
50+
secrets:
51+
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
52+
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
53+
54+
fullstack_production_suite:
55+
uses: optimizely/python-sdk/.github/workflows/integration_test.yml@master
56+
with:
57+
FULLSTACK_TEST_REPO: ProdTesting
58+
secrets:
59+
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
60+
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
61+
62+
test:
63+
runs-on: ubuntu-latest
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
python-version: ["pypy-3.7-v7.3.5", "3.7", "3.8", "3.9", "3.10.0"]
68+
steps:
69+
- uses: actions/checkout@v3
70+
- name: Set up Python ${{ matrix.python-version }}
71+
uses: actions/setup-python@v3
72+
with:
73+
python-version: ${{ matrix.python-version }}
74+
- name: Install dependencies
75+
run: |
76+
python -m pip install --upgrade pip
77+
pip install -r requirements/core.txt;pip install -r requirements/test.txt
78+
- name: Test with pytest
79+
run: |
80+
pytest --cov=optimizely
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Source clear
2+
3+
on:
4+
schedule:
5+
# Runs "weekly"
6+
- cron: '0 0 * * 0'
7+
8+
jobs:
9+
source_clear:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v3
13+
- name: Source clear scan
14+
env:
15+
SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }}
16+
run: curl -sSL https://download.sourceclear.com/ci.sh | bash -s – scan

.travis.yml

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

0 commit comments

Comments
 (0)