|
1 | 1 | name: CI |
2 | 2 |
|
3 | 3 | env: |
4 | | -# MIN_SUPPORTED_RUST_VERSION: "1.46.0" |
5 | | -# CICD_INTERMEDIATES_DIR: "_cicd-intermediates" |
| 4 | + # MIN_SUPPORTED_RUST_VERSION: "1.46.0" |
| 5 | + # CICD_INTERMEDIATES_DIR: "_cicd-intermediates" |
6 | 6 | VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" |
7 | 7 | # vcpkg version: 2024.06.15 |
8 | 8 | # for multiarch gcc compatibility |
@@ -80,153 +80,154 @@ jobs: |
80 | 80 | # - { target: x86_64-apple-darwin , os: macos-10.15 } |
81 | 81 | # - { target: x86_64-pc-windows-gnu , os: windows-2022 } |
82 | 82 | # - { target: x86_64-pc-windows-msvc , os: windows-2022 } |
83 | | - - { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 } |
| 83 | + - { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04 } |
84 | 84 | # - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } |
85 | 85 | steps: |
86 | | - - name: Export GitHub Actions cache environment variables |
87 | | - uses: actions/github-script@v6 |
88 | | - with: |
89 | | - script: | |
90 | | - core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); |
91 | | - core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); |
92 | | -
|
93 | | - - name: Checkout source code |
94 | | - uses: actions/checkout@v4 |
95 | | - |
96 | | - - name: Install prerequisites |
97 | | - shell: bash |
98 | | - run: | |
99 | | - case ${{ matrix.job.target }} in |
100 | | - x86_64-unknown-linux-gnu) |
101 | | - sudo apt-get -y update |
102 | | - sudo apt-get install -y \ |
103 | | - clang \ |
104 | | - cmake \ |
105 | | - curl \ |
106 | | - gcc \ |
107 | | - git \ |
108 | | - g++ \ |
109 | | - libpam0g-dev \ |
110 | | - libasound2-dev \ |
111 | | - libgstreamer1.0-dev \ |
112 | | - libgstreamer-plugins-base1.0-dev \ |
113 | | - libgtk-3-dev \ |
114 | | - libpulse-dev \ |
115 | | - libva-dev \ |
116 | | - libvdpau-dev \ |
117 | | - libxcb-randr0-dev \ |
118 | | - libxcb-shape0-dev \ |
119 | | - libxcb-xfixes0-dev \ |
120 | | - libxdo-dev \ |
121 | | - libxfixes-dev \ |
122 | | - nasm \ |
123 | | - wget |
124 | | - ;; |
125 | | - # arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; |
126 | | - # aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; |
127 | | - esac |
128 | | -
|
129 | | - - name: Setup vcpkg with Github Actions binary cache |
130 | | - uses: lukka/run-vcpkg@v11 |
131 | | - with: |
132 | | - vcpkgDirectory: /opt/artifacts/vcpkg |
133 | | - vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} |
134 | | - |
135 | | - - name: Install vcpkg dependencies |
136 | | - run: | |
137 | | - $VCPKG_ROOT/vcpkg install --x-install-root="$VCPKG_ROOT/installed" |
138 | | - shell: bash |
139 | | - |
140 | | - - name: Install Rust toolchain |
141 | | - uses: dtolnay/rust-toolchain@v1 |
142 | | - with: |
143 | | - toolchain: stable |
144 | | - targets: ${{ matrix.job.target }} |
145 | | - components: '' |
146 | | - |
147 | | - - name: Show version information (Rust, cargo, GCC) |
148 | | - shell: bash |
149 | | - run: | |
150 | | - gcc --version || true |
151 | | - rustup -V |
152 | | - rustup toolchain list |
153 | | - rustup default |
154 | | - cargo -V |
155 | | - rustc -V |
156 | | -
|
157 | | - - uses: Swatinem/rust-cache@v2 |
158 | | - |
159 | | - - name: Build |
160 | | - uses: actions-rs/cargo@v1 |
161 | | - with: |
162 | | - use-cross: ${{ matrix.job.use-cross }} |
163 | | - command: build |
164 | | - args: --locked --target=${{ matrix.job.target }} |
165 | | - |
166 | | - - name: clean |
167 | | - shell: bash |
168 | | - run: | |
169 | | - cargo clean |
170 | | -
|
171 | | - # - name: Strip debug information from executable |
172 | | - # id: strip |
173 | | - # shell: bash |
174 | | - # run: | |
175 | | - # # Figure out suffix of binary |
176 | | - # EXE_suffix="" |
177 | | - # case ${{ matrix.job.target }} in |
178 | | - # *-pc-windows-*) EXE_suffix=".exe" ;; |
179 | | - # esac; |
180 | | - |
181 | | - # # Figure out what strip tool to use if any |
182 | | - # STRIP="strip" |
183 | | - # case ${{ matrix.job.target }} in |
184 | | - # arm-unknown-linux-*) STRIP="arm-linux-gnueabihf-strip" ;; |
185 | | - # aarch64-unknown-linux-gnu) STRIP="aarch64-linux-gnu-strip" ;; |
186 | | - # *-pc-windows-msvc) STRIP="" ;; |
187 | | - # esac; |
188 | | - |
189 | | - # # Setup paths |
190 | | - # BIN_DIR="${{ env.CICD_INTERMEDIATES_DIR }}/stripped-release-bin/" |
191 | | - # mkdir -p "${BIN_DIR}" |
192 | | - # BIN_NAME="${{ env.PROJECT_NAME }}${EXE_suffix}" |
193 | | - # BIN_PATH="${BIN_DIR}/${BIN_NAME}" |
194 | | - |
195 | | - # # Copy the release build binary to the result location |
196 | | - # cp "target/${{ matrix.job.target }}/release/${BIN_NAME}" "${BIN_DIR}" |
197 | | - |
198 | | - # # Also strip if possible |
199 | | - # if [ -n "${STRIP}" ]; then |
200 | | - # "${STRIP}" "${BIN_PATH}" |
201 | | - # fi |
202 | | - |
203 | | - # # Let subsequent steps know where to find the (stripped) bin |
204 | | - # echo ::set-output name=BIN_PATH::${BIN_PATH} |
205 | | - # echo ::set-output name=BIN_NAME::${BIN_NAME} |
206 | | - |
207 | | - - name: Set testing options |
208 | | - id: test-options |
209 | | - shell: bash |
210 | | - run: | |
211 | | - # test only library unit tests and binary for arm-type targets |
212 | | - unset CARGO_TEST_OPTIONS |
213 | | -
|
214 | | - case ${{ matrix.job.target }} in |
215 | | - arm-* | aarch64-*) |
216 | | - CARGO_TEST_OPTIONS="--lib --bin ${PROJECT_NAME}" |
217 | | - ;; |
218 | | - *) |
219 | | - CARGO_TEST_OPTIONS="--workspace --no-fail-fast -- --skip test_get_cursor_pos --skip test_get_key_state" |
220 | | - ;; |
221 | | - esac; |
222 | | -
|
223 | | - #deprecated echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS} |
224 | | - echo "CARGO_TEST_OPTIONS=${CARGO_TEST_OPTIONS}" >> $GITHUB_ENV |
225 | | - echo "CARGO_TEST_OPTIONS=${CARGO_TEST_OPTIONS}" >> $GITHUB_OUTPUT |
226 | | -
|
227 | | - - name: Run tests |
228 | | - uses: actions-rs/cargo@v1 |
229 | | - with: |
230 | | - use-cross: ${{ matrix.job.use-cross }} |
231 | | - command: test |
232 | | - args: --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} |
| 86 | + - name: Export GitHub Actions cache environment variables |
| 87 | + uses: actions/github-script@v6 |
| 88 | + with: |
| 89 | + script: | |
| 90 | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); |
| 91 | + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); |
| 92 | +
|
| 93 | + - name: Checkout source code |
| 94 | + uses: actions/checkout@v4 |
| 95 | + |
| 96 | + - name: Install prerequisites |
| 97 | + shell: bash |
| 98 | + run: | |
| 99 | + case ${{ matrix.job.target }} in |
| 100 | + x86_64-unknown-linux-gnu) |
| 101 | + sudo apt-get -y update |
| 102 | + sudo apt-get install -y \ |
| 103 | + clang \ |
| 104 | + cmake \ |
| 105 | + curl \ |
| 106 | + gcc \ |
| 107 | + git \ |
| 108 | + g++ \ |
| 109 | + libpam0g-dev \ |
| 110 | + libasound2-dev \ |
| 111 | + libunwind-dev \ |
| 112 | + libgstreamer1.0-dev \ |
| 113 | + libgstreamer-plugins-base1.0-dev \ |
| 114 | + libgtk-3-dev \ |
| 115 | + libpulse-dev \ |
| 116 | + libva-dev \ |
| 117 | + libvdpau-dev \ |
| 118 | + libxcb-randr0-dev \ |
| 119 | + libxcb-shape0-dev \ |
| 120 | + libxcb-xfixes0-dev \ |
| 121 | + libxdo-dev \ |
| 122 | + libxfixes-dev \ |
| 123 | + nasm \ |
| 124 | + wget |
| 125 | + ;; |
| 126 | + # arm-unknown-linux-*) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;; |
| 127 | + # aarch64-unknown-linux-gnu) sudo apt-get -y update ; sudo apt-get -y install gcc-aarch64-linux-gnu ;; |
| 128 | + esac |
| 129 | +
|
| 130 | + - name: Setup vcpkg with Github Actions binary cache |
| 131 | + uses: lukka/run-vcpkg@v11 |
| 132 | + with: |
| 133 | + vcpkgDirectory: /opt/artifacts/vcpkg |
| 134 | + vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }} |
| 135 | + |
| 136 | + - name: Install vcpkg dependencies |
| 137 | + run: | |
| 138 | + $VCPKG_ROOT/vcpkg install --x-install-root="$VCPKG_ROOT/installed" |
| 139 | + shell: bash |
| 140 | + |
| 141 | + - name: Install Rust toolchain |
| 142 | + uses: dtolnay/rust-toolchain@v1 |
| 143 | + with: |
| 144 | + toolchain: stable |
| 145 | + targets: ${{ matrix.job.target }} |
| 146 | + components: "" |
| 147 | + |
| 148 | + - name: Show version information (Rust, cargo, GCC) |
| 149 | + shell: bash |
| 150 | + run: | |
| 151 | + gcc --version || true |
| 152 | + rustup -V |
| 153 | + rustup toolchain list |
| 154 | + rustup default |
| 155 | + cargo -V |
| 156 | + rustc -V |
| 157 | +
|
| 158 | + - uses: Swatinem/rust-cache@v2 |
| 159 | + |
| 160 | + - name: Build |
| 161 | + uses: actions-rs/cargo@v1 |
| 162 | + with: |
| 163 | + use-cross: ${{ matrix.job.use-cross }} |
| 164 | + command: build |
| 165 | + args: --locked --target=${{ matrix.job.target }} |
| 166 | + |
| 167 | + - name: clean |
| 168 | + shell: bash |
| 169 | + run: | |
| 170 | + cargo clean |
| 171 | +
|
| 172 | + # - name: Strip debug information from executable |
| 173 | + # id: strip |
| 174 | + # shell: bash |
| 175 | + # run: | |
| 176 | + # # Figure out suffix of binary |
| 177 | + # EXE_suffix="" |
| 178 | + # case ${{ matrix.job.target }} in |
| 179 | + # *-pc-windows-*) EXE_suffix=".exe" ;; |
| 180 | + # esac; |
| 181 | + |
| 182 | + # # Figure out what strip tool to use if any |
| 183 | + # STRIP="strip" |
| 184 | + # case ${{ matrix.job.target }} in |
| 185 | + # arm-unknown-linux-*) STRIP="arm-linux-gnueabihf-strip" ;; |
| 186 | + # aarch64-unknown-linux-gnu) STRIP="aarch64-linux-gnu-strip" ;; |
| 187 | + # *-pc-windows-msvc) STRIP="" ;; |
| 188 | + # esac; |
| 189 | + |
| 190 | + # # Setup paths |
| 191 | + # BIN_DIR="${{ env.CICD_INTERMEDIATES_DIR }}/stripped-release-bin/" |
| 192 | + # mkdir -p "${BIN_DIR}" |
| 193 | + # BIN_NAME="${{ env.PROJECT_NAME }}${EXE_suffix}" |
| 194 | + # BIN_PATH="${BIN_DIR}/${BIN_NAME}" |
| 195 | + |
| 196 | + # # Copy the release build binary to the result location |
| 197 | + # cp "target/${{ matrix.job.target }}/release/${BIN_NAME}" "${BIN_DIR}" |
| 198 | + |
| 199 | + # # Also strip if possible |
| 200 | + # if [ -n "${STRIP}" ]; then |
| 201 | + # "${STRIP}" "${BIN_PATH}" |
| 202 | + # fi |
| 203 | + |
| 204 | + # # Let subsequent steps know where to find the (stripped) bin |
| 205 | + # echo ::set-output name=BIN_PATH::${BIN_PATH} |
| 206 | + # echo ::set-output name=BIN_NAME::${BIN_NAME} |
| 207 | + |
| 208 | + - name: Set testing options |
| 209 | + id: test-options |
| 210 | + shell: bash |
| 211 | + run: | |
| 212 | + # test only library unit tests and binary for arm-type targets |
| 213 | + unset CARGO_TEST_OPTIONS |
| 214 | +
|
| 215 | + case ${{ matrix.job.target }} in |
| 216 | + arm-* | aarch64-*) |
| 217 | + CARGO_TEST_OPTIONS="--lib --bin ${PROJECT_NAME}" |
| 218 | + ;; |
| 219 | + *) |
| 220 | + CARGO_TEST_OPTIONS="--workspace --no-fail-fast -- --skip test_get_cursor_pos --skip test_get_key_state" |
| 221 | + ;; |
| 222 | + esac; |
| 223 | +
|
| 224 | + #deprecated echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS} |
| 225 | + echo "CARGO_TEST_OPTIONS=${CARGO_TEST_OPTIONS}" >> $GITHUB_ENV |
| 226 | + echo "CARGO_TEST_OPTIONS=${CARGO_TEST_OPTIONS}" >> $GITHUB_OUTPUT |
| 227 | +
|
| 228 | + - name: Run tests |
| 229 | + uses: actions-rs/cargo@v1 |
| 230 | + with: |
| 231 | + use-cross: ${{ matrix.job.use-cross }} |
| 232 | + command: test |
| 233 | + args: --locked --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}} |
0 commit comments