зеркало из https://github.com/mozilla/sccache.git
257 строки
9.6 KiB
YAML
257 строки
9.6 KiB
YAML
name: ci
|
|
on: [push, pull_request]
|
|
jobs:
|
|
lint:
|
|
name: ${{ matrix.component }} ${{ matrix.os }}
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 15
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [ubuntu-latest, macOS-latest, windows-latest]
|
|
component: [clippy]
|
|
include:
|
|
- component: rustfmt
|
|
cargo_cmd: fmt -- --check
|
|
os: ubuntu-latest
|
|
- component: clippy
|
|
cargo_cmd: clippy --locked --all-targets -- -D warnings -A unknown-lints -A clippy::type_complexity -A clippy::new-without-default
|
|
steps:
|
|
- name: Clone repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install rust
|
|
uses: ./.github/actions/rust-toolchain
|
|
with:
|
|
components: ${{ matrix.component }}
|
|
toolchain: 1.58
|
|
|
|
- name: clippy version
|
|
run: cargo clippy --version
|
|
if: ${{ matrix.component == 'clippy' }}
|
|
|
|
- name: Check
|
|
run: cargo ${{ matrix.cargo_cmd }}
|
|
|
|
test:
|
|
name: test ${{ matrix.os }} rust ${{ matrix.rustc || 'stable' }} ${{ matrix.extra_desc }}
|
|
runs-on: ${{ matrix.os }}
|
|
continue-on-error: ${{ matrix.allow_failure || false }}
|
|
timeout-minutes: 30
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-20.04
|
|
rustc: 1.58.0 # Oldest supported version, keep in sync with README.md
|
|
- os: ubuntu-20.04
|
|
rustc: 1.58.0
|
|
extra_desc: dist-server
|
|
extra_args: --no-default-features --features=dist-tests test_dist_ -- --test-threads 1
|
|
- os: ubuntu-20.04
|
|
rustc: stable
|
|
- os: ubuntu-20.04
|
|
rustc: beta
|
|
- os: ubuntu-20.04
|
|
rustc: nightly
|
|
allow_failure: true
|
|
extra_args: --features=unstable
|
|
- os: ubuntu-22.04
|
|
- os: macOS-10.15
|
|
- os: windows-2019
|
|
rustc: 1.58.0 # Oldest supported version, keep in sync with README.md
|
|
- os: windows-2019
|
|
rustc: nightly
|
|
allow_failure: true
|
|
extra_args: --features=unstable
|
|
- os: windows-2019
|
|
rustc: beta
|
|
env:
|
|
RUST_BACKTRACE: 1
|
|
steps:
|
|
- name: Clone repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install rust
|
|
uses: ./.github/actions/rust-toolchain
|
|
with:
|
|
toolchain: ${{ matrix.rustc }}
|
|
|
|
- name: Build tests
|
|
run: cargo test --no-run --locked --all-targets --verbose ${{ matrix.extra_args }}
|
|
|
|
- name: Run tests
|
|
run: cargo test --locked --all-targets --verbose ${{ matrix.extra_args }}
|
|
|
|
build:
|
|
name: build ${{ matrix.binary || 'sccache' }} ${{ matrix.target }}
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 30
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-20.04
|
|
target: x86_64-unknown-linux-musl
|
|
- os: ubuntu-20.04
|
|
binary: sccache-dist
|
|
extra_args: --no-default-features --features="dist-server"
|
|
target: x86_64-unknown-linux-musl
|
|
- os: ubuntu-20.04
|
|
target: aarch64-unknown-linux-musl
|
|
- os: macOS-10.15
|
|
target: x86_64-apple-darwin
|
|
macosx_deployment_target: 10.13
|
|
developer_dir: /Applications/Xcode_10.3.app
|
|
sdkroot: /Applications/Xcode_10.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk
|
|
- os: macOS-10.15
|
|
target: aarch64-apple-darwin
|
|
macosx_deployment_target: 11.0
|
|
developer_dir: /Applications/Xcode_12.2.app
|
|
sdkroot: /Applications/Xcode_12.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk
|
|
- os: windows-2019
|
|
target: x86_64-pc-windows-msvc
|
|
rustflags: -Ctarget-feature=+crt-static
|
|
steps:
|
|
- name: Clone repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install rust
|
|
uses: ./.github/actions/rust-toolchain
|
|
with:
|
|
toolchain: ${{ matrix.target == 'aarch64-apple-darwin' && 'beta' || 'stable' }}
|
|
target: ${{ matrix.target }}
|
|
|
|
- name: Install musl-tools
|
|
run: sudo apt-get install musl-tools
|
|
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}
|
|
|
|
- name: Install musl-tools
|
|
run: |
|
|
set -x
|
|
echo deb [arch=arm64] http://azure.ports.ubuntu.com/ubuntu-ports/ $(lsb_release -c -s) main restricted universe multiverse | sudo tee /etc/apt/sources.list.d/99ports.list > /dev/null
|
|
sudo dpkg --add-architecture arm64
|
|
sudo apt-get update || true
|
|
sudo apt-get install musl-dev:arm64 binutils-multiarch gcc-10-aarch64-linux-gnu libc6-dev-arm64-cross
|
|
apt-get download musl-tools:arm64
|
|
sudo dpkg-deb -x musl-tools_*_arm64.deb /
|
|
sed 2iREALGCC=aarch64-linux-gnu-gcc-10 /usr/bin/musl-gcc | sudo tee /usr/bin/aarch64-linux-musl-gcc > /dev/null
|
|
sudo chmod +x /usr/bin/aarch64-linux-musl-gcc
|
|
if: ${{ matrix.target == 'aarch64-unknown-linux-musl' }}
|
|
|
|
- name: Build
|
|
run: cargo build --locked --release --verbose --bin ${{ matrix.binary || 'sccache' }} --target ${{ matrix.target }} --features=openssl/vendored ${{ matrix.extra_args }}
|
|
env:
|
|
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: aarch64-linux-musl-gcc
|
|
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }}
|
|
DEVELOPER_DIR: ${{ matrix.developer_dir }}
|
|
SDKROOT: ${{ matrix.sdkroot }}
|
|
RUSTFLAGS: ${{ matrix.rustflags }}
|
|
|
|
# Workaround for the lack of substring() function in github actions expressions.
|
|
- name: Id
|
|
id: id
|
|
shell: bash
|
|
run: echo "::set-output name=id::${ID#refs/tags/}"
|
|
env:
|
|
ID: ${{ startsWith(github.ref, 'refs/tags/') && github.ref || github.sha }}
|
|
|
|
- name: Upload artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ matrix.binary || 'sccache' }}-${{ steps.id.outputs.id }}-${{ matrix.target }}
|
|
path: target/${{ matrix.target }}/release/${{ matrix.binary || 'sccache' }}${{ endsWith(matrix.target, '-msvc') && '.exe' || '' }}
|
|
if-no-files-found: error
|
|
|
|
coverage:
|
|
name: coverage ${{ matrix.os }} rust ${{ matrix.rustc || 'stable' }} ${{ matrix.extra_desc }}
|
|
runs-on: ${{ matrix.os }}
|
|
continue-on-error: ${{ matrix.allow_failure || false }}
|
|
timeout-minutes: 15
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- os: ubuntu-20.04
|
|
rustc: nightly
|
|
allow_failure: true
|
|
extra_args: --features=unstable
|
|
- os: macOS-10.15
|
|
rustc: nightly
|
|
# Disable on Windows for now as it fails with:
|
|
# found invalid metadata files for crate `vte_generate_state_changes`
|
|
# - os: windows-2019
|
|
# rustc: nightly
|
|
env:
|
|
RUST_BACKTRACE: 1
|
|
steps:
|
|
- name: Clone repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install rust
|
|
uses: ./.github/actions/rust-toolchain
|
|
with:
|
|
toolchain: ${{ matrix.rustc }}
|
|
|
|
- name: "`grcov` ~ install"
|
|
run: cargo install grcov
|
|
|
|
- name: Execute tests
|
|
run: cargo test --no-fail-fast --locked --all-targets --verbose ${{ matrix.extra_args }}
|
|
env:
|
|
CARGO_INCREMENTAL: '0'
|
|
RUSTC_WRAPPER: ''
|
|
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off'
|
|
|
|
- name: Generate coverage data (via `grcov`)
|
|
id: coverage
|
|
shell: bash
|
|
run: |
|
|
## Generate coverage data
|
|
COVERAGE_REPORT_DIR="target/debug"
|
|
COVERAGE_REPORT_FILE="${COVERAGE_REPORT_DIR}/lcov.info"
|
|
# GRCOV_IGNORE_OPTION='--ignore build.rs --ignore "/*" --ignore "[a-zA-Z]:/*"' ## `grcov` ignores these params when passed as an environment variable (why?)
|
|
# GRCOV_EXCLUDE_OPTION='--excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()"' ## `grcov` ignores these params when passed as an environment variable (why?)
|
|
mkdir -p "${COVERAGE_REPORT_DIR}"
|
|
# display coverage files
|
|
grcov . --output-type files --ignore build.rs --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()" | sort --unique
|
|
# generate coverage report
|
|
grcov . --output-type lcov --output-path "${COVERAGE_REPORT_FILE}" --branch --ignore build.rs --ignore "/*" --ignore "[a-zA-Z]:/*" --excl-br-line "^\s*((debug_)?assert(_eq|_ne)?!|#\[derive\()"
|
|
echo ::set-output name=report::${COVERAGE_REPORT_FILE}
|
|
|
|
- name: Upload coverage results (to Codecov.io)
|
|
uses: codecov/codecov-action@v2
|
|
with:
|
|
file: ${{ steps.coverage.outputs.report }}
|
|
## flags: IntegrationTests, UnitTests, ${{ steps.vars.outputs.CODECOV_FLAGS }}
|
|
flags: ${{ steps.vars.outputs.CODECOV_FLAGS }}
|
|
name: codecov-umbrella
|
|
fail_ci_if_error: false
|
|
|
|
release:
|
|
name: release
|
|
runs-on: ubuntu-latest
|
|
needs: [build, lint, test]
|
|
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
|
steps:
|
|
- name: Clone repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Get artifacts
|
|
uses: actions/download-artifact@v3
|
|
|
|
- name: Create release assets
|
|
run: |
|
|
for d in sccache-*; do
|
|
cp README.md LICENSE $d/
|
|
tar -zcvf $d.tar.gz $d
|
|
echo -n $(shasum -ba 256 $d.tar.gz | cut -d " " -f 1) > $d.tar.gz.sha256
|
|
done
|
|
|
|
- name: Create release
|
|
run: |
|
|
tag_name=${GITHUB_REF#refs/tags/}
|
|
hub release create -m $tag_name $tag_name $(for f in sccache-*.tar.gz*; do echo "-a $f"; done)
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|