Skip to content

Commit

Permalink
Fix ENV var expanding
Browse files Browse the repository at this point in the history
  • Loading branch information
radeknovis committed Apr 28, 2023
1 parent b0e2301 commit 60f4462
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 22 deletions.
26 changes: 21 additions & 5 deletions .github/actions/run_tests_without_building/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,29 @@ runs:
shell: bash
run: tar xPpf products.tar

# Package Unit tests
- name: Run tests
if: inputs.type == 'unit-tests'
shell: bash
env:
RELAY_ENDPOINT: ${{ inputs.relay-endpoint }}
PROJECT_ID: ${{ inputs.project-id }}
TYPE: ${{ inputs.type }}
run: make $TYPE RELAY_HOST=$RELAY_ENDPOINT PROJECT_ID=$PROJECT_ID
run: make unit_tests

# Integration tests
- name: Run integration tests
if: inputs.type == 'integration-tests'
shell: bash
run: make integration_tests RELAY_HOST=${{ inputs.relay-endpoint }} PROJECT_ID=${{ inputs.PROJECT_ID }}

# Relay Integration tests
- name: Run Relay integration tests
if: inputs.type == 'relay-tests'
shell: bash
run: make relay_tests RELAY_HOST=${{ inputs.relay-endpoint }} PROJECT_ID=${{ inputs.PROJECT_ID }}

# Smoke tests
- name: Run smoke tests
if: inputs.type == 'smoke-tests'
shell: bash
run: make smoke_tests RELAY_HOST=${{ inputs.relay-endpoint }} PROJECT_ID=${{ inputs.PROJECT_ID }}

- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
- name: Build for testing
shell: bash
env:
RELAY_ENDPOINT: ${{ inputs.relay-endpoint }}
PROJECT_ID: ${{ inputs.project-id }}
RELAY_ENDPOINT: relay.walletconnect.com
PROJECT_ID: ${{ secrets.PROJECT_ID }}
run: make build_all

- name: Tar DerivedDataCache
Expand Down
31 changes: 24 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
strategy:
fail-fast: false
matrix:
test-type: [integration-tests, relay-tests, unit-tests]
type: [integration-tests, relay-tests, unit-tests]

steps:
- uses: actions/checkout@v3
Expand All @@ -41,18 +41,35 @@ jobs:
shell: bash
run: tar xPpf products.tar

# Package Unit tests
- name: Run tests
if: matrix.type == 'unit-tests'
shell: bash
env:
RELAY_ENDPOINT: ${{ inputs.relay-endpoint }}
PROJECT_ID: ${{ inputs.project-id }}
run: make ${{ matrix.test-type }}
run: make unit_tests

# Integration tests
- name: Run integration tests
if: matrix.type == 'integration-tests'
shell: bash
run: make integration_tests RELAY_HOST=relay.walletconnect.com PROJECT_ID=${{ secrets.PROJECT_ID }}

# Relay Integration tests
- name: Run Relay integration tests
if: matrix.type == 'relay-tests'
shell: bash
run: make relay_tests RELAY_HOST=relay.walletconnect.com PROJECT_ID=${{ secrets.PROJECT_ID }}

# Smoke tests
- name: Run smoke tests
if: matrix.type == 'smoke-tests'
shell: bash
run: make smoke_tests RELAY_HOST=relay.walletconnect.com PROJECT_ID=${{ secrets.PROJECT_ID }}

- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: success() || failure()
with:
check_name: ${{ matrix.test-type }} junit report
check_name: ${{ matrix.type }} junit report
report_paths: 'test_results/report.junit'

- name: Zip test artifacts
Expand All @@ -64,7 +81,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.test-type }} test_results
name: ${{ matrix.type }} test_results
path: ./artifacts.zip
if-no-files-found: warn

12 changes: 4 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,16 @@ ui_tests:

unitxctestrun = $(shell find . -name '*WalletConnect-Package*.xctestrun')

unit-tests: test_setup
unit_tests: test_setup
ifneq ($(unitxctestrun),)
# override ENV variables
plutil -replace TestConfigurations.0.TestTargets.0.EnvironmentVariables.RELAY_HOST -string $(RELAY_HOST) $(unitxctestrun)
plutil -replace TestConfigurations.0.TestTargets.0.EnvironmentVariables.PROJECT_ID -string $(PROJECT_ID) $(unitxctestrun)
# test-without-building
set -o pipefail && env NSUnbufferedIO=YES xcodebuild -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath DerivedDataCache -resultBundlePath 'test_results/UnitTests.xcresult' -xctestrun '$(integrationxctestrun)' test-without-building | tee ./test_results/xcodebuild.log | xcpretty --report junit --output ./test_results/report.junit
else
set -o pipefail && env NSUnbufferedIO=YES xcodebuild -scheme WalletConnect-Package -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath DerivedDataCache -resultBundlePath 'test_results/UnitTests.xcresult' RELAY_HOST='$(RELAY_HOST)' PROJECT_ID='$(PROJECT_ID)' test | tee ./test_results/xcodebuild.log | xcpretty --report junit --output ./test_results/report.junit
endif

integrationxctestrun = $(shell find . -name '*_IntegrationTests*.xctestrun')

integration-tests: test_setup
integration_tests: test_setup
ifneq ($(integrationxctestrun),)
# override ENV variables
plutil -replace TestConfigurations.0.TestTargets.0.EnvironmentVariables.RELAY_HOST -string $(RELAY_HOST) $(integrationxctestrun)
Expand All @@ -66,7 +62,7 @@ endif

relayxctestrun = $(shell find . -name '*_RelayIntegrationTests*.xctestrun')

relay-tests: test_setup
relay_tests: test_setup
ifneq ($(relayxctestrun),)
# override ENV variables
plutil -replace TestConfigurations.0.TestTargets.0.EnvironmentVariables.RELAY_HOST -string $(RELAY_HOST) $(relayxctestrun)
Expand All @@ -79,7 +75,7 @@ endif

smokexctestrun = $(shell find . -name '*_SmokeTests*.xctestrun')

smoke-tests: test_setup
smoke_tests: test_setup
ifneq ($(smokexctestrun),)
# override ENV variables
plutil -replace TestConfigurations.0.TestTargets.0.EnvironmentVariables.RELAY_HOST -string $(RELAY_HOST) $(smokexctestrun)
Expand Down

0 comments on commit 60f4462

Please sign in to comment.