Skip to content

Commit

Permalink
ci: add configurations to setup fscache
Browse files Browse the repository at this point in the history
Since using `/dev/cachefiles` requires sudo mode, so some environment variables are defined and we use `sudo -E` to pass these environment variables to sudo operations.

The script file for enabling fscache is misc/fscache/setup.sh

Signed-off-by: hijackthe2 <[email protected]>
  • Loading branch information
hijackthe2 authored and imeoer committed Nov 3, 2023
1 parent cdc41de commit 689900c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,13 @@ jobs:
shared-key: nydus-build
- name: Install cargo nextest
uses: taiki-e/install-action@nextest
- name: Fscache Setup
run: sudo bash misc/fscache/setup.sh
- name: Unit Test
run: |
make ut-nextest
CARGO_HOME=${HOME}/.cargo
CARGO_BIN=$(which cargo)
sudo -E CARGO=${CARGO_BIN} make ut-nextest
nydus-unit-test-coverage:
runs-on: ubuntu-latest
Expand All @@ -626,8 +630,13 @@ jobs:
cache-on-failure: true
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Fscache Setup
run: sudo bash misc/fscache/setup.sh
- name: Generate code coverage
run: make coverage-codecov
run: |
CARGO_HOME=${HOME}/.cargo
CARGO_BIN=$(which cargo)
sudo -E CARGO=${CARGO_BIN} make coverage-codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
Expand Down
17 changes: 17 additions & 0 deletions misc/fscache/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# This script should be executed in root mode!

apt update
apt install -y cachefilesd
apt list --installed | grep cachefilesd
chmod a+w /etc/default/cachefilesd
sed -i 's/#RUN=yes/RUN=yes/' /etc/default/cachefilesd
cat /etc/default/cachefilesd
/sbin/modprobe -qab cachefiles
/sbin/cachefilesd -f /etc/cachefilesd.conf
systemctl status cachefilesd
[ -c /dev/cachefiles ] && echo "cachefilesd is successfully enabled"
pid=$(lsof /dev/cachefiles | awk '{if (NR>1) {print $2}}')
kill -9 $pid
echo "/dev/cachefiles is available now"

0 comments on commit 689900c

Please sign in to comment.