forked from nautobot/nautobot-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request nautobot#82 from nautobot/gh-actions
GH action ready for review
- Loading branch information
Showing
2 changed files
with
120 additions
and
80 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,120 @@ | ||
--- | ||
name: "CI" | ||
on: | ||
- "push" | ||
- "pull_request" | ||
|
||
jobs: | ||
lint: | ||
runs-on: "ubuntu-20.04" | ||
steps: | ||
- name: "Check out repository code" | ||
uses: "actions/checkout@v2" | ||
- name: "Install invoke" | ||
run: "pip install -U pip && pip install invoke" | ||
- name: "Start containers" | ||
run: "invoke start" | ||
- name: "Linting" | ||
run: "invoke lint" | ||
test: | ||
runs-on: "ubuntu-20.04" | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
python-version: ["3.6", "3.7", "3.8", "3.9"] | ||
env: | ||
INVOKE_NAUTOBOT_ANSIBLE_PYTHON_VER: "${{ matrix.python-version }}" | ||
steps: | ||
- name: "Check out repository code" | ||
uses: "actions/checkout@v2" | ||
- name: "Install invoke" | ||
run: "pip install -U pip && pip install invoke" | ||
- name: "Start containers" | ||
run: "invoke start" | ||
- name: "Tests" | ||
run: "invoke unit" | ||
needs: | ||
- "lint" | ||
integration: | ||
runs-on: "ubuntu-20.04" | ||
strategy: | ||
fail-fast: true | ||
matrix: | ||
# Need to check what is needed for the integration step | ||
# python-version: ["3.6", "3.7", "3.8", "3.9"] | ||
# nautobot-version: ["1.0.3", "1.1.1"] | ||
# ansible-release: ["base", "core"] | ||
include: | ||
- python-version: "3.6" | ||
nautobot-version: "1.0.3" | ||
ansible-release: "base" | ||
- python-version: "3.7" | ||
nautobot-version: "1.1.1" | ||
ansible-release: "core" | ||
env: | ||
INVOKE_NAUTOBOT_ANSIBLE_PYTHON_VER: "${{ matrix.python-version }}" | ||
INVOKE_NAUTOBOT_ANSIBLE_NAUTOBOT_VER: "${{ matrix.nautobot-version }}" | ||
steps: | ||
- name: "Check out repository code" | ||
uses: "actions/checkout@v2" | ||
- name: "Install invoke" | ||
run: "pip install -U pip && pip install invoke" | ||
- name: "Install poetry" | ||
if: "${{ matrix.ansible-release == 'core' }}" | ||
run: "pip install poetry" | ||
- name: "Remove ansible-base" | ||
if: "${{ matrix.ansible-release == 'core' }}" | ||
run: "poetry remove ansible-base" | ||
- name: "Remove ansible-core" | ||
if: "${{ matrix.ansible-release == 'core' }}" | ||
run: "poetry add ansible-core" | ||
- name: "Start containers" | ||
run: "invoke start" | ||
- name: "Tests" | ||
run: "invoke integration" | ||
needs: | ||
- "test" | ||
publish_github: | ||
name: "Publish to GitHub" | ||
runs-on: "ubuntu-20.04" | ||
if: "startsWith(github.ref, 'refs/tags/v')" | ||
steps: | ||
- name: "Check out repository code" | ||
uses: "actions/checkout@v2" | ||
- name: "Set up Python" | ||
uses: "actions/setup-python@v2" | ||
with: | ||
python-version: "3.9" | ||
- name: "Install Python Packages" | ||
run: "pip install ansible-core" | ||
- name: "Build the collection" | ||
run: "ansible-galaxy collection build --output-path build" | ||
- name: "Upload binaries to release" | ||
uses: "svenstaro/upload-release-action@v2" | ||
with: | ||
repo_token: "${{ secrets.NTC_GITHUB_TOKEN }}" | ||
file: "build/*" | ||
tag: "${{ github.ref }}" | ||
overwrite: true | ||
file_glob: true | ||
needs: | ||
- "integration" | ||
publish_galaxy: | ||
name: "Publish to Ansible Galaxy" | ||
runs-on: "ubuntu-20.04" | ||
if: "startsWith(github.ref, 'refs/tags/v')" | ||
steps: | ||
- name: "Check out repository code" | ||
uses: "actions/checkout@v2" | ||
- name: "Set up Python" | ||
uses: "actions/setup-python@v2" | ||
with: | ||
python-version: "3.9" | ||
- name: "Install Python Packages" | ||
run: "pip install ansible-core" | ||
- name: "Build the collection" | ||
run: "ansible-galaxy collection build --output-path build" | ||
- name: "Publish the collection" | ||
run: "ansible-galaxy collection publish build/* --api-key=${{ secrets.GALAXY_API_TOKEN }}" | ||
needs: | ||
- "integration" |
This file was deleted.
Oops, something went wrong.