Skip to content

Integration tests for prod config #6

Integration tests for prod config

Integration tests for prod config #6

name: Integration tests for config
on:
pull_request:
paths:
- "chains/**"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
prepare-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
current: ${{ steps.current.outputs.any_changed }}
previous: ${{ steps.previous.outputs.any_changed }}
name: Check which version was changed
steps:
- name: Checkout
uses: actions/checkout@v3
- name: 🛠 Set up actual paths
uses: ./.github/workflows/setup-path
- name: Was chains.json changed?
id: current
uses: tj-actions/[email protected]
with:
files: |
${{ env.CHAINS_JSON_PATH }}
- name: Was previous chains.json changed?
id: previous
uses: tj-actions/[email protected]
with:
files: |
${{ env.PREVIOUS_CHAINS_JSON_PATH }}
- name: Generate test paths
run: |
if [[ "${{ steps.current.outputs.any_changed }}" == 'true' ]]; then
echo "TEST_PATHS=${{ env.CHAINS_JSON_PATH }}" >> $GITHUB_ENV
fi
if [[ "${{ steps.previous.outputs.any_changed }}" == 'true' ]]; then
if [[ -n "${{ env.TEST_PATHS }}" ]]; then
echo "TEST_PATHS=${{ env.TEST_PATHS }},${{ env.PREVIOUS_CHAINS_JSON_PATH }}" >> $GITHUB_ENV
else
echo "TEST_PATHS=${{ env.PREVIOUS_CHAINS_JSON_PATH }}" >> $GITHUB_ENV
fi
fi
- name: Set matrix
id: set-matrix
run: |
echo "::set-output name=matrix::{\"test_path\": [\"${TEST_PATHS}\"]}"
integration-tests:
name: ${{ matrix.test_path }}
runs-on: ubuntu-latest
needs: prepare-matrix
if: always() && (needs.prepare-matrix.outputs.current == 'true' || needs.prepare-matrix.outputs.previous == 'true')
strategy:
fail-fast: false
matrix:
test_path: ${{fromJson(needs.prepare-matrix.outputs.matrix).test_path}}
steps:
- uses: actions/checkout@v4
- name: Set up actual paths
uses: ./.github/workflows/setup-path
- name: Install dependencies
run: make init
- name: Run test
run: CHAINS_JSON_PATH=${{ matrix.test_path }} make test-core
- name: Surface failing tests
if: always()
uses: pmeier/pytest-results-action@main
with:
path: test-results.xml