Skip to content

feat(cache): revalidate cache #581

feat(cache): revalidate cache

feat(cache): revalidate cache #581

Workflow file for this run

name: Test podman-compose.yml
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
TERM: xterm-color
PY_COLORS: 1
LOG_LEVEL: DEBUG
jobs:
direct:
runs-on: ubuntu-24.04
name: podman-compose
steps:
- uses: actions/checkout@v4
- name: Install prereqs
run: sudo apt-get install -y jq
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Build the containers
run: |
uv run podman-compose build
- name: Start the containers
run: |
podman network create asu-build
podman system service --time=0 "unix://$(pwd)/podman.sock" &
uv run podman-compose up -d
- name: Let the containers start
run: sleep 30
- name: Test startup
run: |
curl -s http://localhost:8000/api/v1/stats | tee response.json | jq
[ "$(jq -r '.queue_length' response.json)" -eq 0 ] || exit 1
- name: Test build
run: |
for i in {1..20}; do
curl 'http://localhost:8000/api/v1/build' \
--request 'POST' \
--header 'Content-Type: application/json' \
--data @tests/ci/openwrt-one-24.10.0.json | tee response.json | jq
if [ "$(jq -r '.status' response.json)" -eq 200 ]; then
break
fi
if [ $i -eq 20 ]; then
exit 1
fi
sleep 10
done
cached:
runs-on: ubuntu-24.04
name: podman-compose with nginx cache
steps:
- uses: actions/checkout@v4
- name: Install prereqs
run: sudo apt-get install -y jq
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Build the containers
run: |
uv run podman-compose build
- name: Start the containers with cache
run: |
podman network create asu-build
podman system service --time=0 "unix://$(pwd)/podman.sock" &
cp tests/ci/asu-cache.toml asu.toml
uv run podman-compose -f podman-compose.yml -f podman-compose.cache.yml up -d
- name: Let the containers start
run: sleep 30
- name: Test startup
run: |
curl -s http://localhost:8000/api/v1/stats | tee response.json | jq
[ "$(jq -r '.queue_length' response.json)" -eq 0 ] || exit 1
- name: Test first build
run: |
for i in {1..20}; do
curl 'http://localhost:8000/api/v1/build' \
--request 'POST' \
--header 'Content-Type: application/json' \
--data @tests/ci/openwrt-one-24.10.0.json | tee response.json | jq
if [ "$(jq -r '.status' response.json)" -eq 200 ]; then
break
fi
if [ $i -eq 20 ]; then
exit 1
fi
sleep 10
done
- name: Count first build cache misses
run: |
uv run podman-compose -f podman-compose.yml -f podman-compose.cache.yml logs cache 2>&1 | grep -c "cache=MISS" | tee /tmp/first_miss_count
echo "First build MISS count: $(cat /tmp/first_miss_count)"
- name: Test second build (same image + vim, should hit cache)
run: |
for i in {1..20}; do
curl 'http://localhost:8000/api/v1/build' \
--request 'POST' \
--header 'Content-Type: application/json' \
--data @tests/ci/openwrt-one-24.10.0-vim.json | tee response.json | jq
if [ "$(jq -r '.status' response.json)" -eq 200 ]; then
break
fi
if [ $i -eq 20 ]; then
exit 1
fi
sleep 10
done
- name: Verify second build used cache
run: |
uv run podman-compose -f podman-compose.yml -f podman-compose.cache.yml logs cache 2>&1 | tee cache.log
total_misses=$(grep -c "cache=MISS" cache.log)
first_misses=$(cat /tmp/first_miss_count)
second_misses=$((total_misses - first_misses))
echo "First build: $first_misses MISS, second build: $second_misses MISS"
[ "$second_misses" -lt "$first_misses" ]