Refactoring #1
Workflow file for this run
This file contains hidden or 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: Era-Parser Validation Tests | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| concurrency: | |
| group: validation-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| validation-tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.9', '3.10', '3.11'] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libsnappy-dev | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install -r requirements-test.txt | |
| pip install -e . | |
| - name: Check if test data exists | |
| id: check_data | |
| run: | | |
| if [ -d "tests/test_data" ] && [ "$(ls -A tests/test_data/*.json 2>/dev/null)" ]; then | |
| echo "has_test_data=true" >> $GITHUB_OUTPUT | |
| echo "✅ Found test data files" | |
| ls -la tests/test_data/ | |
| else | |
| echo "has_test_data=false" >> $GITHUB_OUTPUT | |
| echo "⚠️ No test data found - validation tests will be skipped" | |
| fi | |
| - name: Run validation tests | |
| if: steps.check_data.outputs.has_test_data == 'true' | |
| run: | | |
| echo "🧪 Running era-parser validation tests..." | |
| python -m pytest tests/test_validation.py -v -s | |
| - name: Skip validation tests | |
| if: steps.check_data.outputs.has_test_data == 'false' | |
| run: | | |
| echo "⏭️ Skipping validation tests - no test data found" | |
| echo "To enable validation tests, add JSON file pairs to tests/test_data/" | |
| echo "Example: tests/test_data/mainnet_12345_rpc.json and tests/test_data/mainnet_12345_era.json" | |
| - name: Upload test results on failure | |
| uses: actions/upload-artifact@v3 | |
| if: failure() && steps.check_data.outputs.has_test_data == 'true' | |
| with: | |
| name: validation-failure-python-${{ matrix.python-version }} | |
| path: | | |
| tests/test_data/ | |
| retention-days: 7 | |
| # Summary job that can be used as a required check | |
| validation-summary: | |
| runs-on: ubuntu-latest | |
| needs: validation-tests | |
| if: always() | |
| steps: | |
| - name: Check validation results | |
| run: | | |
| if [ "${{ needs.validation-tests.result }}" == "success" ]; then | |
| echo "✅ All validation tests passed across Python versions" | |
| elif [ "${{ needs.validation-tests.result }}" == "skipped" ]; then | |
| echo "⏭️ Validation tests were skipped (no test data)" | |
| else | |
| echo "❌ Validation tests failed" | |
| exit 1 | |
| fi |