|
| 1 | +# Copyright 2026 Circle Internet Group, Inc. All rights reserved. |
| 2 | +# |
| 3 | +# SPDX-License-Identifier: Apache-2.0 |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +name: CI |
| 18 | +on: |
| 19 | + push: |
| 20 | + branches: [master] |
| 21 | + pull_request: |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: ${{ github.workflow }}-${{ github.head_ref || github.sha }} |
| 25 | + cancel-in-progress: true |
| 26 | + |
| 27 | +permissions: |
| 28 | + pull-requests: write |
| 29 | + contents: write |
| 30 | + |
| 31 | +jobs: |
| 32 | + rust_build: |
| 33 | + name: Rust Build |
| 34 | + runs-on: ubuntu-latest |
| 35 | + steps: |
| 36 | + - name: Check out repository code |
| 37 | + uses: actions/checkout@v4 |
| 38 | + |
| 39 | + - name: Set up Rust |
| 40 | + run: ./scripts/setup-rust.sh |
| 41 | + |
| 42 | + - name: Run format check |
| 43 | + run: cargo fmt -- --check |
| 44 | + |
| 45 | + - name: Run clippy |
| 46 | + run: cargo clippy --all-targets --all-features -- --deny warnings |
| 47 | + |
| 48 | + - name: Build contracts |
| 49 | + run: cargo build-contracts |
| 50 | + |
| 51 | + - name: Cache build artifacts |
| 52 | + uses: actions/cache/save@v4 |
| 53 | + with: |
| 54 | + path: target |
| 55 | + key: rust-build-${{ github.sha }} |
| 56 | + |
| 57 | + rust_tests: |
| 58 | + name: Rust Tests |
| 59 | + needs: rust_build |
| 60 | + runs-on: ubuntu-latest |
| 61 | + steps: |
| 62 | + - name: Check out repository code |
| 63 | + uses: actions/checkout@v4 |
| 64 | + |
| 65 | + - name: Set up Rust |
| 66 | + run: ./scripts/setup-rust.sh |
| 67 | + |
| 68 | + - name: Restore build cache |
| 69 | + uses: actions/cache/restore@v4 |
| 70 | + with: |
| 71 | + path: target |
| 72 | + key: rust-build-${{ github.sha }} |
| 73 | + fail-on-cache-miss: true |
| 74 | + |
| 75 | + - name: Run tests |
| 76 | + run: cargo test |
| 77 | + |
| 78 | + npm_lint: |
| 79 | + name: NPM Lint |
| 80 | + runs-on: ubuntu-latest |
| 81 | + defaults: |
| 82 | + run: |
| 83 | + working-directory: scripts |
| 84 | + steps: |
| 85 | + - name: Check out repository code |
| 86 | + uses: actions/checkout@v4 |
| 87 | + with: |
| 88 | + submodules: true |
| 89 | + |
| 90 | + - name: Set up Node.js |
| 91 | + uses: actions/setup-node@v4 |
| 92 | + with: |
| 93 | + node-version: 20 |
| 94 | + |
| 95 | + - name: Enable Corepack |
| 96 | + run: corepack enable |
| 97 | + |
| 98 | + - name: Install dependencies |
| 99 | + run: yarn install --immutable |
| 100 | + |
| 101 | + - name: Run lint |
| 102 | + run: yarn lint |
| 103 | + |
| 104 | + scan: |
| 105 | + needs: [rust_tests, npm_lint] |
| 106 | + if: github.event_name == 'pull_request' |
| 107 | + uses: circlefin/circle-public-github-workflows/.github/workflows/pr-scan.yaml@v1 |
| 108 | + with: |
| 109 | + allow-reciprocal-licenses: false |
| 110 | + |
| 111 | + release-sbom: |
| 112 | + needs: [rust_tests, npm_lint] |
| 113 | + if: github.event_name == 'push' |
| 114 | + uses: circlefin/circle-public-github-workflows/.github/workflows/attach-release-assets.yaml@v1 |
0 commit comments