/ .github / workflows / ci.yml
ci.yml
  1  name: CI
  2  
  3  # This workflow requires a GH_PAT secret with repo access to checkout private dependencies
  4  # Create at: https://github.com/settings/tokens/new with 'repo' scope
  5  # Add to: https://github.com/alpha-delta-network/adl/settings/secrets/actions
  6  #
  7  # Note: This workflow uses only shell commands due to organization policy
  8  # restricting external actions to local_only.
  9  
 10  on:
 11    push:
 12      branches: [main, develop]
 13    pull_request:
 14      branches: [main, develop]
 15    workflow_dispatch:
 16  
 17  env:
 18    RUST_BACKTRACE: 1
 19    CARGO_TERM_COLOR: always
 20  
 21  jobs:
 22    check:
 23      name: Check
 24      runs-on: ubuntu-latest
 25      timeout-minutes: 30
 26      steps:
 27        - name: Checkout adl repository
 28          run: |
 29            git clone --depth 1 https://github.com/${{ github.repository }}.git adl
 30            cd adl && git checkout ${{ github.sha }}
 31  
 32        - name: Checkout acdc-core dependency
 33          run: |
 34            git clone --depth 1 https://${{ secrets.GH_PAT }}@github.com/${{ github.repository_owner }}/acdc-core.git acdc-core
 35  
 36        - name: Checkout alphavm dependency
 37          run: |
 38            git clone --depth 1 https://${{ secrets.GH_PAT }}@github.com/${{ github.repository_owner }}/alphavm.git alphavm
 39  
 40        - name: Install Rust toolchain
 41          run: |
 42            curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
 43            source "$HOME/.cargo/env"
 44            rustup component add rustfmt clippy
 45  
 46        - name: Install Rust nightly (for formatting)
 47          run: |
 48            source "$HOME/.cargo/env"
 49            rustup toolchain install nightly --component rustfmt
 50  
 51        - name: Install cargo-nextest
 52          run: |
 53            source "$HOME/.cargo/env"
 54            curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C "$HOME/.cargo/bin"
 55  
 56        - name: Install just
 57          run: |
 58            source "$HOME/.cargo/env"
 59            curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to "$HOME/.cargo/bin"
 60  
 61        - name: Setup CARGO_HOME and TMPDIR
 62          run: |
 63            echo "JUSTFILE_CARGO_HOME=$GITHUB_WORKSPACE/adl/.cargo-home" >> $GITHUB_ENV
 64            mkdir -p "$GITHUB_WORKSPACE/adl/.cargo-home/tmp"
 65            echo "TMPDIR=$GITHUB_WORKSPACE/adl/.cargo-home/tmp" >> $GITHUB_ENV
 66  
 67        - name: Debug - Verify workspace structure
 68          run: |
 69            source "$HOME/.cargo/env"
 70            echo "=== Workspace structure ==="
 71            ls -la ./
 72            echo "=== acdc-core contents ==="
 73            ls -la ./acdc-core/ || echo "acdc-core not found"
 74            echo "=== acdc-core/storage contents ==="
 75            ls -la ./acdc-core/storage/ || echo "storage not found"
 76          working-directory: ${{ github.workspace }}
 77  
 78        - name: Run format check
 79          run: |
 80            source "$HOME/.cargo/env"
 81            just fmt
 82          working-directory: adl
 83  
 84        - name: Run clippy
 85          run: |
 86            source "$HOME/.cargo/env"
 87            just lint
 88          working-directory: adl
 89  
 90        - name: Run cargo check
 91          run: |
 92            source "$HOME/.cargo/env"
 93            just check
 94          working-directory: adl
 95  
 96    test:
 97      name: Test
 98      runs-on: ubuntu-latest
 99      needs: check
100      timeout-minutes: 45
101      steps:
102        - name: Checkout adl repository
103          run: |
104            git clone --depth 1 https://github.com/${{ github.repository }}.git adl
105            cd adl && git checkout ${{ github.sha }}
106  
107        - name: Checkout acdc-core dependency
108          run: |
109            git clone --depth 1 https://${{ secrets.GH_PAT }}@github.com/${{ github.repository_owner }}/acdc-core.git acdc-core
110  
111        - name: Checkout alphavm dependency
112          run: |
113            git clone --depth 1 https://${{ secrets.GH_PAT }}@github.com/${{ github.repository_owner }}/alphavm.git alphavm
114  
115        - name: Install Rust toolchain
116          run: |
117            curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
118            source "$HOME/.cargo/env"
119  
120        - name: Install cargo-nextest
121          run: |
122            source "$HOME/.cargo/env"
123            curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C "$HOME/.cargo/bin"
124  
125        - name: Install just
126          run: |
127            source "$HOME/.cargo/env"
128            curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- --to "$HOME/.cargo/bin"
129  
130        - name: Setup CARGO_HOME and TMPDIR
131          run: |
132            echo "JUSTFILE_CARGO_HOME=$GITHUB_WORKSPACE/adl/.cargo-home" >> $GITHUB_ENV
133            mkdir -p "$GITHUB_WORKSPACE/adl/.cargo-home/tmp"
134            echo "TMPDIR=$GITHUB_WORKSPACE/adl/.cargo-home/tmp" >> $GITHUB_ENV
135  
136        - name: Run tests
137          run: |
138            source "$HOME/.cargo/env"
139            just test
140          working-directory: adl
141  
142    security:
143      name: Security Audit
144      runs-on: ubuntu-latest
145      timeout-minutes: 15
146      steps:
147        - name: Checkout adl repository
148          run: |
149            git clone --depth 1 https://github.com/${{ github.repository }}.git adl
150            cd adl && git checkout ${{ github.sha }}
151  
152        - name: Checkout acdc-core dependency
153          run: |
154            git clone --depth 1 https://${{ secrets.GH_PAT }}@github.com/${{ github.repository_owner }}/acdc-core.git acdc-core
155  
156        - name: Checkout alphavm dependency
157          run: |
158            git clone --depth 1 https://${{ secrets.GH_PAT }}@github.com/${{ github.repository_owner }}/alphavm.git alphavm
159  
160        - name: Install Rust toolchain
161          run: |
162            curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain stable
163            source "$HOME/.cargo/env"
164  
165        - name: Install cargo-audit
166          run: |
167            source "$HOME/.cargo/env"
168            cargo install cargo-audit
169  
170        - name: Run security audit
171          run: |
172            source "$HOME/.cargo/env"
173            cargo audit
174          working-directory: adl
175          continue-on-error: true