|
| 1 | +# This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | +# License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | +# file, You can obtain one at https://mozilla.org/MPL/2.0/. |
| 4 | + |
| 5 | +# Full CI workflow |
| 6 | +# Run before merging. Rebases on master to make sure CI passes for latest integration, not only for the PR at the time of creation. |
| 7 | + |
| 8 | +name: Full CI |
| 9 | + |
| 10 | +on: |
| 11 | + push: |
| 12 | + branches: |
| 13 | + - staging |
| 14 | + - trying |
| 15 | + |
| 16 | +env: |
| 17 | + GDEXT_FEATURES: 'godot-core/convenience' |
| 18 | + GDEXT_CRATE_ARGS: '-p godot-codegen -p godot-ffi -p godot-core -p godot-macros -p godot' |
| 19 | + |
| 20 | +defaults: |
| 21 | + run: |
| 22 | + shell: bash |
| 23 | + |
| 24 | +# If a new commit is pushed before the old one's CI has completed (on the same branch), abort previous run |
| 25 | +#concurrency: |
| 26 | +# group: ${{ github.head_ref }} |
| 27 | +# cancel-in-progress: true |
| 28 | + |
| 29 | +jobs: |
| 30 | + rustfmt: |
| 31 | + runs-on: ubuntu-20.04 |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v3 |
| 34 | + - name: "Install Rust" |
| 35 | + uses: ./.github/composite/rust |
| 36 | + with: |
| 37 | + rust: stable |
| 38 | + components: rustfmt |
| 39 | + - name: "Check rustfmt" |
| 40 | + run: cargo fmt --all -- --check |
| 41 | + |
| 42 | + |
| 43 | + unit-test: |
| 44 | + name: unit-test (${{ matrix.name }}) |
| 45 | + runs-on: ${{ matrix.os }} |
| 46 | + continue-on-error: false |
| 47 | + strategy: |
| 48 | + fail-fast: false # cancel all jobs as soon as one fails? |
| 49 | + matrix: |
| 50 | + # Order this way because macOS typically has the longest duration, followed by Windows, so it benefits total workflow execution time. |
| 51 | + # Additionally, the 'linux (msrv *)' special case will then be listed next to the other 'linux' jobs. |
| 52 | + # Note: Windows uses '--target x86_64-pc-windows-msvc' by default as Cargo argument. |
| 53 | + include: |
| 54 | + - name: macos |
| 55 | + os: macos-11 |
| 56 | + rust-toolchain: stable |
| 57 | + |
| 58 | + - name: windows |
| 59 | + os: windows-latest |
| 60 | + rust-toolchain: stable-x86_64-pc-windows-msvc |
| 61 | + |
| 62 | + # Don't use latest Ubuntu (22.04) as it breaks lots of ecosystem compatibility. |
| 63 | + # If ever moving to ubuntu-latest, need to manually install libtinfo5 for LLVM. |
| 64 | + - name: linux |
| 65 | + os: ubuntu-20.04 |
| 66 | + rust-toolchain: stable |
| 67 | + |
| 68 | + - name: linux-minimal-deps |
| 69 | + os: ubuntu-20.04 |
| 70 | + rust-toolchain: stable |
| 71 | + rust-special: minimal-deps |
| 72 | + |
| 73 | + steps: |
| 74 | + - uses: actions/checkout@v3 |
| 75 | + |
| 76 | + - name: "Install Rust" |
| 77 | + uses: ./.github/composite/rust |
| 78 | + with: |
| 79 | + rust: stable |
| 80 | + cache-key: ${{ matrix.rust-special }} # 'minimal-deps' or empty/not defined |
| 81 | + |
| 82 | + - name: "Install Rust nightly (minimal deps)" |
| 83 | + uses: ./.github/composite/rust |
| 84 | + with: |
| 85 | + rust: nightly |
| 86 | + cache-key: minimal-deps-nightly |
| 87 | + if: ${{ matrix.rust-special == 'minimal-deps' }} |
| 88 | + |
| 89 | + - name: "Install minimal dependency versions from Cargo" |
| 90 | + run: cargo +nightly update -Z minimal-versions |
| 91 | + if: ${{ matrix.rust-special == 'minimal-deps' }} |
| 92 | + |
| 93 | + - name: "Install LLVM" |
| 94 | + uses: ./.github/composite/llvm |
| 95 | + if: matrix.name == 'macos' |
| 96 | + |
| 97 | + - name: "Compile tests" |
| 98 | + run: cargo test $GDEXT_CRATE_ARGS --features unit-test,$GDEXT_FEATURES --no-run |
| 99 | + |
| 100 | + - name: "Test" |
| 101 | + run: cargo test $GDEXT_CRATE_ARGS --features unit-test,$GDEXT_FEATURES ${{ matrix.testflags }} |
| 102 | + |
| 103 | + |
| 104 | + itest-godot: |
| 105 | + name: itest-godot (${{ matrix.name }}) |
| 106 | + runs-on: ${{ matrix.os }} |
| 107 | + continue-on-error: false |
| 108 | + timeout-minutes: 24 |
| 109 | + strategy: |
| 110 | + fail-fast: false # cancel all jobs as soon as one fails? |
| 111 | + matrix: |
| 112 | + # Order this way because macOS typically has the longest duration, followed by Windows, so it benefits total workflow execution time. |
| 113 | + # Additionally, the 'linux (msrv *)' special case will then be listed next to the other 'linux' jobs. |
| 114 | + # Note: Windows uses '--target x86_64-pc-windows-msvc' by default as Cargo argument. |
| 115 | + include: |
| 116 | + - name: macos |
| 117 | + os: macos-12 |
| 118 | + rust-toolchain: stable |
| 119 | + godot-binary: godot.macos.editor.dev.x86_64 |
| 120 | + |
| 121 | + - name: windows |
| 122 | + os: windows-latest |
| 123 | + rust-toolchain: stable-x86_64-pc-windows-msvc |
| 124 | + godot-binary: godot.windows.editor.dev.x86_64.exe |
| 125 | + |
| 126 | + # Don't use latest Ubuntu (22.04) as it breaks lots of ecosystem compatibility. |
| 127 | + # If ever moving to ubuntu-latest, need to manually install libtinfo5 for LLVM. |
| 128 | + - name: linux |
| 129 | + os: ubuntu-20.04 |
| 130 | + rust-toolchain: stable |
| 131 | + godot-binary: godot.linuxbsd.editor.dev.x86_64 |
| 132 | + |
| 133 | + steps: |
| 134 | + - uses: actions/checkout@v3 |
| 135 | + |
| 136 | + - name: "Run Godot integration test" |
| 137 | + uses: ./.github/composite/godot |
| 138 | + with: |
| 139 | + artifact-name: godot-${{ matrix.name }} |
| 140 | + binary-filename: ${{ matrix.godot-binary }} |
| 141 | + #godot_ver: ${{ matrix.godot }} |
| 142 | + |
| 143 | + |
| 144 | + license-guard: |
| 145 | + runs-on: ubuntu-20.04 |
| 146 | + steps: |
| 147 | + - uses: actions/checkout@v3 |
| 148 | + |
| 149 | + - name: "Check license headers" |
| 150 | + uses: apache/skywalking-eyes/[email protected] |
| 151 | + with: |
| 152 | + # log: debug # optional: set the log level. The default value is `info`. |
| 153 | + config: .github/external-config/licenserc.yml |
| 154 | + # token: # optional: the token that license eye uses when it needs to comment on the pull request. |
| 155 | + # Set to empty ("") to disable commenting on pull request. The default value is ${{ github.token }} |
| 156 | + # mode: # optional: Which mode License-Eye should be run in. Choices are `check` or `fix`. The default value is `check`. |
| 157 | + mode: check |
| 158 | + |
| 159 | + |
| 160 | + full-ci: |
| 161 | + if: github.event_name == 'push' && success() |
| 162 | + needs: |
| 163 | + - rustfmt |
| 164 | + - unit-test |
| 165 | + - itest-godot |
| 166 | + - license-guard |
| 167 | + runs-on: ubuntu-20.04 |
| 168 | + steps: |
| 169 | + - name: "Mark the job as a success" |
| 170 | + run: exit 0 |
0 commit comments