Skip to content

Commit

Permalink
Merge pull request nautobot#82 from nautobot/gh-actions
Browse files Browse the repository at this point in the history
GH action ready for review
  • Loading branch information
jvanderaa authored Sep 11, 2021
2 parents d1dfb5a + d528283 commit 9150130
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 80 deletions.
120 changes: 120 additions & 0 deletions .github/workflows/ci.yml
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"
80 changes: 0 additions & 80 deletions .travis.yml

This file was deleted.

0 comments on commit 9150130

Please sign in to comment.