feat: add open api spex beacon endpoints #2181
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: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ '*' ] | |
env: | |
MIX_ENV: test | |
RUST_WORKSPACES: | | |
native/snappy -> target | |
native/ssz_nif -> target | |
permissions: | |
contents: read | |
jobs: | |
compile-native: | |
name: Build native libraries | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Elixir | |
# NOTE: this is needed for the NIF header files | |
uses: erlef/setup-beam@v1 | |
with: | |
version-type: strict | |
version-file: .tool-versions | |
- name: Set up Go | |
# NOTE: this action comes with caching by default | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "1.21" | |
cache-dependency-path: | | |
native/libp2p_nif/go.sum | |
native/libp2p_port/go.sum | |
- name: Cache output artifacts | |
id: output-cache | |
uses: actions/cache@v3 | |
with: | |
path: priv/native/* | |
key: ${{ runner.os }}-native-${{ hashFiles('native/**') }} | |
- name: Install dependencies | |
if: steps.output-cache.outputs.cache-hit != 'true' | |
run: | | |
sudo apt-get install -y protobuf-compiler | |
go install google.golang.org/protobuf/cmd/protoc-gen-go@latest | |
protoc --go_out=./native/libp2p_port proto/libp2p.proto | |
- name: Compile native code | |
if: steps.output-cache.outputs.cache-hit != 'true' | |
run: make compile-port compile-native | |
build: | |
name: Build project | |
needs: compile-native | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
version-type: strict | |
version-file: .tool-versions | |
- name: Fetch native libraries | |
id: output-cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: priv/native/* | |
key: ${{ runner.os }}-native-${{ hashFiles('native/**') }} | |
fail-on-cache-miss: true | |
- name: Restore dependencies cache | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
restore-keys: ${{ runner.os }}-mix- | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y protobuf-compiler | |
echo $(protoc --version) | |
mix escript.install --force hex protobuf | |
protoc --elixir_out=./lib proto/libp2p.proto | |
mix deps.get | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: ${{ env.RUST_WORKSPACES }} | |
- name: Compile Elixir (Warnings as errors) | |
run: mix compile --warnings-as-errors | |
- name: Retrieve PLT Cache | |
uses: actions/cache@v3 | |
id: plt-cache | |
with: | |
path: priv/plts | |
key: ${{ runner.os }}-plts-${{ hashFiles(format('{0}{1}', github.workspace, '/mix.lock')) }} | |
- name: Create PLTs | |
if: steps.plt-cache.outputs.cache-hit != 'true' | |
run: | | |
mkdir -p priv/plts | |
mix dialyzer --plt | |
- name: Run dialyzer | |
run: mix dialyzer --no-check | |
smoke: | |
name: Start and stop the node | |
needs: compile-native | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
version-type: strict | |
version-file: .tool-versions | |
- name: Fetch native libraries | |
id: output-cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: priv/native/* | |
key: ${{ runner.os }}-native-${{ hashFiles('native/**') }} | |
fail-on-cache-miss: true | |
- name: Restore dependencies cache | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
restore-keys: ${{ runner.os }}-mix- | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y protobuf-compiler | |
echo $(protoc --version) | |
mix escript.install --force hex protobuf | |
protoc --elixir_out=./lib proto/libp2p.proto | |
mix deps.get | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: ${{ env.RUST_WORKSPACES }} | |
- name: Compile Elixir (Warnings as errors) | |
run: mix compile --warnings-as-errors | |
- name: Run the node | |
# NOTE: this starts and then stops the application. It should catch simple runtime errors | |
run: mix run -- --checkpoint-sync https://sync-mainnet.beaconcha.in/ | |
test: | |
name: Test | |
needs: compile-native | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
version-type: strict | |
version-file: .tool-versions | |
- name: Fetch native libraries | |
id: output-cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: priv/native/* | |
key: ${{ runner.os }}-native-${{ hashFiles('native/**') }} | |
fail-on-cache-miss: true | |
- name: Restore dependencies cache | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
restore-keys: ${{ runner.os }}-mix- | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: ${{ env.RUST_WORKSPACES }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y protobuf-compiler | |
mix escript.install --force hex protobuf | |
protoc --elixir_out=./lib proto/libp2p.proto | |
mix deps.get | |
- name: Run tests | |
run: mix test --no-start --trace --exclude spectest | |
lint: | |
name: Lint | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
version-type: strict | |
version-file: .tool-versions | |
- name: Restore dependencies cache | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
restore-keys: ${{ runner.os }}-mix- | |
- name: Install dependencies | |
run: mix deps.get | |
- name: Check format | |
run: | | |
make fmt | |
git diff --exit-code | |
- name: Run credo | |
run: mix credo --strict | |
download-spectests: | |
name: Download spectests | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache compressed spectests | |
id: output-cache | |
uses: actions/cache@v3 | |
with: | |
path: ./*.tar.gz | |
key: ${{ runner.os }}-spectest-${{ hashFiles('.spectest_version') }} | |
lookup-only: true | |
- name: Download spectests | |
if: steps.output-cache.outputs.cache-hit != 'true' | |
run: make download-vectors | |
spectests: | |
name: Run spec-tests | |
needs: [compile-native, download-spectests] | |
strategy: | |
matrix: | |
config: ["minimal", "general", "mainnet"] | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Elixir | |
uses: erlef/setup-beam@v1 | |
with: | |
version-type: strict | |
version-file: .tool-versions | |
- name: Fetch native libraries | |
uses: actions/cache/restore@v3 | |
with: | |
path: priv/native/* | |
key: ${{ runner.os }}-native-${{ hashFiles('native/**') }} | |
fail-on-cache-miss: true | |
- name: Fetch spectest vectors | |
uses: actions/cache/restore@v3 | |
with: | |
path: ./*.tar.gz | |
key: ${{ runner.os }}-spectest-${{ hashFiles('.spectest_version') }} | |
fail-on-cache-miss: true | |
- name: Restore dependencies cache | |
uses: actions/cache@v3 | |
with: | |
path: deps | |
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }} | |
restore-keys: ${{ runner.os }}-mix- | |
- name: Set up cargo cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: ${{ env.RUST_WORKSPACES }} | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y protobuf-compiler | |
mix escript.install --force hex protobuf | |
protoc --elixir_out=./lib proto/libp2p.proto | |
mix deps.get | |
- name: Uncompress vectors | |
run: make test/spec/vectors/tests/${{ matrix.config }} | |
- name: Generate tests | |
run: make gen-spec | |
- name: Run tests | |
run: mix test --no-start test/generated/${{ matrix.config }}/*/* |