Skip to content

Add integration tests with minimal toy spread project - #12

Merged
zyga merged 7 commits into
mainfrom
copilot/add-integration-tests-toy-project
Jan 21, 2026
Merged

Add integration tests with minimal toy spread project#12
zyga merged 7 commits into
mainfrom
copilot/add-integration-tests-toy-project

Conversation

Copilot AI commented Jan 16, 2026

Copy link
Copy Markdown
Contributor
  • Create tests/toy/.image-garden/README.md file with SPDX headers
  • Create tests/toy/.image-garden.mk file (empty with SPDX headers)
  • Create tests/toy/spread.yaml configuration file
  • Create tests/toy/tests/success/task.yaml test file
  • Create .github/workflows/integration-test.yaml workflow file
  • Update .gitignore to exclude .image-garden directory contents except README.md
  • Run formatting and linting checks (all pass)
  • Fix system name to include "cloud" designation (ubuntu-cloud-24.04)
  • Fix cache actions to properly use spread-subdir in path attribute
  • Verify all files follow project standards

The integration test setup is complete and ready to run in CI. The workflow will automatically trigger on pushes to main and pull requests.

Original prompt

Add integration tests that demonstrate the action working with a minimal toy spread project.

Requirements

  1. Create a minimal toy spread project in a tests/toy/ directory that:

    • Contains a spread.yaml configuration file with:
      • Basic project metadata
      • A simple garden backend definition
      • A test suite pointing to a tests directory
      • At least one system to test on (e.g., ubuntu-24.04)
    • Contains a tests/success/task.yaml file with a task that:
      • Prints "hello world" message
      • Succeeds without errors
    • Contains .image-garden/README.md file (as per project documentation)
    • Contains .image-garden.mk file (can be empty)
  2. Create a GitHub Actions workflow in .github/workflows/ that:

    • Runs the integration test using the action
    • Uses the toy spread project from tests/toy/
    • Uses the action with default/minimal inputs
    • Triggers on push to main and pull requests
    • Runs on ubuntu-latest
    • Specifies garden-system: ubuntu-24.04 (or similar available system)
    • Uses spread-subdir: tests/toy
  3. Ensure all files follow the project standards:

    • Include SPDX license headers
    • Use proper YAML formatting (2 spaces)
    • Follow shell script standards where applicable

Goals

  • Provide a working example of how to use the action
  • Enable testing of the action itself in CI
  • Serve as a baseline integration test that can catch regressions

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Add integration tests for minimal toy spread project Add integration tests with minimal toy spread project Jan 16, 2026
Copilot AI requested a review from zyga January 16, 2026 22:34

@zyga zyga left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

@copilot This looks almost correct. Have a look at inline comments.

Comment thread .github/workflows/integration-test.yaml Outdated
Comment thread tests/toy/spread.yaml Outdated
@zyga

zyga commented Jan 16, 2026

Copy link
Copy Markdown
Owner

@copilot Can you rebase the branch on current main and force push?

Copilot AI commented Jan 16, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Can you rebase the branch on current main and force push?

I've successfully rebased the branch on current main (commit 3e6a5a8). However, I don't have the capability to force push since the report_progress tool doesn't support force pushing when branches have diverged. The rebase is complete locally - the branch now contains 4 commits on top of ce47413 (latest main). You may need to force push manually or grant me force push capabilities.

Comment thread action.yaml Outdated

@zyga zyga left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

It seems that working-directory doesn't work for non-composite action such as cache. The input value should instead be used in the path attribute and combined with the existing value.

Copilot AI requested a review from zyga January 16, 2026 23:16
@zyga
zyga force-pushed the copilot/add-integration-tests-toy-project branch from 1d16947 to 0b8489d Compare January 20, 2026 19:21
Copilot AI and others added 7 commits January 21, 2026 12:35
Co-authored-by: zyga <784262+zyga@users.noreply.github.com>
Co-authored-by: zyga <784262+zyga@users.noreply.github.com>
Co-authored-by: zyga <784262+zyga@users.noreply.github.com>
…read-subdir

Co-authored-by: zyga <784262+zyga@users.noreply.github.com>
@zyga
zyga force-pushed the copilot/add-integration-tests-toy-project branch from 0b8489d to bd10d1b Compare January 21, 2026 11:36

@zyga zyga left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I'm still amazed this worked

@zyga
zyga marked this pull request as ready for review January 21, 2026 11:42
Copilot AI review requested due to automatic review settings January 21, 2026 11:42
@zyga
zyga merged commit 7d0845a into main Jan 21, 2026
1 check passed
@zyga
zyga deleted the copilot/add-integration-tests-toy-project branch January 21, 2026 11:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR adds integration tests to demonstrate the action working with a minimal toy spread project. It creates a complete test setup in tests/toy/ and a GitHub Actions workflow to run these tests in CI, while also fixing a bug in the cache key calculation for the spread-subdir parameter.

Changes:

  • Created a minimal toy spread project in tests/toy/ with basic configuration and a simple success test
  • Added .github/workflows/integration-test.yaml workflow to run the toy integration test in CI
  • Fixed cache key in action.yaml to properly use spread-subdir when calculating the hash of .image-garden.mk
  • Updated .gitignore to exclude .image-garden directory contents except README.md

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/toy/tests/success/task.yaml Minimal test task that prints hello world messages to verify test execution
tests/toy/spread.yaml Spread configuration for the toy project with garden backend and ubuntu-cloud-24.04 system
tests/toy/.image-garden/README.md Documentation for the image-garden state directory
tests/toy/.image-garden.mk Empty makefile for image-garden customization (required by the action)
action.yaml Fixed cache key to properly use spread-subdir in hashFiles format expression
.gitignore Added patterns to exclude .image-garden directory contents while keeping README.md
.github/workflows/integration-test.yaml Integration test workflow that runs the toy test using the action

Comment thread action.yaml
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants