cargo-binstall/.github/workflows/ci.yml
Jiahao XU 87686cb2f7
Feature: Better retry policy in binstalk-downloader (#794)
Fixed #779 #791 

 - Retry request on timeout
 - Retry for `StatusCode::{REQUEST_TIMEOUT, GATEWAY_TIMEOUT}`
 - Add `DEFAULT_RETRY_DURATION_FOR_RATE_LIMIT` for 503/429
   if 503/429 does not give us a header or give us an invalid header on
   when to retry, we would default to
   `DEFAULT_RETRY_DURATION_FOR_RATE_LIMIT`.
 - Fix `Client::get_redirected_final_url`: Retry using `GET` on status code 400..405 + 410
 - Rename remote_exists => remote_gettable & support fallback to GET
   if HEAD fails due to status code 400..405 + 410.
 - Improve `Client::get_stream`: Include url & method in the err of the stream returned

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2023-02-13 13:43:48 +11:00

127 lines
3.1 KiB
YAML

name: CI
on:
workflow_dispatch:
pull_request:
types:
- opened
- reopened
- synchronize
- auto_merge_enabled
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
CARGO_UNSTABLE_SPARSE_REGISTRY: "true"
jobs:
test:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
CARGO_BINSTALL_LOG_LEVEL: debug
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/just-setup
with:
cache-suffix: ${{ env.CARGO_BUILD_TARGET }}
- run: just toolchain
- run: just ci-install-deps
- run: just test
linux-cross-check:
strategy:
fail-fast: false
matrix:
target:
- armv7-unknown-linux-musleabihf
- armv7-unknown-linux-gnueabihf
- aarch64-unknown-linux-musl
- aarch64-unknown-linux-gnu
runs-on: ubuntu-latest
env:
CARGO_BUILD_TARGET: ${{ matrix.target }}
JUST_USE_CROSS: true
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/just-setup
with:
tools: cross
cache-suffix: ${{ env.CARGO_BUILD_TARGET }}
- run: just toolchain
- run: just ci-install-deps
- run: just check
apple-m1-check:
runs-on: macos-latest
env:
CARGO_BUILD_TARGET: aarch64-apple-darwin
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/just-setup
with:
cache-suffix: ${{ env.CARGO_BUILD_TARGET }}
- run: just toolchain
- run: just check
lint:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/just-setup
- run: just toolchain rustfmt,clippy
- run: just ci-install-deps
- run: just lint
# Dummy job to have a stable name for the "all tests pass" requirement
tests-pass:
name: Tests pass
needs:
- test
- linux-cross-check
- apple-m1-check
- lint
if: always() # always run even if dependencies fail
runs-on: ubuntu-latest
steps:
# fail if ANY dependency has failed or been skipped or cancelled
- if: "contains(needs.*.result, 'failure') || contains(needs.*.result, 'skipped') || contains(needs.*.result, 'cancelled')"
run: exit 1
# if everything succeeds and PR is ready for review, test the release/package process
release-builds:
if: (github.event_name == 'pull_request' && github.event.pull_request.draft == false) || github.event_name == 'workflow_dispatch'
needs: tests-pass
uses: ./.github/workflows/release-build.yml