Skip to content

Commit

Permalink
Add basic tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Jan 21, 2024
1 parent 49327a2 commit 1961a81
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

name: Action testing

'on':
push:
branches: [main]
pull_request:
branches: [main]
# Run once per week (Friday at 07:00 UTC)
schedule:
- cron: '0 7 * * 5'

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v4
with:
# This should **NOT** be the Python version used for the action itself
python-version: 3.12

- name: Install ansible-core
run: pip install ansible-core

- name: Build collection
run: |
ansible-galaxy collection build
mv foo-bar-1.2.3.tar.gz ..
ls -lah ..
working-directory: tests/foo.bar

- name: Run action
id: action
uses: ./
with:
artifact-path: tests/foo-bar-1.2.3.tar.gz
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SPDX-License-Identifier: GPL-3.0-or-later
# GitHub Action for testing importing an Ansible collection with the Galaxy importer

[![Linting](https://github.com/ansible-community/github-action-test-galaxy-import/actions/workflows/linting.yml/badge.svg)](https://github.com/ansible-community/github-action-test-galaxy-import/actions/workflows/linting.yml)
[![Tests](https://github.com/ansible-community/github-action-test-galaxy-import/actions/workflows/tests.yml/badge.svg)](https://github.com/ansible-community/github-action-test-galaxy-import/actions/workflows/tests.yml)
[![REUSE](https://github.com/ansible-community/github-action-test-galaxy-import/actions/workflows/reuse.yml/badge.svg)](https://github.com/ansible-community/github-action-test-galaxy-import/actions/workflows/reuse.yml)

A composite GitHub Action that allows to test importing a built Ansible collection with the [Galaxy importer](https://github.com/ansible/galaxy-importer) in GitHub Actions CI/CD workflows.
Expand Down
9 changes: 9 additions & 0 deletions tests/foo.bar/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!--
Copyright (c) Ansible Project
GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
SPDX-License-Identifier: GPL-3.0-or-later
-->

# Hello

Nothing to see.
17 changes: 17 additions & 0 deletions tests/foo.bar/galaxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

namespace: foo
name: bar
version: 1.2.3
readme: README.md
authors:
- Nobody
license:
- GPL-3.0-or-later
tags:
- test
repository: https://github.com/ansible-community/github-action-test-galaxy-import/
issues: https://github.com/ansible-community/github-action-test-galaxy-import/issues/
6 changes: 6 additions & 0 deletions tests/foo.bar/meta/runtime.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later

requires_ansible: '>=2.9.10'

0 comments on commit 1961a81

Please sign in to comment.