Skip to content

Commit 99ec1d8

Browse files
authored
Added react yml and integeration test github action (#157)
-git actions integration
1 parent e92a4c1 commit 99ec1d8

File tree

3 files changed

+103
-50
lines changed

3 files changed

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

.github/workflows/react.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: react SDK CI
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
tags:
7+
- '[0-9]+.[0-9]+.[0-9]+*'
8+
pull_request:
9+
branches: [ master ]
10+
11+
jobs:
12+
test:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Set up Node 10
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: 10
20+
- run: yarn install
21+
- run: yarn test
22+
23+
integration_tests:
24+
uses: optimizely/react-sdk/.github/workflows/integration_test.yml@master
25+
secrets:
26+
CI_USER_TOKEN: ${{ secrets.CI_USER_TOKEN }}
27+
TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }}
28+
29+
publish:
30+
if: startsWith(github.ref, 'refs/tags/')
31+
runs-on: ubuntu-latest
32+
steps:
33+
- uses: actions/checkout@v3
34+
- name: install
35+
run: |
36+
URL=$(curl https://api.github.com/repos/github/hub/releases/latest 2>/dev/null | jq -r '.assets[] | select(.browser_download_url | contains("linux-amd64")) | .browser_download_url')
37+
curl -fsSL "$URL" | tar xz -C /tmp --strip-components=1 --wildcards '*/bin/hub'
38+
echo "${HOME}/.local/bin" >> $GITHUB_PATH
39+
hub version
40+
- name: Get the version
41+
id: get_version
42+
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}
43+
- name: set the env
44+
run: echo "travis_tag=${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_ENV
45+
- name: script
46+
run: |
47+
NEW_VERSION=$(grep -P '^## \[\d+\.\d+\.\d+.*\]' CHANGELOG.md | awk 'NR==1' | sed -e 's/\[/\\\[/' | sed -e 's/\]/\\\]/')
48+
LAST_VERSION=$(grep -P '^## \[\d+\.\d+\.\d+.*\]' CHANGELOG.md | awk 'NR==2' | sed -e 's/\[/\\\[/' | sed -e 's/\]/\\\]/')
49+
DESCRIPTION=$(awk "/^${NEW_VERSION}$/,/^${LAST_VERSION:-nothingmatched}$/" CHANGELOG.md | grep -v "^${LAST_VERSION:-nothingmatched}$")
50+
hub release create -m "Release ${{ env.travis_tag }}" -m "${DESCRIPTION}" "${{ env.travis_tag }}"
51+

.travis.yml

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

0 commit comments

Comments
 (0)