Skip to content

Commit

Permalink
Merge commit '3f318a8675e4c3de4f5e8ab2d086189f2ae5f5cf' into mozart-s…
Browse files Browse the repository at this point in the history
…erver
  • Loading branch information
sune-ext-lyngby committed Aug 23, 2021
2 parents 0151d0b + 3f318a8 commit fadfb12
Show file tree
Hide file tree
Showing 62 changed files with 6,403 additions and 3,983 deletions.
25 changes: 25 additions & 0 deletions .github/actions/rust-toolchain/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: rust-toolchain
inputs:
toolchain:
description: |
Rust toolchain name.
See https://rust-lang.github.io/rustup/concepts/toolchains.html#toolchain-specification
required: false
target:
description: Target triple to install for this toolchain
required: false
components:
description: Space-separated list of components to be additionally installed for a new toolchain
required: false

runs:
using: composite
steps:
- shell: bash
run: |
set -x
rustup override set ${{ inputs.toolchain || 'stable' }}
${{ inputs.target && format('rustup target add {0}', inputs.target) }}
${{ inputs.components && format('rustup component add {0}', inputs.components) }}
cargo --version
rustc --version
185 changes: 163 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,181 @@
name: ci
on: [push, pull_request]
jobs:
build:
name: ${{ matrix.kind }} ${{ matrix.os }}
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 clippy::unknown-clippy-lints -A clippy::type_complexity -A clippy::new-without-default
steps:
- name: Clone repository
uses: actions/checkout@v1

- name: Install rust
uses: ./.github/actions/rust-toolchain
with:
components: ${{ matrix.component }}
toolchain: 1.50.0

- 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 }}
timeout-minutes: 60
continue-on-error: ${{ matrix.allow_failure || false }}
timeout-minutes: 30
strategy:
matrix:
os: [macOS-latest, windows-2019, ubuntu-16.04]
kind: ['test_debug']
include:
- os: ubuntu-16.04
rustc: 1.43.0 # Oldest supported version, keep in sync with README.md
- os: ubuntu-16.04
rustc: 1.43.0
extra_desc: dist-server
extra_args: --no-default-features --features=dist-tests test_dist_ -- --test-threads 1
- os: ubuntu-16.04
rustc: stable
- os: ubuntu-16.04
rustc: beta
- os: ubuntu-16.04
rustc: nightly
allow_failure: true
extra_args: --features=unstable
- os: macOS-10.15
- os: windows-2019
env:
RUST_BACKTRACE: 1
steps:
- name: Clone repository
uses: actions/checkout@v1

- name: Install rust
uses: ./.github/actions/rust-toolchain
with:
# Use depth > 1, because sometimes we need to rebuild master and if
# other commits have landed it will become impossible to rebuild if
# the checkout is too shallow.
fetch-depth: 5
submodules: true
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:
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@v1

- name: Install rust
uses: hecrj/setup-rust-action@v1
uses: ./.github/actions/rust-toolchain
with:
rust-version: "1.41.0"
toolchain: ${{ matrix.target == 'aarch64-apple-darwin' && 'beta' || 'stable' }}
target: ${{ matrix.target }}

- name: Install clippy and rustfmt
- name: Install musl-tools
run: sudo apt-get install musl-tools
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }}

- name: Install musl-tools
run: |
rustup component add clippy
rustup component add rustfmt
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-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 /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 }}

- name: check formatting
run: cargo fmt -- --check
# 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: build and test
run: cargo test --locked --all-targets
- name: Upload artifacts
uses: actions/upload-artifact@v2
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

release:
name: release
runs-on: ubuntu-latest
needs: [build, lint, test]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- name: Clone repository
uses: actions/checkout@v1

# TODO
# - name: clippy
# run: cargo clippy --locked --all-target
- name: Get artifacts
uses: actions/download-artifact@v2

- 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 }}
56 changes: 0 additions & 56 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit fadfb12

Please sign in to comment.