|
| 1 | +name: aya-ci |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + - ci |
| 8 | + |
| 9 | + pull_request: |
| 10 | + branches: |
| 11 | + - main |
| 12 | + |
| 13 | +env: |
| 14 | + CARGO_TERM_COLOR: always |
| 15 | + |
| 16 | +jobs: |
| 17 | + lint: |
| 18 | + runs-on: ubuntu-20.04 |
| 19 | + |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v3 |
| 22 | + |
| 23 | + - uses: dtolnay/rust-toolchain@master |
| 24 | + with: |
| 25 | + toolchain: nightly |
| 26 | + components: rustfmt, clippy, miri, rust-src |
| 27 | + |
| 28 | + - uses: Swatinem/rust-cache@v2 |
| 29 | + |
| 30 | + - run: cargo install taplo-cli |
| 31 | + - run: taplo fmt --check |
| 32 | + |
| 33 | + - name: Check formatting |
| 34 | + run: cargo fmt --all -- --check |
| 35 | + |
| 36 | + - uses: taiki-e/install-action@cargo-hack |
| 37 | + - name: Run clippy |
| 38 | + run: cargo hack clippy --all-targets --feature-powerset --workspace -- --deny warnings |
| 39 | + |
| 40 | + - name: Run miri |
| 41 | + run: | |
| 42 | + cargo hack miri test --all-targets --feature-powerset \ |
| 43 | + --exclude aya-bpf \ |
| 44 | + --exclude aya-bpf-bindings \ |
| 45 | + --exclude aya-log-ebpf \ |
| 46 | + --exclude integration-ebpf \ |
| 47 | + --exclude integration-test \ |
| 48 | + --workspace |
| 49 | +
|
| 50 | + build-test-aya: |
| 51 | + needs: ["lint"] |
| 52 | + strategy: |
| 53 | + fail-fast: false |
| 54 | + matrix: |
| 55 | + arch: |
| 56 | + - x86_64-unknown-linux-gnu |
| 57 | + - aarch64-unknown-linux-gnu |
| 58 | + - armv7-unknown-linux-gnueabi |
| 59 | + - riscv64gc-unknown-linux-gnu |
| 60 | + runs-on: ubuntu-20.04 |
| 61 | + steps: |
| 62 | + - uses: actions/checkout@v3 |
| 63 | + |
| 64 | + - uses: dtolnay/rust-toolchain@master |
| 65 | + with: |
| 66 | + toolchain: stable |
| 67 | + targets: ${{ matrix.arch }} |
| 68 | + |
| 69 | + - uses: Swatinem/rust-cache@v2 |
| 70 | + |
| 71 | + - uses: taiki-e/install-action@cargo-hack |
| 72 | + |
| 73 | + - uses: taiki-e/setup-cross-toolchain-action@v1 |
| 74 | + with: |
| 75 | + target: ${{ matrix.arch }} |
| 76 | + |
| 77 | + - name: Build |
| 78 | + run: | |
| 79 | + cargo hack build --all-targets --feature-powerset \ |
| 80 | + --exclude aya-bpf \ |
| 81 | + --exclude aya-bpf-bindings \ |
| 82 | + --exclude aya-log-ebpf \ |
| 83 | + --exclude integration-ebpf \ |
| 84 | + --workspace |
| 85 | +
|
| 86 | + - name: Test |
| 87 | + env: |
| 88 | + RUST_BACKTRACE: full |
| 89 | + run: | |
| 90 | + cargo hack test --all-targets --feature-powerset \ |
| 91 | + --exclude aya-bpf \ |
| 92 | + --exclude aya-bpf-bindings \ |
| 93 | + --exclude aya-log-ebpf \ |
| 94 | + --exclude integration-ebpf \ |
| 95 | + --exclude integration-test \ |
| 96 | + --workspace |
| 97 | +
|
| 98 | + build-test-aya-bpf: |
| 99 | + needs: ["lint"] |
| 100 | + strategy: |
| 101 | + fail-fast: false |
| 102 | + matrix: |
| 103 | + arch: |
| 104 | + - x86_64 |
| 105 | + - aarch64 |
| 106 | + - arm |
| 107 | + - riscv64 |
| 108 | + target: |
| 109 | + - bpfel-unknown-none |
| 110 | + - bpfeb-unknown-none |
| 111 | + runs-on: ubuntu-20.04 |
| 112 | + |
| 113 | + steps: |
| 114 | + - uses: actions/checkout@v3 |
| 115 | + |
| 116 | + - uses: dtolnay/rust-toolchain@master |
| 117 | + with: |
| 118 | + toolchain: nightly |
| 119 | + components: rust-src |
| 120 | + |
| 121 | + - uses: Swatinem/rust-cache@v2 |
| 122 | + |
| 123 | + - name: Prereqs |
| 124 | + run: cargo install bpf-linker |
| 125 | + |
| 126 | + - uses: taiki-e/install-action@cargo-hack |
| 127 | + - name: Build |
| 128 | + env: |
| 129 | + CARGO_CFG_BPF_TARGET_ARCH: ${{ matrix.arch }} |
| 130 | + run: | |
| 131 | + cargo hack build --package aya-bpf --package aya-log-ebpf \ |
| 132 | + --feature-powerset \ |
| 133 | + --target ${{ matrix.target }} \ |
| 134 | + -Z build-std=core |
| 135 | +
|
| 136 | + integration-test: |
| 137 | + runs-on: macos-latest |
| 138 | + needs: ["lint", "build-test-aya", "build-test-aya-bpf"] |
| 139 | + steps: |
| 140 | + - uses: actions/checkout@v3 |
| 141 | + with: |
| 142 | + submodules: recursive |
| 143 | + |
| 144 | + - name: Install Pre-requisites |
| 145 | + run: | |
| 146 | + brew install qemu gnu-getopt coreutils cdrtools |
| 147 | +
|
| 148 | + - name: Cache tmp files |
| 149 | + uses: actions/cache@v3 |
| 150 | + with: |
| 151 | + path: | |
| 152 | + .tmp/*.qcow2 |
| 153 | + .tmp/test_rsa |
| 154 | + .tmp/test_rsa.pub |
| 155 | + # FIXME: we should invalidate the cache on new bpf-linker releases. |
| 156 | + # For now we must manually delete the cache when we release a new |
| 157 | + # bpf-linker version. |
| 158 | + key: tmp-files-${{ hashFiles('test/run.sh') }} |
| 159 | + |
| 160 | + - name: Run integration tests |
| 161 | + run: test/run.sh |
| 162 | + |
| 163 | + build-workflow-complete: |
| 164 | + needs: ["lint", "build-test-aya", "build-test-aya-bpf", "integration-test"] |
| 165 | + runs-on: ubuntu-latest |
| 166 | + steps: |
| 167 | + - name: Build Complete |
| 168 | + run: echo "Build Complete" |
0 commit comments