Skip to content

test: add Layer 4 real-GHA tests (TestGHACacheReal) #235

test: add Layer 4 real-GHA tests (TestGHACacheReal)

test: add Layer 4 real-GHA tests (TestGHACacheReal) #235

Workflow file for this run

name: CI
on:
- push
- pull_request
- workflow_dispatch
jobs:
ci-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Python
run: |
# Install dependencies required to load ivpm.yaml file
./bootstrap.sh
./packages/python/bin/python3 -m pip install setuptools build --upgrade
- name: Run Tests
run: |
export PYTHONPATH=$(pwd)/src:$(pwd)/test
cd test
../packages/python/bin/python3 -m unittest
- name: Build Package
run: |
#sed -i -e "s/version = \"\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)\"/version = \"\1.${GITHUB_RUN_ID}a1\"/g" pyproject.toml
sed -i -e "s/version = \"\([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\)\"/version = \"\1.${GITHUB_RUN_ID}\"/g" pyproject.toml
./packages/python/bin/python3 -m build .
- name: Build Docs
run: |
./packages/python/bin/python3 -m pip install sphinx sphinx-jsonschema sphinx-argparse sphinx-rtd-theme
./packages/python/bin/sphinx-build -M html ./docs/source build
cp src/ivpm/share/ivpm.json build/html/
cp src/ivpm/share/ivpm.json build/html/ivpm.schema.json
touch build/html/.nojekyll
- name: Publish to PyPi
if: ${{ startsWith(github.ref, 'refs/heads/master') }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
- name: Publish Docs
if: ${{ startsWith(github.ref, 'refs/heads/master') }}
uses: JamesIves/github-pages-deploy-action@4.1.7
with:
branch: gh-pages
folder: build/html
gha-cache-integration:
runs-on: ubuntu-latest
services:
cache-server:
image: ghcr.io/falcondev-oss/github-actions-cache-server:8
ports:
- 3000:3000
env:
API_BASE_URL: http://localhost:3000
STORAGE_DRIVER: filesystem
STORAGE_FILESYSTEM_PATH: /data/cache
DB_DRIVER: sqlite
DB_SQLITE_PATH: /data/cache-server.db
steps:
- uses: actions/checkout@v4
- name: Configure Python
run: |
./bootstrap.sh
./packages/python/bin/python3 -m pip install setuptools build --upgrade
- name: Run GHA cache integration tests
env:
IVPM_TEST_GHA_SERVER: "1"
ACTIONS_CACHE_URL: http://localhost:3000/
ACTIONS_RUNTIME_TOKEN: ivpm-ci-test-token
run: |
export PYTHONPATH=$(pwd)/src:$(pwd)/test
cd test
../packages/python/bin/python3 -m unittest unit.test_gha_integration -v
- name: Verify cache-backend=gha (first run — populate)
env:
ACTIONS_CACHE_URL: http://localhost:3000/
ACTIONS_RUNTIME_TOKEN: ivpm-ci-test-token
IVPM_CACHE: /tmp/ivpm-cache
run: |
export PYTHONPATH=$(pwd)/src
./packages/python/bin/python3 -m ivpm update --cache-backend gha --skip-py-install \
2>&1 | tee /tmp/ivpm-run1.log
- name: Verify cache-backend=gha (second run — cache hit)
env:
ACTIONS_CACHE_URL: http://localhost:3000/
ACTIONS_RUNTIME_TOKEN: ivpm-ci-test-token
IVPM_CACHE: /tmp/ivpm-cache-hit
run: |
export PYTHONPATH=$(pwd)/src
./packages/python/bin/python3 -m ivpm update --cache-backend gha --skip-py-install \
2>&1 | tee /tmp/ivpm-run2.log
# At least one "Restored … from GHA cache" message should appear
grep -q "Restored" /tmp/ivpm-run2.log || \
{ echo "ERROR: expected 'Restored' in second run log"; cat /tmp/ivpm-run2.log; exit 1; }