Skip to content

update hitratio graph #260

update hitratio graph

update hitratio graph #260

Workflow file for this run

name: Rust build and test
on:
push:
branches: [ '**' ]
pull_request:
branches: [ "main" ]
workflow_dispatch: # Allows manual runs
env:
CARGO_TERM_COLOR: always
sector_size: 4096
zone_size: 128
zone_capacity: 0
disk_size: 32
max_open: 14
max_active: 14
zasl: 5
znsimg: /var/lib/qemu/images/zns.raw
ssdimg: /var/lib/qemu/images/ssd.raw
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup ssh
run: |
mkdir ~/.ssh
ssh-keyscan -H 127.0.0.1 >> ~/.ssh/known_hosts
- name: Install packages
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: qemu-system-x86 qemu-utils cloud-utils wget sshpass
version: 1.0
execute_install_scripts: true
- name: Cache Ubuntu Cloud Image
id: cache-ubuntu-restore
uses: actions/cache/restore@v4
with:
path: |
/tmp/ubuntu.qcow2
key: ubuntu-cloudimg-noble-${{ hashFiles('.github/workflows/rust.yml') }}
- name: Download Ubuntu Cloud Image
if: steps.cache-ubuntu.outputs.cache-hit != 'true'
run: |
wget -O /tmp/ubuntu.qcow2 https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img -o /dev/null
qemu-img resize /tmp/ubuntu.qcow2 12G
- name: Cache Ubuntu save Cloud Image
id: cache-ubuntu
uses: actions/cache/save@v4
with:
path: |
/tmp/ubuntu.qcow2
key: ${{ steps.cache-ubuntu-restore.outputs.cache-primary-key }}
- name: Create Cloud-Init Disk
run: |
cat > user-data <<EOF
#cloud-config
password: ubuntu
chpasswd: { expire: False }
ssh_pwauth: True
EOF
cloud-localds /tmp/cloud-init.iso user-data
- name: Make raw disk images
run: |
sudo mkdir -p "$(dirname ${znsimg})"
sudo touch ${znsimg}
sudo truncate -s "${disk_size}"G ${znsimg}
sudo mkdir -p "$(dirname ${ssdimg})"
sudo touch ${ssdimg}
sudo truncate -s "${disk_size}"G ${ssdimg}
- name: Run QEMU VM with Ubuntu
run: |
sudo qemu-system-x86_64 \
-enable-kvm \
-m 12G \
-smp $(nproc) \
-cpu host \
-drive file=/tmp/ubuntu.qcow2,format=qcow2,if=virtio \
-drive file=/tmp/cloud-init.iso,format=raw,if=virtio \
-net user,hostfwd=tcp::2222-:22 \
-net nic \
-device nvme,id=nvme0,serial=deadbeef,zoned.zasl="${zasl}" \
-drive file="${znsimg}",id=nvmezns0,format=raw,if=none \
-device nvme-ns,drive=nvmezns0,bus=nvme0,nsid=1,logical_block_size="${sector_size}",physical_block_size="${sector_size}",zoned=true,zoned.zone_size="${zone_size}"M,zoned.zone_capacity="${zone_capacity}"M,zoned.max_open="${max_open}",zoned.max_active="${max_active}",uuid=5e40ec5f-eeb6-4317-bc5e-c919796a5f79 \
-device nvme,id=nvme1,serial=deadbaaf \
-drive file="${ssdimg}",id=nvmessd1,format=raw,if=none \
-device nvme-ns,drive=nvmessd1,bus=nvme1,nsid=1,logical_block_size="${sector_size}",physical_block_size="${sector_size}",zoned=false,uuid=5e40ec5f-eeb6-4317-bc5e-c919796a5f7a \
-nographic &
# Wait for SSH
for i in {1..60}; do
if sshpass -p "ubuntu" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=2 -p 2222 ubuntu@127.0.0.1 true; then
echo "SSH is up"; break
fi
sleep 5
done
- name: Copy files and install dependencies
run: |
sshpass -p "ubuntu" scp -o StrictHostKeyChecking=no -P 2222 -r $GITHUB_WORKSPACE ubuntu@127.0.0.1:/home/ubuntu/OxCache
sshpass -p "ubuntu" ssh -o StrictHostKeyChecking=no -p 2222 ubuntu@127.0.0.1 << 'EOF'
sudo apt update && sudo apt install -y build-essential libclang-dev meson ninja-build
curl https://sh.rustup.rs -sSf | sh -s -- -y
. "$HOME/.cargo/env"
cd OxCache && RUNNING_IN_GITHUB_ACTIONS=yes cargo build
EOF
- name: Test
run: sshpass -p "ubuntu" ssh -o StrictHostKeyChecking=no -p 2222 ubuntu@127.0.0.1 \
'cd OxCache && sudo env "HOME=/home/ubuntu" bash -c ". /home/ubuntu/.cargo/env && RUNNING_IN_GITHUB_ACTIONS=yes cargo test --lib"'
# To SSH into actions
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3