Stop using actions-rs (#239)

This commit is contained in:
Félix Saparelli 2022-07-24 15:37:41 +12:00 committed by GitHub
parent 88b9aceb01
commit ef2752cd42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 35 deletions

View file

@ -77,14 +77,30 @@ jobs:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: FranzDiebold/github-env-vars-action@v1.2.1
- name: Configure toolchain - name: Configure toolchain
uses: actions-rs/toolchain@v1 run: |
rustup toolchain install --profile minimal nightly
rustup default nightly
- name: Install cross
if: matrix.use-cross
uses: taiki-e/install-action@v1
with: with:
toolchain: nightly tool: cross
target: ${{ matrix.target }}
override: true - name: Install host target
if: "!matrix.use-cross"
run: rustup target add ${{ matrix.target }}
- name: Select compile settings
shell: bash
run: |
jq \
--arg ref '${{ github.ref }}' \
--argjson matrix '${{ toJSON(matrix) }}' \
-nrf ci-scripts/compile-settings.jq \
| tee -a $GITHUB_ENV
- name: Configure caching - name: Configure caching
uses: actions/cache@v2 uses: actions/cache@v2
@ -103,29 +119,11 @@ jobs:
if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' && !startsWith(github.ref, 'refs/tags/v') }} if: ${{ matrix.target == 'x86_64-unknown-linux-gnu' && !startsWith(github.ref, 'refs/tags/v') }}
run: sudo ./ci-scripts/install-deps.sh run: sudo ./ci-scripts/install-deps.sh
- name: Build release - name: Build
uses: actions-rs/cargo@v1 run: ${{ env.CTOOL }} build ${{ env.CARGS }}
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
with:
command: build
args: --target ${{ matrix.target }} --release ${{ matrix.release_build_args }}
use-cross: ${{ matrix.use-cross }}
- name: Build debug
uses: actions-rs/cargo@v1
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
with:
command: build
args: --target ${{ matrix.target }} ${{ matrix.debug_build_args }}
use-cross: ${{ matrix.use-cross }}
- name: Copy and rename utility - name: Copy and rename utility
if: ${{ startsWith(github.ref, 'refs/tags/v') }} run: cp target/${{ matrix.target }}/${{ env.COUTPUT }}/${{ matrix.output }} ${{ matrix.output }}
run: cp target/${{ matrix.target }}/release/${{ matrix.output }} ${{ matrix.output }}
- name: Copy and rename utility
if: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
run: cp target/${{ matrix.target }}/debug/${{ matrix.output }} ${{ matrix.output }}
- name: Test (Unix) - name: Test (Unix)
if: ${{ matrix.test && matrix.os != 'windows-latest' }} if: ${{ matrix.test && matrix.os != 'windows-latest' }}

View file

@ -15,10 +15,7 @@ jobs:
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Configure toolchain - name: Configure toolchain
uses: actions-rs/toolchain@v1 run: rustup default stable
with:
toolchain: stable
override: true
- name: Configure caching - name: Configure caching
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
@ -29,7 +26,4 @@ jobs:
- name: Install deps - name: Install deps
run: sudo ./ci-scripts/install-deps.sh run: sudo ./ci-scripts/install-deps.sh
- name: test - name: test
uses: actions-rs/cargo@v1 run: cargo test --no-default-features --features pkg-config,native-tls
with:
command: test
args: --no-default-features --features pkg-config,native-tls

View file

@ -0,0 +1,17 @@
if ($ref | startswith("refs/tags/v")) then {
output: "release",
profile: "release",
args: ($matrix.release_build_args // ""),
} else {
output: "debug",
profile: "dev",
args: ($matrix.debug_build_args // ""),
} end
|
{
CTOOL: (if $matrix."use-cross" then "cross" else "cargo" end),
COUTPUT: .output,
CARGS: "--target \($matrix.target) --profile \(.profile) \(.args)",
}
|
to_entries[] | "\(.key)=\(.value)"