From 124ad8bd3d78717c7312ab869ff1df187949793d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Wed, 18 Dec 2024 10:39:42 -0500 Subject: [PATCH] github: Use shared logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- .github/actions/build/action.yml | 39 +++++++++++ .github/actions/testsuite/action.yml | 25 +++++++ .github/workflows/tests.yml | 98 +++++----------------------- 3 files changed, 81 insertions(+), 81 deletions(-) create mode 100644 .github/actions/build/action.yml create mode 100644 .github/actions/testsuite/action.yml diff --git a/.github/actions/build/action.yml b/.github/actions/build/action.yml new file mode 100644 index 00000000..8f0879d7 --- /dev/null +++ b/.github/actions/build/action.yml @@ -0,0 +1,39 @@ +name: Build LXCFS +description: Install dependencies and build the codebase +inputs: + fuse: + required: true + os: + required: true + compiler: + required: true +runs: + using: "composite" + steps: + - name: Install dependencies + shell: bash + run: | + sudo apt-get update -qq + sudo apt-get install -qq ${{ inputs.compiler }} + sudo apt-get install -qq lib${{ inputs.fuse }}-dev + sudo apt-get install -qq python3 python3-pip python3-setuptools pkg-config uuid-runtime + if [ "${{ inputs.os }}" = "ubuntu-22.04" ]; then + sudo pip3 install meson==0.55.1 ninja + else + sudo pip3 install meson==0.55.1 ninja --break-system-packages + fi + + - name: Compiler version + shell: bash + env: + CC: ${{ inputs.compiler }} + run: | + ${CC} --version + + - name: Build + shell: bash + env: + CC: ${{ inputs.compiler }} + run: | + meson setup -Ddocs=false -Dtests=true -Dinit-script=systemd -Dprefix=/usr -Db_sanitize=address,undefined build/ + meson compile -C build diff --git a/.github/actions/testsuite/action.yml b/.github/actions/testsuite/action.yml new file mode 100644 index 00000000..b013a637 --- /dev/null +++ b/.github/actions/testsuite/action.yml @@ -0,0 +1,25 @@ +name: Test suite +description: Runs the testsuite +inputs: + fuse: + required: true + os: + required: true + compiler: + required: true +runs: + using: "composite" + steps: + - uses: ./.github/actions/build + with: + compiler: ${{ inputs.compiler }} + fuse: ${{ inputs.fuse }} + os: ${{ inputs.os }} + + - name: Test + shell: bash + env: + CC: ${{ inputs.compiler }} + run: | + echo 1 | sudo tee /sys/fs/cgroup/cpuset/cgroup.clone_children || true + sudo -E PATH="${PATH}" LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" build/tests/main.sh diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1b79de50..384e8445 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,37 +26,11 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Install dependencies - run: | - sudo apt-get update -qq - sudo apt-get install -qq ${{ matrix.compiler }} - sudo apt-get install -qq lib${{ matrix.fuse }}-dev - sudo apt-get install -qq python3 python3-pip python3-setuptools pkg-config uuid-runtime - if [ "${{ matrix.os }}" = "ubuntu-22.04" ]; then - sudo pip3 install meson==0.55.1 ninja - else - sudo pip3 install meson==0.55.1 ninja --break-system-packages - fi - - - name: Compiler version - env: - CC: ${{ matrix.compiler }} - run: | - ${CC} --version - - - name: Build - env: - CC: ${{ matrix.compiler }} - run: | - meson setup -Ddocs=false -Dtests=true -Dinit-script=systemd -Dprefix=/usr -Db_sanitize=address,undefined build/ - meson compile -C build - - - name: Test - env: - CC: ${{ matrix.compiler }} - run: | - echo 1 | sudo tee /sys/fs/cgroup/cpuset/cgroup.clone_children || true - sudo -E PATH="${PATH}" LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" build/tests/main.sh + - uses: ./.github/actions/testsuite + with: + compiler: ${{ matrix.compiler }} + fuse: ${{ matrix.fuse }} + os: ${{ matrix.os }} testsuite-self-hosted: name: Test suite (aarch64) @@ -83,37 +57,11 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Install dependencies - run: | - sudo apt-get update -qq - sudo apt-get install -qq ${{ matrix.compiler }} - sudo apt-get install -qq lib${{ matrix.fuse }}-dev - sudo apt-get install -qq python3 python3-pip python3-setuptools pkg-config uuid-runtime - if [ "${{ matrix.os }}" = "ubuntu-22.04" ]; then - sudo pip3 install meson==0.55.1 ninja - else - sudo pip3 install meson==0.55.1 ninja --break-system-packages - fi - - - name: Compiler version - env: - CC: ${{ matrix.compiler }} - run: | - ${CC} --version - - - name: Build - env: - CC: ${{ matrix.compiler }} - run: | - meson setup -Ddocs=false -Dtests=true -Dinit-script=systemd -Dprefix=/usr -Db_sanitize=address,undefined build/ - meson compile -C build - - - name: Test - env: - CC: ${{ matrix.compiler }} - run: | - echo 1 | sudo tee /sys/fs/cgroup/cpuset/cgroup.clone_children || true - sudo -E PATH="${PATH}" LD_LIBRARY_PATH="${LD_LIBRARY_PATH}" build/tests/main.sh + - uses: ./.github/actions/testsuite + with: + compiler: ${{ matrix.compiler }} + fuse: ${{ matrix.fuse }} + os: ${{ matrix.os }} upgrade-test: name: Upgrade test @@ -122,6 +70,8 @@ jobs: matrix: compiler: - gcc + fuse: + - fuse3 os: - ubuntu-24.04 branch: @@ -133,25 +83,11 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - - name: Install dependencies - run: | - sudo add-apt-repository universe - sudo apt-get update -qq - sudo apt-get install -qq gcc - sudo apt-get install -qq libfuse3-dev - sudo apt-get install -qq python3 python3-pip python3-setuptools pkg-config uuid-runtime - if [ "${{ matrix.os }}" = "ubuntu-22.04" ]; then - sudo pip3 install meson==0.55.1 ninja - else - sudo pip3 install meson==0.55.1 ninja --break-system-packages - fi - - - name: Build PR head version - env: - CC: ${{ matrix.compiler }} - run: | - meson setup -Ddocs=false -Dtests=true -Dinit-script=systemd -Dprefix=/usr -Db_sanitize=address,undefined build/ - meson compile -C build + - uses: ./.github/actions/build + with: + compiler: ${{ matrix.compiler }} + fuse: ${{ matrix.fuse }} + os: ${{ matrix.os }} - name: Build upstream head version env: