on master help sign in
CICD: Build: Add separate 'Calculate test options' step
7b6388bMartin Nordholts
.github/workflows/CICD.yml+9−10
@@ -110,15 +110,6 @@ jobs:
110 echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
110 echo "PROJECT_VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n1)" >> $GITHUB_ENV
111 echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV
111 echo "PROJECT_MAINTAINER=$(sed -n 's/^authors = \["\(.*\)"\]/\1/p' Cargo.toml)" >> $GITHUB_ENV
112 echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV
112 echo "PROJECT_HOMEPAGE=$(sed -n 's/^homepage = "\(.*\)"/\1/p' Cargo.toml)" >> $GITHUB_ENV
113− - name: Initialize workflow variables
114− id: vars
115− shell: bash
116− run: |
117− # target-specific options
118− # # * test only library unit tests and binary for arm-type targets
119− unset CARGO_TEST_OPTIONS
120− unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--lib --bin ${PROJECT_NAME}" ;; esac;
121− echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS}
122 - name: Install Rust toolchain
113 - name: Install Rust toolchain
123 uses: actions-rs/toolchain@v1
114 uses: actions-rs/toolchain@v1
124 with:
115 with:
@@ -176,12 +167,20 @@ jobs:
176 # Let subsequent steps know where to find the (stripped) bin
167 # Let subsequent steps know where to find the (stripped) bin
177 echo ::set-output name=BIN_PATH::${BIN_PATH}
168 echo ::set-output name=BIN_PATH::${BIN_PATH}
178 echo ::set-output name=BIN_NAME::${BIN_NAME}
169 echo ::set-output name=BIN_NAME::${BIN_NAME}
170+ - name: Calculate test options
171+ id: test-options
172+ shell: bash
173+ run: |
174+ # test only library unit tests and binary for arm-type targets
175+ unset CARGO_TEST_OPTIONS
176+ unset CARGO_TEST_OPTIONS ; case ${{ matrix.job.target }} in arm-* | aarch64-*) CARGO_TEST_OPTIONS="--lib --bin ${PROJECT_NAME}" ;; esac;
177+ echo ::set-output name=CARGO_TEST_OPTIONS::${CARGO_TEST_OPTIONS}
179 - name: Test
178 - name: Test
180 uses: actions-rs/cargo@v1
179 uses: actions-rs/cargo@v1
181 with:
180 with:
182 use-cross: ${{ matrix.job.use-cross }}
181 use-cross: ${{ matrix.job.use-cross }}
183 command: test
182 command: test
184− args: --target=${{ matrix.job.target }} ${{ steps.vars.outputs.CARGO_TEST_OPTIONS}}
183+ args: --target=${{ matrix.job.target }} ${{ steps.test-options.outputs.CARGO_TEST_OPTIONS}}
185 - name: bat test run
184 - name: bat test run
186 uses: actions-rs/cargo@v1
185 uses: actions-rs/cargo@v1
187 with:
186 with: