Skip to content

[ci] Add workflow

[ci] Add workflow #21

Workflow file for this run

name: CI
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
# Disable previous runs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# ${{ vars.CI_UNIFIED_IMAGE }} is defined in the repository variables
jobs:
check:
name: "check"
runs-on: ubuntu-latest
container:
image: ${{ vars.CI_IMAGE }}
steps:
- uses: actions/checkout@v3
# uncomment if needed
# - name: fmt
# run: |
# cargo fmt --all --check
- name: Rust Cache
uses: Swatinem/rust-cache@v2.5.0
with:
cache-on-failure: true
cache-all-crates: true
- name: check
run: cargo check
test:
name: "test"
runs-on: ubuntu-latest
container:
image: ${{ vars.CI_IMAGE }}
# options: --privileged
steps:
- uses: actions/checkout@v3
# - name: Install Rust stable toolchain
# uses: actions-rs/toolchain@v1.0.7
# with:
# profile: minimal
# toolchain: 1.75.0
# override: true
- name: Rust Cache
uses: Swatinem/rust-cache@v2.5.0
with:
cache-on-failure: true
cache-all-crates: true
- name: test
run: |
# sudo apt-get update && sudo apt-get install -y iproute2 protobuf-compiler
echo "Installing iproute2..."
apt-get update && apt-get install -y iproute2 iputils-ping
# ip a
# echo "Enabling loopback interface explicitly..."
# ip link set lo up
echo "Result"
ip a
ping -c 1 127.0.0.1
echo "Starting a simple HTTP server..."
python3 -m http.server --bind 127.0.0.1 8080 &
sleep 1
curl 127.0.0.1:8080
echo "Running tests..."
cargo test
doc:
name: "doc"
runs-on: ubuntu-latest
container:
image: ${{ vars.CI_IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Rust Cache
uses: Swatinem/rust-cache@v2.5.0
with:
cache-on-failure: true
cache-all-crates: true
- name: doc
run: cargo doc
clippy:
name: "clippy"
runs-on: ubuntu-latest
container:
image: ${{ vars.CI_IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Rust Cache
uses: Swatinem/rust-cache@v2.5.0
with:
cache-on-failure: true
cache-all-crates: true
- name: clippy
continue-on-error: true
run: cargo clippy