|
| 1 | +--- |
| 2 | +# Note, this is used in the badge URL! |
| 3 | +name: build |
| 4 | + |
| 5 | +"on": |
| 6 | + push: |
| 7 | + branches: [dev, master] |
| 8 | + paths-ignore: |
| 9 | + - "**.md" |
| 10 | + - "docs/**" |
| 11 | + - "contrib/**" |
| 12 | + - "LICENSE" |
| 13 | + - "*.sh" |
| 14 | + - "**/Dockerfile*" |
| 15 | + - "publish.sh" |
| 16 | + - "test.sh" |
| 17 | + pull_request: |
| 18 | + paths-ignore: |
| 19 | + - "**.md" |
| 20 | + - "docs/**" |
| 21 | + - "contrib/**" |
| 22 | + - "LICENSE" |
| 23 | + - "*.sh" |
| 24 | + - "**/Dockerfile*" |
| 25 | + - "publish.sh" |
| 26 | + - "test.sh" |
| 27 | + schedule: |
| 28 | + # Run CI every week |
| 29 | + - cron: "00 01 * * 0" |
| 30 | + |
| 31 | +env: |
| 32 | + RUST_BACKTRACE: 1 |
| 33 | + RUSTFLAGS: -D warnings |
| 34 | + |
| 35 | +jobs: |
| 36 | + test: |
| 37 | + name: cargo +${{ matrix.toolchain }} test (${{ matrix.os }}) |
| 38 | + runs-on: ${{ matrix.os }} |
| 39 | + strategy: |
| 40 | + matrix: |
| 41 | + os: [ubuntu-latest, windows-latest] |
| 42 | + toolchain: |
| 43 | + - "1.85" # MSRV (Minimum supported rust version) |
| 44 | + - stable |
| 45 | + steps: |
| 46 | + - name: Checkout code |
| 47 | + uses: actions/checkout@v5 |
| 48 | + |
| 49 | + - name: Install Rust toolchain |
| 50 | + uses: dtolnay/rust-toolchain@master |
| 51 | + with: |
| 52 | + toolchain: ${{ matrix.toolchain }} |
| 53 | + |
| 54 | + - name: Cache Rust dependencies |
| 55 | + uses: Swatinem/rust-cache@v2 |
| 56 | + |
| 57 | + - name: Install developer package dependencies (Linux) |
| 58 | + if: runner.os == 'Linux' |
| 59 | + run: > |
| 60 | + sudo apt-get update && sudo apt-get install -y |
| 61 | + libpulse-dev portaudio19-dev libasound2-dev libsdl2-dev |
| 62 | + gstreamer1.0-dev libgstreamer-plugins-base1.0-dev |
| 63 | + libavahi-compat-libdnssd-dev |
| 64 | +
|
| 65 | + - name: Fetch dependencies |
| 66 | + run: cargo fetch --locked |
| 67 | + |
| 68 | + - name: Build workspace with examples |
| 69 | + run: cargo build --frozen --workspace --examples |
| 70 | + |
| 71 | + - name: Run tests |
| 72 | + run: cargo test --workspace |
| 73 | + |
| 74 | + - name: Install cargo-hack |
| 75 | + uses: taiki-e/install-action@cargo-hack |
| 76 | + |
| 77 | + - name: Check packages without TLS requirements |
| 78 | + run: cargo hack check -p librespot-protocol --each-feature |
| 79 | + |
| 80 | + - name: Check workspace with native-tls |
| 81 | + run: > |
| 82 | + cargo hack check -p librespot --each-feature --exclude-all-features |
| 83 | + --include-features native-tls |
| 84 | + --exclude-features rustls-tls-native-roots,rustls-tls-webpki-roots |
| 85 | +
|
| 86 | + - name: Check workspace with rustls-tls-native-roots |
| 87 | + run: > |
| 88 | + cargo hack check -p librespot --each-feature --exclude-all-features |
| 89 | + --include-features rustls-tls-native-roots |
| 90 | + --exclude-features native-tls,rustls-tls-webpki-roots |
| 91 | +
|
| 92 | + - name: Build binary with default features |
| 93 | + run: cargo build --frozen |
| 94 | + |
| 95 | + - name: Upload debug artifacts |
| 96 | + uses: actions/upload-artifact@v4 |
| 97 | + with: |
| 98 | + name: librespot-${{ matrix.os }}-${{ matrix.toolchain }} |
| 99 | + path: > |
| 100 | + target/debug/librespot${{ runner.os == 'Windows' && '.exe' || '' }} |
| 101 | + if-no-files-found: error |
0 commit comments