Fix docker for apple silicon macs (#68) #284
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: | |
jobs: | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
version: "23.3" | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run clippy | |
run: cargo clippy --all --all-targets -- -D warnings | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Run fmt | |
run: cargo fmt -- --check | |
build-wasm: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
version: "23.3" | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: wasm32-unknown-unknown | |
- name: Build (wasm32-unknown-unknown) | |
run: cargo build --all --target=wasm32-unknown-unknown | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Set up cargo cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | |
cargo-${{ hashFiles('**/Cargo.lock') }} | |
cargo- | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v2 | |
with: | |
version: "23.3" | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# needed for the buildx in order to access gha cache | |
# https://github.com/docker/bake-action/issues/36#issuecomment-1103961612 | |
- name: Expose github actions runtime | |
uses: crazy-max/ghaction-github-runtime@v1 | |
- name: Build the docker-compose stack | |
run: | | |
cat > ci/cache.json <<EOF | |
{ | |
"target": { | |
"validator": { | |
"cache-from": ["type=gha,scope=validator"], | |
"cache-to": ["type=gha,mode=max,scope=validator"], | |
"output": ["type=docker"] | |
}, | |
"bridge": { | |
"cache-from": ["type=gha,scope=bridge"], | |
"cache-to": ["type=gha,mode=max,scope=bridge"], | |
"output": ["type=docker"] | |
} | |
} | |
} | |
EOF | |
cd ci && docker buildx bake --file docker-compose.yml --file cache.json --load | |
- name: Run the docker-compose stack | |
env: | |
COMPOSE_DOCKER_CLI_BUILD: 1 | |
DOCKER_BUILDKIT: 1 | |
run: docker-compose -f ci/docker-compose.yml up --no-build -d | |
- name: Wait for bridge node to start | |
run: | | |
docker-compose -f ci/docker-compose.yml logs -f | | |
awk '/Configuration finished. Running a bridge node/ {print;exit}' | |
- name: Generate auth tokens | |
run: ./tools/gen_auth_tokens.sh | |
- name: Run tests | |
run: cargo test |