Skip to content

Commit

Permalink
quality: parameterize sdk and test data branch (#58)
Browse files Browse the repository at this point in the history
* parameterize sdk and test data branch
  • Loading branch information
typotter authored Aug 30, 2024
1 parent 5bc5993 commit e260758
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
36 changes: 35 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,39 @@
name: CI

env:
SDK_BRANCH_NAME: ${{ inputs.sdk_branch || github.head_ref || github.ref_name || 'main' }}
TEST_DATA_BRANCH_NAME: ${{ inputs.test_data_branch || 'main' }}

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

workflow_call:
inputs:
test_data_branch:
type: string
description: The branch in sdk-test-data to target for testcase files
required: false
default: main
sdk_branch:
type: string
description: The branch of the SDK to test
required: false

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: Eppo-exp/react-native-sdk
ref: ${{ env.SDK_BRANCH_NAME}}

- name: Setup Node.js
uses: actions/setup-node@v3
Expand All @@ -30,9 +51,19 @@ jobs:

test:
runs-on: ubuntu-latest

steps:
- name: Display Testing Details
run: |
echo "Running SDK Test using"
echo "Test Data: sdk-test-data@${TEST_DATA_BRANCH_NAME}"
echo "SDK Branch: php-sdk@${SDK_BRANCH_NAME}"
- name: Checkout
uses: actions/checkout@v3
with:
repository: Eppo-exp/react-native-sdk
ref: ${{ env.SDK_BRANCH_NAME}}

- name: Setup Node.js
uses: actions/setup-node@v3
Expand All @@ -46,13 +77,16 @@ jobs:
run: yarn install

- name: Run unit tests
run: yarn test --maxWorkers=2 --coverage
run: make test branchName=${{env.TEST_DATA_BRANCH_NAME}}

build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
repository: Eppo-exp/react-native-sdk
ref: ${{ env.SDK_BRANCH_NAME}}

- name: Setup Node.js
uses: actions/setup-node@v3
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,7 @@ test-data:
cp ${gitDataDir}rac-experiments-v3.json ${testDataDir}
cp -r ${gitDataDir}assignment-v2 ${testDataDir}
rm -rf ${tempDir}

.PHONY: test
test: test-data
yarn test --maxWorkers=2 --coverage

0 comments on commit e260758

Please sign in to comment.