From f7aa12af79ad0297fc681cbf88b26c3802b84e5d Mon Sep 17 00:00:00 2001 From: Felix Fontein Date: Sun, 21 Jan 2024 15:59:20 +0100 Subject: [PATCH] Add basic tests. --- .github/workflows/tests.yml | 41 +++++++++++++++++++++++++++++++++++++ README.md | 1 + tests/foo.bar/README.md | 9 ++++++++ tests/foo.bar/galaxy.yml | 15 ++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 .github/workflows/tests.yml create mode 100644 tests/foo.bar/README.md create mode 100644 tests/foo.bar/galaxy.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..997e486 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,41 @@ +--- +# 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: + python-version: 3.12 + + - name: Install ansible-core + run: pip install ansible-core + + - name: Build collection + run: ansible-galaxy collection build + working-directory: tests/foo.bar + + - name: Run action + id: action + uses: . + with: + artifact-path: tests/foo.bar/foo-bar-1.2.3.tar.gz diff --git a/README.md b/README.md index 1562c4a..2311dd8 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/tests/foo.bar/README.md b/tests/foo.bar/README.md new file mode 100644 index 0000000..0ffb829 --- /dev/null +++ b/tests/foo.bar/README.md @@ -0,0 +1,9 @@ + + +# Hello + +Nothing to see. diff --git a/tests/foo.bar/galaxy.yml b/tests/foo.bar/galaxy.yml new file mode 100644 index 0000000..4d5a01f --- /dev/null +++ b/tests/foo.bar/galaxy.yml @@ -0,0 +1,15 @@ +--- +# 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