|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: [push, pull_request] |
| 4 | + |
| 5 | +env: |
| 6 | + CARGO_TERM_COLOR: always |
| 7 | + |
| 8 | +jobs: |
| 9 | + lint_fmt: |
| 10 | + name: cargo fmt |
| 11 | + runs-on: ubuntu-latest |
| 12 | + |
| 13 | + steps: |
| 14 | + - uses: actions/checkout@v4 |
| 15 | + - uses: dtolnay/rust-toolchain@stable |
| 16 | + with: |
| 17 | + components: rustfmt |
| 18 | + - name: Check formating |
| 19 | + run: cargo fmt -- --check |
| 20 | + |
| 21 | + lint_clippy: |
| 22 | + name: Clippy |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + version: ["1.0", "1.1", "2.0", "2.1", "3.0", "3.1", "3.2", "4.0", "5.0", "6.0"] |
| 26 | + runs-on: ubuntu-latest |
| 27 | + |
| 28 | + steps: |
| 29 | + - uses: actions/checkout@v4 |
| 30 | + - uses: dtolnay/rust-toolchain@stable |
| 31 | + with: |
| 32 | + components: clippy |
| 33 | + |
| 34 | + - name: Install lxc |
| 35 | + run: | |
| 36 | + sudo apt update |
| 37 | + sudo apt install lxc-dev clang meson systemd libdbus-1-dev -y |
| 38 | + git clone https://github.com/lxc/lxc.git |
| 39 | + cd lxc |
| 40 | + case "${{ matrix.version }}" in |
| 41 | + "6.0") |
| 42 | + TAG="v6.0.0" |
| 43 | + ;; |
| 44 | + "5.0") |
| 45 | + TAG="lxc-5.0.3" |
| 46 | + ;; |
| 47 | + *) |
| 48 | + TAG="lxc-${{ matrix.version }}.0" |
| 49 | + ;; |
| 50 | + esac |
| 51 | + git checkout "$TAG" |
| 52 | + if [[ $(echo "${{ matrix.version }}" | cut -d. -f1) -ge 5 ]] |
| 53 | + then |
| 54 | + meson setup -Dprefix=/usr -Dman=false build |
| 55 | + meson compile -C build |
| 56 | + sudo meson install -C build |
| 57 | + else |
| 58 | + ./autogen.sh |
| 59 | + ./configure |
| 60 | + sudo cp src/lxc/attach_options.h src/lxc/lxccontainer.h src/lxc/version.h /usr/include/lxc |
| 61 | + fi |
| 62 | +
|
| 63 | +
|
| 64 | + - name: Run clippy |
| 65 | + run: cargo clippy --features="v${${{ matrix.version }}/./_}" -- --deny warnings |
| 66 | + |
| 67 | + # tests: |
| 68 | + # name: Tests |
| 69 | + # strategy: |
| 70 | + # matrix: |
| 71 | + # mode: ["debug", "release"] |
| 72 | + # version: ["1.0", "1.1", "2.0", "2.1", "3.0", "3.1", "3.2", "4.0", "5.0", "6.0"] |
| 73 | + # runs-on: ubuntu-latest |
| 74 | + # |
| 75 | + # steps: |
| 76 | + # - uses: actions/checkout@v4 |
| 77 | + # - uses: dtolnay/rust-toolchain@stable |
| 78 | + # with: |
| 79 | + # toolchain: stable |
| 80 | + # |
| 81 | + # - name: Install lxc |
| 82 | + # run: | |
| 83 | + # sudo apt update |
| 84 | + # sudo apt install lxc-dev clang meson systemd libdbus-1-dev -y |
| 85 | + # git clone https://github.com/lxc/lxc.git |
| 86 | + # cd lxc |
| 87 | + # case "$version" in |
| 88 | + # "6.0") |
| 89 | + # TAG="v6.0.0" |
| 90 | + # ;; |
| 91 | + # "5.0") |
| 92 | + # TAG="lxc-5.0.3" |
| 93 | + # ;; |
| 94 | + # *) |
| 95 | + # TAG="lxc-$version.0" |
| 96 | + # ;; |
| 97 | + # esac |
| 98 | + # git checkout "$TAG" |
| 99 | + # if [[ $(echo "$version" | cut -d. -f1) -ge 5 ]] |
| 100 | + # then |
| 101 | + # meson setup -Dprefix=/usr -Dman=false build |
| 102 | + # meson compile -C build |
| 103 | + # meson install -C build |
| 104 | + # else |
| 105 | + # ./autogen.sh |
| 106 | + # ./configure |
| 107 | + # cp src/lxc/attach_options.h src/lxc/lxccontainer.h src/lxc/version.h /usr/include/lxc |
| 108 | + # fi |
| 109 | + # |
| 110 | + # - name: Run tests (debug) |
| 111 | + # if: matrix.mode == 'debug' |
| 112 | + # run: cargo test --features="v${version}" |
| 113 | + # |
| 114 | + # - name: Run tests (release) |
| 115 | + # if: matrix.mode == 'release' |
| 116 | + # run: cargo test --features="v${version}" --release |
0 commit comments