Skip to content

Commit 474f578

Browse files
authored
chore: removed travis yml and added git action support (#331)
- migration from travis to git actions
1 parent f9c965a commit 474f578

File tree

5 files changed

+187
-125
lines changed

5 files changed

+187
-125
lines changed

.github/workflows/go.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Go
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
env:
10+
GO111MODULE: on
11+
12+
jobs:
13+
lint_markdown_files:
14+
uses: optimizely/go-sdk/.github/workflows/lint_markdown.yml@master
15+
16+
lint:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: actions/setup-go@v2
21+
with:
22+
go-version: '1.13.15'
23+
- run: make install lint
24+
25+
unit_test_latest:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v2
29+
- uses: actions/setup-go@v2
30+
with:
31+
go-version: '1.18'
32+
check-latest: true
33+
- run: make cover
34+
35+
unit_test_legacy:
36+
runs-on: ubuntu-latest
37+
env:
38+
BUILD_DIR: ${{ github.workspace }}
39+
GOPATH: ${{ github.workspace }}
40+
steps:
41+
- uses: actions/checkout@v3
42+
- uses: actions/setup-go@v2
43+
with:
44+
go-version: '1.10.8'
45+
- run: |
46+
mkdir -p $GOPATH/src/github.com && pushd $GOPATH/src/github.com && ln -s $GOPATH optimizely/go-sdk && popd
47+
mkdir $GOPATH/src/github.com/twmb && cd $GOPATH/src/github.com/twmb && git clone https://github.com/twmb/murmur3.git && cd $BUILD_DIR
48+
pushd $GOPATH/src/github.com/twmb/murmur3 && git checkout v1.0.0 && popd
49+
mkdir $GOPATH/src/github.com/hashicorp && cd $GOPATH/src/github.com/hashicorp && git clone https://github.com/hashicorp/go-multierror.git && cd $BUILD_DIR
50+
pushd $GOPATH/src/github.com/hashicorp/go-multierror && git checkout v1.0.0 && popd
51+
mkdir $GOPATH/src/gopkg.in && cd $GOPATH/src/gopkg.in && git clone https://github.com/go-yaml/yaml.git && cd $BUILD_DIR
52+
mv $GOPATH/src/gopkg.in/yaml $GOPATH/src/gopkg.in/yaml.v2 && pushd $GOPATH/src/gopkg.in/yaml.v2 && git checkout v2.2.2 && popd
53+
go get -v -d ./...
54+
go get -d -v github.com/stretchr/testify
55+
pushd $GOPATH/src/github.com/stretchr/testify && git checkout v1.4.0 && popd
56+
make test
57+
58+
unit_test_coverage:
59+
runs-on: ubuntu-latest
60+
env:
61+
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
steps:
63+
- uses: actions/checkout@v3
64+
- uses: actions/setup-go@v2
65+
with:
66+
go-version: '1.14.15'
67+
- run: |
68+
make cover
69+
go get github.com/mattn/goveralls
70+
goveralls -coverprofile=profile.cov -service=github
71+
72+
benchmark_test:
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v3
76+
- uses: actions/setup-go@v2
77+
with:
78+
go-version: '1.18'
79+
check-latest: true
80+
- run: make benchmark
81+
82+
integration_tests:
83+
uses: optimizely/go-sdk/.github/workflows/integration_test.yml@master
84+
secrets:
85+
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
86+
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
87+
88+
fullstack_production_suite:
89+
uses: optimizely/go-sdk/.github/workflows/integration_test.yml@master
90+
with:
91+
FULLSTACK_TEST_REPO: ProdTesting
92+
secrets:
93+
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
94+
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
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 and production test 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: go
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/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 & 125 deletions
This file was deleted.

0 commit comments

Comments
 (0)