generated from ansible-collections/collection_template
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b25643
commit 1913a0d
Showing
6 changed files
with
205 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: CI | ||
on: | ||
# Run CI against all pushes (direct commits, also merged PRs), Pull Requests | ||
push: | ||
pull_request: | ||
# Run CI once per day (at 06:00 UTC) | ||
# This ensures that even if there haven't been commits that we are still testing against latest version of ansible-test for each ansible-base version | ||
schedule: | ||
- cron: '0 6 * * *' | ||
env: | ||
NAMESPACE: community | ||
COLLECTION_NAME: routeros | ||
|
||
jobs: | ||
extra-sanity: | ||
name: Extra Sanity | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
with: | ||
path: ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install ansible-core | ||
run: pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check | ||
|
||
- name: Install collection dependencies | ||
run: git clone --depth=1 --single-branch https://github.com/ansible-collections/community.internal_test_tools.git ./ansible_collections/community/internal_test_tools | ||
# NOTE: we're installing with git to work around Galaxy being a huge PITA (https://github.com/ansible/galaxy/issues/2429) | ||
# run: ansible-galaxy collection install community.internal_test_tools -p . | ||
|
||
- name: Run sanity tests | ||
run: ../../community/internal_test_tools/tools/run.py --color | ||
working-directory: ./ansible_collections/${{env.NAMESPACE}}/${{env.COLLECTION_NAME}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
name: import-galaxy | ||
on: | ||
# Run CI against all pushes (direct commits, also merged PRs) to main, and all Pull Requests | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
env: | ||
# Adjust this to your collection | ||
NAMESPACE: community | ||
COLLECTION_NAME: routeros | ||
|
||
jobs: | ||
build-collection: | ||
name: Build collection artifact | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
with: | ||
path: ./checkout | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install ansible-core | ||
run: pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check | ||
|
||
- name: Make sure galaxy.yml has version entry | ||
run: >- | ||
python -c | ||
'import yaml ; | ||
f = open("galaxy.yml", "rb") ; | ||
data = yaml.safe_load(f) ; | ||
f.close() ; | ||
data["version"] = data.get("version") or "0.0.1" ; | ||
f = open("galaxy.yml", "wb") ; | ||
f.write(yaml.dump(data).encode("utf-8")) ; | ||
f.close() ; | ||
' | ||
working-directory: ./checkout | ||
|
||
- name: Build collection | ||
run: ansible-galaxy collection build | ||
working-directory: ./checkout | ||
|
||
- name: Copy artifact into subdirectory | ||
run: mkdir ./artifact && mv ./checkout/${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}-*.tar.gz ./artifact | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}-${{ github.sha }} | ||
path: ./artifact/ | ||
|
||
import-galaxy: | ||
name: Import artifact with Galaxy importer | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build-collection | ||
steps: | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install ansible-core | ||
run: pip install https://github.com/ansible/ansible/archive/devel.tar.gz --disable-pip-version-check | ||
|
||
- name: Install galaxy-importer | ||
run: pip install galaxy-importer --disable-pip-version-check | ||
|
||
- name: Download artifact | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: ${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}-${{ github.sha }} | ||
|
||
- name: Run Galaxy importer | ||
run: python -m galaxy_importer.main ${{ env.NAMESPACE }}-${{ env.COLLECTION_NAME }}-*.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"include_symlinks": false, | ||
"prefixes": [ | ||
"docs/docsite/" | ||
], | ||
"output": "path-line-column-message", | ||
"requirements": [ | ||
"antsibull" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/env python | ||
# Copyright (c) Ansible Project | ||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
"""Check extra collection docs with antsibull-lint.""" | ||
from __future__ import (absolute_import, division, print_function) | ||
__metaclass__ = type | ||
|
||
import os | ||
import sys | ||
import subprocess | ||
|
||
|
||
def main(): | ||
"""Main entry point.""" | ||
if not os.path.isdir(os.path.join('docs', 'docsite')): | ||
return | ||
p = subprocess.run(['antsibull-lint', 'collection-docs', '.'], check=False) | ||
if p.returncode not in (0, 3): | ||
print('{0}:0:0: unexpected return code {1}'.format(sys.argv[0], p.returncode)) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"include_symlinks": true, | ||
"prefixes": [ | ||
"plugins/" | ||
], | ||
"output": "path-message" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/usr/bin/env python | ||
# Copyright (c) Ansible Project | ||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) | ||
"""Prevent unwanted files from being added to the source tree.""" | ||
from __future__ import (absolute_import, division, print_function) | ||
__metaclass__ = type | ||
|
||
import os | ||
import sys | ||
|
||
|
||
def main(): | ||
"""Main entry point.""" | ||
paths = sys.argv[1:] or sys.stdin.read().splitlines() | ||
|
||
allowed_extensions = ( | ||
'.cs', | ||
'.ps1', | ||
'.psm1', | ||
'.py', | ||
) | ||
|
||
skip_paths = set([ | ||
]) | ||
|
||
skip_directories = ( | ||
) | ||
|
||
for path in paths: | ||
if path in skip_paths: | ||
continue | ||
|
||
if any(path.startswith(skip_directory) for skip_directory in skip_directories): | ||
continue | ||
|
||
ext = os.path.splitext(path)[1] | ||
|
||
if ext not in allowed_extensions: | ||
print('%s: extension must be one of: %s' % (path, ', '.join(allowed_extensions))) | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |