|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + types: |
| 9 | + - opened |
| 10 | + - reopened |
| 11 | + - review_requested |
| 12 | + - ready_for_review |
| 13 | + - synchronize |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: read |
| 18 | + |
| 19 | +jobs: |
| 20 | + linux: |
| 21 | + runs-on: ${{ matrix.platform.runner }} |
| 22 | + if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }} |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + platform: |
| 26 | + - runner: ubuntu-24.04 |
| 27 | + target: x86_64 |
| 28 | + - runner: ubuntu-24.04 |
| 29 | + target: aarch64 |
| 30 | + - runner: ubuntu-24.04 |
| 31 | + target: armv7 |
| 32 | + - runner: ubuntu-24.04 |
| 33 | + target: s390x |
| 34 | + - runner: ubuntu-24.04 |
| 35 | + target: ppc64le |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v4 |
| 38 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 39 | + with: |
| 40 | + cache: true |
| 41 | + - name: Build and compile project |
| 42 | + run: cargo test --workspace --all-features --no-run |
| 43 | + - name: Run tests |
| 44 | + run: cargo test --workspace --all-features |
| 45 | + |
| 46 | + musllinux: |
| 47 | + runs-on: ${{ matrix.platform.runner }} |
| 48 | + if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }} |
| 49 | + strategy: |
| 50 | + matrix: |
| 51 | + platform: |
| 52 | + - runner: ubuntu-24.04 |
| 53 | + target: x86_64 |
| 54 | + - runner: ubuntu-24.04 |
| 55 | + target: aarch64 |
| 56 | + - runner: ubuntu-24.04 |
| 57 | + target: armv7 |
| 58 | + steps: |
| 59 | + - uses: actions/checkout@v4 |
| 60 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 61 | + with: |
| 62 | + cache: true |
| 63 | + - name: Build and compile project |
| 64 | + run: cargo test --workspace --all-features --no-run |
| 65 | + - name: Run tests |
| 66 | + run: cargo test --workspace --all-features |
| 67 | + |
| 68 | + windows: |
| 69 | + runs-on: ${{ matrix.platform.runner }} |
| 70 | + if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }} |
| 71 | + strategy: |
| 72 | + matrix: |
| 73 | + platform: |
| 74 | + - runner: windows-latest |
| 75 | + target: x64 |
| 76 | + steps: |
| 77 | + - uses: actions/checkout@v4 |
| 78 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 79 | + with: |
| 80 | + cache: true |
| 81 | + - name: Build and compile project |
| 82 | + run: cargo test --workspace --all-features --no-run |
| 83 | + - name: Run tests |
| 84 | + run: cargo test --workspace --all-features |
| 85 | + |
| 86 | + macos: |
| 87 | + runs-on: ${{ matrix.platform.runner }} |
| 88 | + if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }} |
| 89 | + strategy: |
| 90 | + matrix: |
| 91 | + platform: |
| 92 | + - runner: macos-14 |
| 93 | + target: aarch64 |
| 94 | + steps: |
| 95 | + - uses: actions/checkout@v4 |
| 96 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 97 | + with: |
| 98 | + cache: true |
| 99 | + - name: Build and compile project |
| 100 | + run: cargo test --workspace --all-features --no-run |
| 101 | + - name: Run tests |
| 102 | + run: cargo test --workspace --all-features |
| 103 | + |
| 104 | + man: |
| 105 | + name: man-generation |
| 106 | + runs-on: ubuntu-24.04 |
| 107 | + if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) }} |
| 108 | + steps: |
| 109 | + - uses: actions/checkout@v6 |
| 110 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 111 | + with: |
| 112 | + cache: true |
| 113 | + - name: Cache Cargo registry |
| 114 | + uses: actions/cache@v4 |
| 115 | + with: |
| 116 | + path: | |
| 117 | + ~/.cargo/registry/index/ |
| 118 | + ~/.cargo/registry/cache/ |
| 119 | + ~/.cargo/git/db/ |
| 120 | + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} |
| 121 | + restore-keys: | |
| 122 | + ${{ runner.os }}-cargo-registry- |
| 123 | + - name: Cache Cargo build |
| 124 | + uses: actions/cache@v4 |
| 125 | + with: |
| 126 | + path: target |
| 127 | + key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} |
| 128 | + restore-keys: | |
| 129 | + ${{ runner.os }}-cargo-build- |
| 130 | + - name: Generate man pages |
| 131 | + run: | |
| 132 | + cargo run --package git-metadata -- --generate-man target/debug/man |
| 133 | +
|
| 134 | + ci: |
| 135 | + name: CI |
| 136 | + if: ${{ always() && (github.event_name == 'workflow_dispatch' || github.event_name == 'push' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false)) }} |
| 137 | + needs: [linux, musllinux, windows, macos, man] |
| 138 | + runs-on: ubuntu-latest |
| 139 | + steps: |
| 140 | + - run: | |
| 141 | + result="${{ (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) && 'failure' || 'success' }}" |
| 142 | + echo "result: $result" |
| 143 | + [[ "$result" == "success" ]] || exit 1 |
0 commit comments