Ci improvements #44
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
pull_request: | |
branches: | |
- develop | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.event.pull_request.number || github.ref_name }} | |
cancel-in-progress: ${{ github.event_name == 'pull_request_target' }} | |
jobs: | |
authorize: | |
environment: | |
${{ (github.event_name == 'pull_request_target' && | |
github.event.pull_request.head.repo.full_name != github.repository) && | |
'external' || 'internal' }} | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo ✓ | |
prepare: | |
needs: authorize | |
runs-on: macos-latest-xlarge | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: ./.github/actions/build | |
with: | |
project-id: ${{ secrets.PROJECT_ID }} | |
cache-key: ci | |
test: | |
needs: prepare | |
runs-on: macos-latest-xlarge | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
type: [integration-tests, relay-tests, unit-tests] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- uses: actions/cache/restore@v3 | |
with: | |
path: | | |
products.tar | |
key: ${{ runner.os }}-deriveddata-ci-${{ github.event.pull_request.head.sha }} | |
- name: Untar DerivedDataCache | |
shell: bash | |
run: test -f products.tar && tar xPpf products.tar || echo "No artifacts to untar" | |
# Package Unit tests | |
- name: Run tests | |
if: matrix.type == 'unit-tests' | |
shell: bash | |
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 }} CAST_HOST=notify.walletconnect.com EXPLORER_HOST=explorer-api.walletconnect.com GM_DAPP_PROJECT_ID=${{ secrets.GM_DAPP_PROJECT_ID }} GM_DAPP_PROJECT_SECRET=${{ secrets.GM_DAPP_PROJECT_SECRET }} GM_DAPP_HOST=wc-notify-swift-integration-tests-prod.pages.dev JS_CLIENT_API_HOST=test-automation-api.walletconnect.com | |
# 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 }} | |
- name: Publish Test Report | |
uses: mikepenz/action-junit-report@v3 | |
if: success() || failure() | |
with: | |
check_name: ${{ matrix.type }} junit report | |
report_paths: 'test_results/report.junit' | |
- name: Zip test artifacts | |
if: always() | |
shell: bash | |
run: test -d "test_results" && zip artifacts.zip -r ./test_results || echo "Nothing to zip" | |
- name: Upload test artifacts | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.type }} test_results | |
path: ./artifacts.zip | |
if-no-files-found: warn |