Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/integration-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Canonical Ltd.
name: Integration Tests
on:
push:
branches: ["main"]
pull_request:
jobs:
toy-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run toy integration test
uses: ./
with:
garden-system: ubuntu-cloud-24.04
spread-subdir: tests/toy
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Canonical Ltd.
.image-garden/*
!.image-garden/README.md
2 changes: 1 addition & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ runs:
path: |
${{ inputs.spread-subdir }}/.image-garden
!${{ inputs.spread-subdir }}/.image-garden/*.log
key: image-garden-img-${{ inputs.garden-system }}-${{ hashFiles('.image-garden.mk') }}
key: image-garden-img-${{ inputs.garden-system }}-${{ hashFiles(format('{0}/.image-garden.mk', inputs.spread-subdir)) }}
- name: Restore mtime of .image-garden.mk
if: hashFiles('.image-garden.mk') != ''

Copilot AI Jan 21, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hashFiles condition should respect the spread-subdir input parameter. When spread-subdir is set to a non-default value (like 'tests/toy'), this condition will look for '.image-garden.mk' in the wrong location (repository root instead of the subdirectory). This is inconsistent with line 87 which correctly uses format to construct the path with spread-subdir, and with line 91 which sets working-directory to the spread-subdir. The condition should use format to construct the correct path, similar to line 87.

Suggested change
if: hashFiles('.image-garden.mk') != ''
if: hashFiles(format('{0}/.image-garden.mk', inputs.spread-subdir)) != ''

Copilot uses AI. Check for mistakes.
shell: bash
Expand Down
2 changes: 2 additions & 0 deletions tests/toy/.image-garden.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Canonical Ltd.
13 changes: 13 additions & 0 deletions tests/toy/.image-garden/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!--
SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: Canonical Ltd.
-->

# Image Garden State Directory

This directory is used by `image-garden` to store large temporary files.
It should be ignored in `.gitignore` apart from this `README.md` file
itself.

Consult documentation of [spread](https://github.com/canonical/spread) and
[image-garden](https://gitlab.com/zygoon/image-garden).
27 changes: 27 additions & 0 deletions tests/toy/spread.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Canonical Ltd.
project: toy
path: /root/toy
exclude:
- .image-garden/
- .git
backends:
garden:
type: adhoc
allocate: |
if [ -n "${SPREAD_HOST_PATH-}" ]; then
PATH="$SPREAD_HOST_PATH"
fi
exec image-garden allocate "$SPREAD_SYSTEM"."$(uname -m)"
discard: |
if [ -n "${SPREAD_HOST_PATH-}" ]; then
PATH="$SPREAD_HOST_PATH"
fi
exec image-garden discard "$SPREAD_SYSTEM_ADDRESS"
systems:
- ubuntu-cloud-24.04:
username: root
password: root
suites:
tests/:
summary: Toy integration tests
6 changes: 6 additions & 0 deletions tests/toy/tests/success/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Canonical Ltd.
summary: Simple success test that prints hello world
execute: |
echo "hello world"
echo "Integration test successful!"