|
| 1 | +on: [push, pull_request, workflow_dispatch] |
| 2 | + |
| 3 | +name: CI |
| 4 | + |
| 5 | +env: |
| 6 | + RUSTFLAGS: -D warnings |
| 7 | + RUSTDOCFLAGS: -D warnings |
| 8 | + |
| 9 | +jobs: |
| 10 | + check: |
| 11 | + name: Check |
| 12 | + runs-on: ubuntu-latest |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + - uses: actions-rs/toolchain@v1 |
| 16 | + with: |
| 17 | + profile: minimal |
| 18 | + toolchain: stable |
| 19 | + override: true |
| 20 | + - uses: actions-rs/cargo@v1 |
| 21 | + with: |
| 22 | + command: check |
| 23 | + args: --all-features |
| 24 | + |
| 25 | + check_wasm: |
| 26 | + name: Check wasm32 |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + - uses: actions-rs/toolchain@v1 |
| 31 | + with: |
| 32 | + profile: minimal |
| 33 | + toolchain: stable |
| 34 | + target: wasm32-unknown-unknown |
| 35 | + override: true |
| 36 | + - uses: actions-rs/cargo@v1 |
| 37 | + with: |
| 38 | + command: check |
| 39 | + args: --all-features --lib --target wasm32-unknown-unknown |
| 40 | + |
| 41 | + test: |
| 42 | + name: Test Suite |
| 43 | + runs-on: ubuntu-latest |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + - uses: actions-rs/toolchain@v1 |
| 47 | + with: |
| 48 | + profile: minimal |
| 49 | + toolchain: stable |
| 50 | + override: true |
| 51 | + - run: sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev |
| 52 | + - uses: actions-rs/cargo@v1 |
| 53 | + with: |
| 54 | + command: test |
| 55 | + args: --lib |
| 56 | + |
| 57 | + fmt: |
| 58 | + name: Rustfmt |
| 59 | + runs-on: ubuntu-latest |
| 60 | + steps: |
| 61 | + - uses: actions/checkout@v4 |
| 62 | + - uses: actions-rs/toolchain@v1 |
| 63 | + with: |
| 64 | + profile: minimal |
| 65 | + toolchain: stable |
| 66 | + override: true |
| 67 | + components: rustfmt |
| 68 | + - uses: actions-rs/cargo@v1 |
| 69 | + with: |
| 70 | + command: fmt |
| 71 | + args: --all -- --check |
| 72 | + |
| 73 | + clippy: |
| 74 | + name: Clippy |
| 75 | + runs-on: ubuntu-latest |
| 76 | + steps: |
| 77 | + - uses: actions/checkout@v4 |
| 78 | + - uses: actions-rs/toolchain@v1 |
| 79 | + with: |
| 80 | + profile: minimal |
| 81 | + toolchain: stable |
| 82 | + override: true |
| 83 | + components: clippy |
| 84 | + - uses: actions-rs/cargo@v1 |
| 85 | + with: |
| 86 | + command: clippy |
| 87 | + args: -- -D warnings |
| 88 | + |
| 89 | + trunk: |
| 90 | + name: trunk |
| 91 | + runs-on: ubuntu-latest |
| 92 | + steps: |
| 93 | + - uses: actions/checkout@v4 |
| 94 | + - uses: actions-rs/toolchain@v1 |
| 95 | + with: |
| 96 | + profile: minimal |
| 97 | + toolchain: 1.81.0 |
| 98 | + target: wasm32-unknown-unknown |
| 99 | + override: true |
| 100 | + - name: Download and install Trunk binary |
| 101 | + run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf- |
| 102 | + - name: Build |
| 103 | + run: ./trunk build |
| 104 | + |
| 105 | + build: |
| 106 | + runs-on: ${{ matrix.os }} |
| 107 | + strategy: |
| 108 | + fail-fast: false |
| 109 | + matrix: |
| 110 | + include: |
| 111 | + - os: macos-latest |
| 112 | + TARGET: aarch64-apple-darwin |
| 113 | + |
| 114 | + - os: ubuntu-latest |
| 115 | + TARGET: aarch64-unknown-linux-gnu |
| 116 | + |
| 117 | + - os: ubuntu-latest |
| 118 | + TARGET: armv7-unknown-linux-gnueabihf |
| 119 | + |
| 120 | + - os: ubuntu-latest |
| 121 | + TARGET: x86_64-unknown-linux-gnu |
| 122 | + |
| 123 | + - os: windows-latest |
| 124 | + TARGET: x86_64-pc-windows-msvc |
| 125 | + EXTENSION: .exe |
| 126 | + |
| 127 | + steps: |
| 128 | + - name: Building ${{ matrix.TARGET }} |
| 129 | + run: echo "${{ matrix.TARGET }}" |
| 130 | + |
| 131 | + - uses: actions/checkout@master |
| 132 | + - name: Install build dependencies - Rustup |
| 133 | + run: | |
| 134 | + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable --profile default --target ${{ matrix.TARGET }} -y |
| 135 | + echo "$HOME/.cargo/bin" >> $GITHUB_PATH |
| 136 | +
|
| 137 | + # For linux, it's necessary to use cross from the git repository to avoid glibc problems |
| 138 | + # Ref: https://github.com/cross-rs/cross/issues/1510 |
| 139 | + - name: Install cross for linux |
| 140 | + if: contains(matrix.TARGET, 'linux') |
| 141 | + run: | |
| 142 | + cargo install cross --git https://github.com/cross-rs/cross --rev 1b8cf50d20180c1a394099e608141480f934b7f7 |
| 143 | +
|
| 144 | + - name: Install cross for mac and windows |
| 145 | + if: ${{ !contains(matrix.TARGET, 'linux') }} |
| 146 | + run: | |
| 147 | + cargo install cross |
| 148 | +
|
| 149 | + - name: Build |
| 150 | + run: | |
| 151 | + cross build --verbose --release --target=${{ matrix.TARGET }} |
| 152 | +
|
| 153 | + - name: Rename |
| 154 | + run: cp target/${{ matrix.TARGET }}/release/eframe_template${{ matrix.EXTENSION }} eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }} |
| 155 | + |
| 156 | + - uses: actions/upload-artifact@master |
| 157 | + with: |
| 158 | + name: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }} |
| 159 | + path: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }} |
| 160 | + |
| 161 | + - uses: svenstaro/upload-release-action@v2 |
| 162 | + name: Upload binaries to release |
| 163 | + if: ${{ github.event_name == 'push' }} |
| 164 | + with: |
| 165 | + repo_token: ${{ secrets.GITHUB_TOKEN }} |
| 166 | + file: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }} |
| 167 | + asset_name: eframe_template-${{ matrix.TARGET }}${{ matrix.EXTENSION }} |
| 168 | + tag: ${{ github.ref }} |
| 169 | + prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }} |
| 170 | + overwrite: true |
0 commit comments