Refactor the main Makefile #4053
Workflow file for this run
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: Run spec tests and linter | |
defaults: | |
run: | |
shell: zsh {0} | |
env: | |
TEST_PRESET_TYPE: "minimal" | |
on: | |
push: | |
branches: | |
- dev | |
- master | |
pull_request: | |
workflow_dispatch: | |
inputs: | |
test_preset_type: | |
default: minimal | |
description: Type of test to run, either mainnet or minimal | |
type: string | |
required: true | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
lint: | |
runs-on: [self-hosted-ghr-custom, size-l-x64, profile-consensusSpecs] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: '' | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12.4' | |
cache: '' | |
- name: Install doctoc | |
run: npm install -g [email protected] | |
- name: Run linter for pyspec | |
run: make lint | |
whitespace: | |
runs-on: [self-hosted-ghr-custom, size-l-x64, profile-consensusSpecs] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Check for trailing whitespace | |
run: | | |
if git grep -n '[[:blank:]]$'; then | |
echo "Trailing whitespace found. Please fix it." | |
exit 1 | |
fi | |
pyspec-tests: | |
runs-on: [self-hosted-ghr-custom, size-xl-x64, profile-consensusSpecs] | |
needs: [lint] | |
strategy: | |
matrix: | |
version: ["phase0", "altair", "bellatrix", "capella", "deneb", "electra", "fulu", "whisk"] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Rust for dependencies | |
uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12.4' | |
cache: '' | |
- name: set preset | |
if: github.event.inputs.test_preset_type != '' | |
run: | | |
echo "spec_test_preset_type=${{ github.event.inputs.test_preset_type || env.TEST_PRESET_TYPE }}" >> $GITHUB_ENV | |
- name: set preset | |
if: ${{ (github.event_name == 'push' && github.ref_name != 'master') || github.event_name == 'pull_request' }} | |
run: | | |
echo "spec_test_preset_type=${{ env.TEST_PRESET_TYPE }}" >> $GITHUB_ENV | |
- name: set preset | |
if: ${{ github.event_name == 'push' && github.ref_name == 'master' }} | |
run: | | |
echo "spec_test_preset_type=mainnet" >> $GITHUB_ENV | |
- name: set preset | |
if: github.event.schedule=='0 0 * * *' | |
run: | | |
echo "spec_test_preset_type=mainnet" >> $GITHUB_ENV | |
- name: test-${{ matrix.version }} | |
run: make test fork=${{ matrix.version }} preset=${{ env.spec_test_preset_type }} | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: test-reports-${{ matrix.version }} | |
path: tests/core/pyspec/test-reports | |
gen-modcheck: | |
runs-on: [self-hosted-ghr-custom, size-s-x64, profile-consensusSpecs] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12.4' | |
cache: '' | |
- name: Run generators with --modcheck | |
run: make gen_all modcheck=true 2>&1 | tee consensustestgen.log | |
- name: Check for errors | |
run: | | |
if grep -q "\[ERROR\]" consensustestgen.log; then | |
echo "There is an error in the log" | |
exit 1 | |
fi |