Skip to content

perf: make host_connect async (#181) #10

perf: make host_connect async (#181)

perf: make host_connect async (#181) #10

Workflow file for this run

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@v3
- 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@v4
with:
go-version: "1.20"
cache-dependency-path: native/libp2p_nif/go.sum
- name: Cache output artifacts
id: output-cache
uses: actions/cache@v3
with:
path: priv/native/*.so
key: ${{ runner.os }}-native-${{ hashFiles('native/**') }}
- name: Compile native code
if: steps.output-cache.outputs.cache-hit != 'true'
run: make compile-native
build:
name: Build project
needs: compile-native
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- 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/*.so
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: mix deps.get
- name: Set up cargo cache
uses: Swatinem/rust-cache@v2
with:
workspaces: ${{ env.RUST_WORKSPACES }}
- name: Retrieve PLT Cache
uses: actions/cache@v1
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
test:
name: Test
needs: compile-native
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- 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/*.so
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: 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@v3
- 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@v3
- 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", "minimal" ]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- 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/*.so
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: mix deps.get
- name: Uncompress vectors
run: make tests/${{ matrix.config }}
- name: Run tests
run: mix test --no-start --trace --only spectest