|
| 1 | +name: rustecal CI |
| 2 | + |
| 3 | +env: |
| 4 | + RUSTFLAGS: "-D warnings" |
| 5 | + RUSTDOCFLAGS: "-D warnings" |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: [main] |
| 10 | + pull_request: |
| 11 | + workflow_dispatch: |
| 12 | + inputs: |
| 13 | + ecal_version: |
| 14 | + description: "eCAL tag to install (e.g. v6.0.0-rc.5). Use 'auto' or leave blank for the newest (pre-)release." |
| 15 | + required: false |
| 16 | + default: "auto" |
| 17 | + |
| 18 | +jobs: |
| 19 | + cargo: |
| 20 | + runs-on: ubuntu-22.04 |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + task: |
| 25 | + - { |
| 26 | + name: clippy, |
| 27 | + cmd: "clippy --workspace --all-targets --all-features --tests --examples", |
| 28 | + } |
| 29 | + - { name: fmt, cmd: "fmt --all -- --check" } |
| 30 | + - { |
| 31 | + name: check, |
| 32 | + cmd: "check --workspace --all-targets --all-features", |
| 33 | + } |
| 34 | + - { |
| 35 | + name: test, |
| 36 | + cmd: "test --workspace --all-targets --all-features --lib --bins --tests --examples", |
| 37 | + } |
| 38 | + - { |
| 39 | + name: doc, |
| 40 | + cmd: "doc --workspace --no-deps --all-features --document-private-items", |
| 41 | + } |
| 42 | + name: ${{ matrix.task.name }} |
| 43 | + |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - uses: actions-rust-lang/setup-rust-toolchain@v1 |
| 48 | + with: |
| 49 | + toolchain: stable |
| 50 | + components: clippy, rustfmt |
| 51 | + cache: true |
| 52 | + |
| 53 | + - name: Install eCAL (${{ github.event.inputs.ecal_version || 'auto' }}) |
| 54 | + env: |
| 55 | + ECAL_VER: ${{ github.event.inputs.ecal_version || 'auto' }} |
| 56 | + run: | |
| 57 | + set -eux; \ |
| 58 | + # Install dependencies for the eCAL installation, rustecal and examples |
| 59 | + sudo apt-get update; \ |
| 60 | + DEBIAN_FRONTEND=noninteractive \ |
| 61 | + sudo apt-get install -y --no-install-recommends \ |
| 62 | + ca-certificates curl jq \ |
| 63 | + clang libclang-14-dev llvm-dev \ |
| 64 | + protobuf-compiler && \ |
| 65 | + # Replace the placeholder with the actual eCAL version |
| 66 | + if [ -z "$ECAL_VER" ] || [ "$ECAL_VER" = "auto" ]; then \ |
| 67 | + ECAL_VER=$(curl -sSL https://api.github.com/repos/eclipse-ecal/ecal/releases \ |
| 68 | + | jq -r '[.[] | .tag_name][0]'); \ |
| 69 | + fi; \ |
| 70 | + # Locate the .deb that matches the tag and Ubuntu 22.04 |
| 71 | + DEB_URL=$(curl -sSL https://api.github.com/repos/eclipse-ecal/ecal/releases/tags/${ECAL_VER} \ |
| 72 | + | jq -r '[.assets[] | select(.name|test("jammy_amd64\\.deb$"))][0].browser_download_url'); \ |
| 73 | + curl -sSL -o /tmp/ecal.deb "$DEB_URL" && \ |
| 74 | + # Install eCAL and tidy up |
| 75 | + sudo apt-get install -y /tmp/ecal.deb; \ |
| 76 | + rm /tmp/ecal.deb |
| 77 | +
|
| 78 | + - name: run ${{ matrix.task.name }} |
| 79 | + run: cargo ${{ matrix.task.cmd }} |
0 commit comments