Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 32 additions & 7 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,48 @@
name: Swift

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

on:
push:

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be restricted to main branch?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a change in syntax to accommodate multiple triggers. That being said, there's not a lot of consistency across the SDKs here on this, so let's set the bar here.
We want tests to run when a) push to main, b) PR opened, c) PR updated
So, you are right that we can restrict push to branches: main as pull_request includes the synchronize event which is triggered by pushing commits to a branch under a PR.

pull_request:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to include '**/*' as the paths for this?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe so. paths provides a way to filter the event trigger and **/* matches everything which is the same as unfiltered.


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:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
- name: Display Testing Details
run: |
echo "Running SDK Test using"
echo "Test Data: sdk-test-data@${TEST_DATA_BRANCH_NAME}"
echo "SDK Branch: eppo-ios-sdk@${SDK_BRANCH_NAME}"
- name: 'Use gcloud CLI'
run: 'gcloud info'
- uses: actions/checkout@v3
with:
repository: Eppo-exp/eppo-ios-sdk
ref: ${{ env.SDK_BRANCH_NAME}}

- name: Build
run: make build

- name: Pull test data
run: make test-data
run: make test-data branchName=${{env.TEST_DATA_BRANCH_NAME}}

- name: Run tests
run: make test
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ build:
swift build

.PHONY: test
test:
test:
swift test

## test-data
Expand Down
Loading