From 1d40c4d2c9eacb5d902924644d089fe340c4d7ba Mon Sep 17 00:00:00 2001 From: Xan Manning Date: Sat, 12 Dec 2020 16:21:17 +0000 Subject: [PATCH] Migration from Travis-CI to GitHub Actions --- .github/workflows/ci.yml | 61 ++++++++++++++++++++++ .github/workflows/release.yml | 32 ++++++++++++ .travis.yml | 56 -------------------- README.md | 2 +- molecule/autodeploy/molecule.yml | 6 +-- molecule/debug/molecule.yml | 6 +-- molecule/default/molecule.yml | 6 +-- molecule/highavailabilitydb/molecule.yml | 6 +-- molecule/highavailabilityetcd/molecule.yml | 6 +-- molecule/nodeploy/molecule.yml | 6 +-- 10 files changed, 112 insertions(+), 75 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..4617a6b --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +--- + +name: CI +'on': + pull_request: + push: + branches: + - master + - main + - v1_release + schedule: + - cron: "0 1 1 * *" + +defaults: + run: + working-directory: "xanmanning.k3s" + +jobs: + molecule: + name: Molecule + runs-on: ubuntu-latest + strategy: + matrix: + distro: + - centos7 + - centos8 + - debian9 + - debian10 + - ubuntu1804 + - ubuntu2004 + - amazonlinux2 + - fedora31 + - fedora30 + - fedora29 + scenario: + - default + - nodeploy + - autodeploy + - highavailabilitydb + - highavailabilityetcd + + steps: + - name: Checkout codebase + uses: actions/checkout@v2 + with: + path: "xanmanning.k3s" + + - name: Set up Python 3 + uses: actions/setup-python@v2 + with: + python-version: "3.x" + + - name: Install test dependencies + run: pip3 install -r molecule/requirements.txt + + - name: Run Molecule tests + run: molecule test --scenario-name "${{ matrix.scenario }}" + env: + PY_COLORS: '1' + ANSIBLE_FORCE_COLOR: '1' + MOLECULE_DISTRO: ${{ matrix.distro }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..22a7d22 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,32 @@ +--- + +name: Release +'on': + push: + tags: + - '*' + +defaults: + run: + working-directory: "xanmanning.k3s" + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout codebase + uses: actions/checkout@v2 + with: + path: "xanmanning.k3s" + + - name: Set up Python 3 + uses: actions/setup-python@v2 + with: + python-version: "3.x" + + - name: Install Ansible + run: pip3 install -r requirements.txt + + - name: Trigger a new import on Galaxy + run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2) diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ce50054..0000000 --- a/.travis.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- - -# Thanks to geerlingguy! - -language: python -services: docker - -env: - global: - - ROLE_NAME: k3s - - ROLE_OWNER: xanmanning - - REPO_OWNER: PyratLabs - - MOLECULE_SCENARIO: default - matrix: - - MOLECULE_DISTRO: geerlingguy/docker-debian10-ansible:latest - - MOLECULE_DISTRO: geerlingguy/docker-ubuntu2004-ansible:latest - - MOLECULE_DISTRO: geerlingguy/docker-amazonlinux2-ansible:latest - - # Test installing docker - - MOLECULE_DISTRO: geerlingguy/docker-centos7-ansible:latest - MOLECULE_SCENARIO: docker - - MOLECULE_DISTRO: geerlingguy/docker-ubuntu1804-ansible:latest - MOLECULE_SCENARIO: docker - - # Test disabling all deployments - - MOLECULE_DISTRO: geerlingguy/docker-fedora31-ansible:latest - MOLECULE_SCENARIO: nodeploy - - # Test multiple control nodes in control plane with PostgreSQL - - MOLECULE_DISTRO: geerlingguy/docker-fedora29-ansible:latest - MOLECULE_SCENARIO: highavailabilitydb - - # Test multiple control nodes with auto deploying manifests - - MOLECULE_DISTRO: geerlingguy/docker-fedora30-ansible:latest - MOLECULE_SCENARIO: autodeploy - - # Test multiple control nodes in control plane with Etcd - - MOLECULE_DISTRO: geerlingguy/docker-centos8-ansible:latest - MOLECULE_SCENARIO: highavailabilityetcd - -install: - # Install test dependencies. - - pip install -r molecule/requirements.txt - -before_script: - # Use actual Ansible Galaxy role name for the project directory. - - cd ../ - - mv ansible-role-${ROLE_NAME} ${ROLE_OWNER}.${ROLE_NAME} - - cd ${ROLE_OWNER}.${ROLE_NAME} - -script: - # Run tests. - - molecule test --scenario-name "${MOLECULE_SCENARIO}" - -notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/README.md b/README.md index 28c2abf..0a6aa84 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Ansible role for installing [Rancher k3s](https://k3s.io/) ("Lightweight Kubernetes") as either a standalone server or cluster. -[![Build Status](https://www.travis-ci.org/PyratLabs/ansible-role-k3s.svg?branch=master)](https://www.travis-ci.org/PyratLabs/ansible-role-k3s) +[![CI](https://github.com/PyratLabs/ansible-role-k3s/workflows/CI/badge.svg?event=push)](https://github.com/PyratLabs/ansible-role-k3s/actions?query=workflow%3ACI) ## Release notes diff --git a/molecule/autodeploy/molecule.yml b/molecule/autodeploy/molecule.yml index af6a516..a80cf69 100644 --- a/molecule/autodeploy/molecule.yml +++ b/molecule/autodeploy/molecule.yml @@ -10,7 +10,7 @@ lint: | ansible-lint platforms: - name: node1 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro @@ -19,7 +19,7 @@ platforms: networks: - name: k3snet - name: node2 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro @@ -28,7 +28,7 @@ platforms: networks: - name: k3snet - name: node3 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro diff --git a/molecule/debug/molecule.yml b/molecule/debug/molecule.yml index af6a516..a80cf69 100644 --- a/molecule/debug/molecule.yml +++ b/molecule/debug/molecule.yml @@ -10,7 +10,7 @@ lint: | ansible-lint platforms: - name: node1 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro @@ -19,7 +19,7 @@ platforms: networks: - name: k3snet - name: node2 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro @@ -28,7 +28,7 @@ platforms: networks: - name: k3snet - name: node3 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index af6a516..a80cf69 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -10,7 +10,7 @@ lint: | ansible-lint platforms: - name: node1 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro @@ -19,7 +19,7 @@ platforms: networks: - name: k3snet - name: node2 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro @@ -28,7 +28,7 @@ platforms: networks: - name: k3snet - name: node3 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro diff --git a/molecule/highavailabilitydb/molecule.yml b/molecule/highavailabilitydb/molecule.yml index 7028ac9..7c16a30 100644 --- a/molecule/highavailabilitydb/molecule.yml +++ b/molecule/highavailabilitydb/molecule.yml @@ -10,7 +10,7 @@ lint: | ansible-lint platforms: - name: node1 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro @@ -19,7 +19,7 @@ platforms: networks: - name: k3snet - name: node2 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro @@ -28,7 +28,7 @@ platforms: networks: - name: k3snet - name: node3 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro diff --git a/molecule/highavailabilityetcd/molecule.yml b/molecule/highavailabilityetcd/molecule.yml index 2a32b15..7d51c00 100644 --- a/molecule/highavailabilityetcd/molecule.yml +++ b/molecule/highavailabilityetcd/molecule.yml @@ -10,7 +10,7 @@ lint: | ansible-lint platforms: - name: node1 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro @@ -19,7 +19,7 @@ platforms: networks: - name: k3snet - name: node2 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro @@ -28,7 +28,7 @@ platforms: networks: - name: k3snet - name: node3 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro diff --git a/molecule/nodeploy/molecule.yml b/molecule/nodeploy/molecule.yml index af6a516..a80cf69 100644 --- a/molecule/nodeploy/molecule.yml +++ b/molecule/nodeploy/molecule.yml @@ -10,7 +10,7 @@ lint: | ansible-lint platforms: - name: node1 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro @@ -19,7 +19,7 @@ platforms: networks: - name: k3snet - name: node2 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro @@ -28,7 +28,7 @@ platforms: networks: - name: k3snet - name: node3 - image: "${MOLECULE_DISTRO:-geerlingguy/docker-centos8-ansible:latest}" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos8}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro