summaryrefslogtreecommitdiff
path: root/.github/workflows/build-packages.yml
blob: 08a682742bd7ddd558462a1d4d7c60284d4365ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
on: [push]

name: build

jobs:

  deb:
    name: bcachefs-tools-deb
    strategy:
      matrix:
        os: [ubuntu-20.04, ubuntu-22.04]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
      - name: Disable initramfs update
        run: sudo sed -i 's/yes/no/g' /etc/initramfs-tools/update-initramfs.conf
      - name: Disable man-db update
        run: sudo rm -f /var/lib/man-db/auto-update
      - name: Install build-deps
        run: |
          sudo apt-get update && sudo apt-get -y --no-install-recommends install \
              valgrind \
              equivs devscripts
          mk-build-deps
          sudo apt install ./bcachefs-tools-build-deps_*.deb
      - name: Setup Rust
        run: |
          curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
          echo "$HOME/.cargo/bin" >> $GITHUB_PATH
      - name: Make deb
        run: |
          make -j`nproc` deb
          mkdir dist && mv ../*.deb ./dist/
      - name: Upload deb
        uses: actions/upload-artifact@v3
        with:
          name: bcachefs-tools-deb_${{ matrix.os }}
          path: dist

  rpm:
    name: bcachefs-tools-rpm
    runs-on: ubuntu-latest
    container:
      image: docker.io/fedora:latest
    steps:
      - uses: actions/checkout@v4
      - name: Install build essentials
        run: dnf install -y nodejs make rpmdevtools yum-utils
      - name: Setup Rust
        run: |
          curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal
          echo "$HOME/.cargo/bin" >> $GITHUB_PATH
      - name: Install build-deps
        run: dnf builddep -y packaging/bcachefs-tools.spec
      - name: Make rpm
        run: |
          make -j`nproc` rpm
          mv ${HOME}/rpmbuild ./
      - name: Upload rpm
        uses: actions/upload-artifact@v3
        with:
          name: bcachefs-tools-rpm
          path: rpmbuild

  msrv:
    name: bcachefs-tools-msrv
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Disable initramfs update
        run: sudo sed -i 's/yes/no/g' /etc/initramfs-tools/update-initramfs.conf
      - name: Disable man-db update
        run: sudo rm -f /var/lib/man-db/auto-update
      - name: Install build-deps
        run: |
          sudo apt-get update && sudo apt-get -y --no-install-recommends install pkg-config libaio-dev libblkid-dev \
              libkeyutils-dev liblz4-dev libsodium-dev liburcu-dev libzstd-dev \
              uuid-dev zlib1g-dev valgrind libudev-dev python3-docutils libclang-dev
      - name: Extract MSRV
        run: |
          MSRV=$(cargo metadata --format-version 1 --no-deps --manifest-path rust-src/Cargo.toml |
                  jq -r '.packages[] | select(.name == "bcachefs-tools") | .rust_version')
          echo "MSRV=$MSRV" >> $GITHUB_ENV
      - name: Install Rust ${{ env.MSRV }} toolchain
        run: |
          rustup install --profile minimal ${{ env.MSRV }}
      - name: Make
        run: |
          CARGO_TOOLCHAIN_VERSION=${{ env.MSRV }} make -j`nproc`