ci.yml
1 # # DeltaOS Continuous Integration 2 # 3 # REPO_ACCESS_TOKEN secret required for cross-repo checkout 4 # 5 # Runs on: 6 # - Push to main/develop branches 7 # - Pull requests to main/develop 8 # 9 # Jobs: 10 # - Build: Compile all packages 11 # - Test: Run all tests 12 # - Lint: Run clippy and rustfmt 13 14 name: CI 15 16 on: 17 push: 18 branches: [main, develop] 19 pull_request: 20 branches: [main, develop] 21 22 env: 23 CARGO_TERM_COLOR: always 24 RUST_BACKTRACE: 1 25 LIBCLANG_PATH: /usr/lib/llvm-14/lib 26 27 jobs: 28 # ========================================================================== 29 # Build Job 30 # ========================================================================== 31 build: 32 name: Build 33 runs-on: ubuntu-latest 34 timeout-minutes: 60 35 36 steps: 37 - name: Checkout deltaos 38 uses: actions/checkout@v4 39 with: 40 path: deltaos 41 42 - name: Checkout alphavm 43 uses: actions/checkout@v4 44 with: 45 repository: BlockBlox-MD/alphavm 46 token: ${{ secrets.REPO_ACCESS_TOKEN }} 47 path: alphavm 48 49 - name: Checkout deltavm 50 uses: actions/checkout@v4 51 with: 52 repository: BlockBlox-MD/deltavm 53 token: ${{ secrets.REPO_ACCESS_TOKEN }} 54 path: deltavm 55 56 - name: Checkout adnet-core 57 uses: actions/checkout@v4 58 with: 59 repository: BlockBlox-MD/adnet-core 60 token: ${{ secrets.REPO_ACCESS_TOKEN }} 61 path: adnet-core 62 63 - name: Configure git credentials for cargo 64 run: | 65 # Use URL rewriting to inject token for all GitHub URLs 66 TOKEN=$(echo "${{ secrets.REPO_ACCESS_TOKEN }}" | tr -d '\n\r') 67 git config --global url."https://x-access-token:${TOKEN}@github.com/".insteadOf "https://github.com/" 68 mkdir -p ~/.cargo 69 echo '[net]' >> ~/.cargo/config.toml 70 echo 'git-fetch-with-cli = true' >> ~/.cargo/config.toml 71 72 - name: Install system dependencies 73 run: | 74 sudo apt-get update 75 sudo apt-get install -y \ 76 build-essential \ 77 cmake \ 78 clang-14 \ 79 llvm-14 \ 80 libclang-14-dev \ 81 pkg-config \ 82 libssl-dev 83 84 - name: Setup Rust toolchain 85 uses: dtolnay/rust-toolchain@stable 86 with: 87 components: rustfmt, clippy 88 89 - name: Cache cargo registry 90 uses: actions/cache@v4 91 with: 92 path: | 93 ~/.cargo/registry 94 ~/.cargo/git 95 key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} 96 restore-keys: | 97 ${{ runner.os }}-cargo-registry- 98 99 - name: Cache cargo build 100 uses: actions/cache@v4 101 with: 102 path: deltaos/target 103 key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} 104 restore-keys: | 105 ${{ runner.os }}-cargo-build- 106 107 - name: Build all packages 108 working-directory: deltaos 109 run: cargo build --release --workspace 110 111 # ========================================================================== 112 # Test Job 113 # ========================================================================== 114 test: 115 name: Test 116 runs-on: ubuntu-latest 117 timeout-minutes: 45 118 needs: build 119 120 steps: 121 - name: Checkout deltaos 122 uses: actions/checkout@v4 123 with: 124 path: deltaos 125 126 - name: Checkout alphavm 127 uses: actions/checkout@v4 128 with: 129 repository: BlockBlox-MD/alphavm 130 token: ${{ secrets.REPO_ACCESS_TOKEN }} 131 path: alphavm 132 133 - name: Checkout deltavm 134 uses: actions/checkout@v4 135 with: 136 repository: BlockBlox-MD/deltavm 137 token: ${{ secrets.REPO_ACCESS_TOKEN }} 138 path: deltavm 139 140 - name: Checkout adnet-core 141 uses: actions/checkout@v4 142 with: 143 repository: BlockBlox-MD/adnet-core 144 token: ${{ secrets.REPO_ACCESS_TOKEN }} 145 path: adnet-core 146 147 - name: Configure git credentials for cargo 148 run: | 149 # Use URL rewriting to inject token for all GitHub URLs 150 TOKEN=$(echo "${{ secrets.REPO_ACCESS_TOKEN }}" | tr -d '\n\r') 151 git config --global url."https://x-access-token:${TOKEN}@github.com/".insteadOf "https://github.com/" 152 mkdir -p ~/.cargo 153 echo '[net]' >> ~/.cargo/config.toml 154 echo 'git-fetch-with-cli = true' >> ~/.cargo/config.toml 155 156 - name: Install system dependencies 157 run: | 158 sudo apt-get update 159 sudo apt-get install -y \ 160 build-essential \ 161 cmake \ 162 clang-14 \ 163 llvm-14 \ 164 libclang-14-dev \ 165 pkg-config \ 166 libssl-dev 167 168 - name: Setup Rust toolchain 169 uses: dtolnay/rust-toolchain@stable 170 171 - name: Cache cargo 172 uses: actions/cache@v4 173 with: 174 path: | 175 ~/.cargo/registry 176 ~/.cargo/git 177 deltaos/target 178 key: ${{ runner.os }}-cargo-test-${{ hashFiles('**/Cargo.lock') }} 179 restore-keys: | 180 ${{ runner.os }}-cargo-test- 181 182 - name: Run tests 183 working-directory: deltaos 184 run: cargo test --workspace --release 185 186 # ========================================================================== 187 # Lint Job 188 # ========================================================================== 189 lint: 190 name: Lint 191 runs-on: ubuntu-latest 192 timeout-minutes: 30 193 194 steps: 195 - name: Checkout deltaos 196 uses: actions/checkout@v4 197 with: 198 path: deltaos 199 200 - name: Checkout alphavm 201 uses: actions/checkout@v4 202 with: 203 repository: BlockBlox-MD/alphavm 204 token: ${{ secrets.REPO_ACCESS_TOKEN }} 205 path: alphavm 206 207 - name: Checkout deltavm 208 uses: actions/checkout@v4 209 with: 210 repository: BlockBlox-MD/deltavm 211 token: ${{ secrets.REPO_ACCESS_TOKEN }} 212 path: deltavm 213 214 - name: Checkout adnet-core 215 uses: actions/checkout@v4 216 with: 217 repository: BlockBlox-MD/adnet-core 218 token: ${{ secrets.REPO_ACCESS_TOKEN }} 219 path: adnet-core 220 221 - name: Configure git credentials for cargo 222 run: | 223 # Use URL rewriting to inject token for all GitHub URLs 224 TOKEN=$(echo "${{ secrets.REPO_ACCESS_TOKEN }}" | tr -d '\n\r') 225 git config --global url."https://x-access-token:${TOKEN}@github.com/".insteadOf "https://github.com/" 226 mkdir -p ~/.cargo 227 echo '[net]' >> ~/.cargo/config.toml 228 echo 'git-fetch-with-cli = true' >> ~/.cargo/config.toml 229 230 - name: Install system dependencies 231 run: | 232 sudo apt-get update 233 sudo apt-get install -y \ 234 build-essential \ 235 cmake \ 236 clang-14 \ 237 llvm-14 \ 238 libclang-14-dev \ 239 pkg-config \ 240 libssl-dev 241 242 - name: Setup Rust toolchain 243 uses: dtolnay/rust-toolchain@stable 244 with: 245 components: rustfmt, clippy 246 247 - name: Cache cargo 248 uses: actions/cache@v4 249 with: 250 path: | 251 ~/.cargo/registry 252 ~/.cargo/git 253 deltaos/target 254 key: ${{ runner.os }}-cargo-lint-${{ hashFiles('**/Cargo.lock') }} 255 restore-keys: | 256 ${{ runner.os }}-cargo-lint- 257 258 - name: Install nightly for rustfmt 259 run: rustup toolchain install nightly --component rustfmt 260 261 - name: Check formatting 262 working-directory: deltaos 263 run: cargo +nightly fmt --all -- --check 264 265 - name: Run Clippy 266 working-directory: deltaos 267 run: cargo clippy --workspace --all-targets -- -D warnings