From dff4a97aa42fdf601d8482e1fbacd34cb8f7802b Mon Sep 17 00:00:00 2001 From: Aaron Guise Date: Fri, 20 Dec 2024 10:50:16 +1300 Subject: [PATCH] =?UTF-8?q?ci:=20Updated=20CI=20workflow=20for=20Gitea=20?= =?UTF-8?q?=20=F0=9F=9A=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci.yml | 121 +++++++++++++++++++++++++++++++++++++++ requirements.txt | 10 ++-- requirements.yml | 1 + 3 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..984492a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,121 @@ +name: CI +on: + push: + branches: + - "**" + tags: + - "!**" + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + cache: 'pip' # caching pip dependencies + - name: Ensure requirements are installed + run: pip install -r requirements.txt + - name: Lint with ansible-lint + run: ansible-lint -c ".ansible-lint" + env: + PY_COLORS: '1' + ANSIBLE_FORCE_COLOR: '1' + - name: Lint with yamllint + run: yamllint . + env: + PY_COLORS: '1' + ANSIBLE_FORCE_COLOR: '1' + molecule: + name: Molecule Test + runs-on: ubuntu-latest + needs: lint + strategy: + fail-fast: true + matrix: + os: [almalinux8, almalinux9] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + cache: 'pip' # caching pip dependencies + + - name: Ensure requirements are installed + run: pip install -r requirements.txt + + - name: Ensure required collections/roles are installed + run: ansible-galaxy install -r requirements.yml + + - name: Run Molecule tests on ${{ matrix.os }} + run: molecule test --scenario-name ${MOLECULE_SCENARIO:-default} + env: + PY_COLORS: '1' + ANSIBLE_FORCE_COLOR: '1' + MOLECULE_DISTRO: ${{ matrix.os }} + AUTH_DUO_IKEY: ${{ secrets.auth_duo_ikey }} + AUTH_DUO_SKEY: ${{ secrets.auth_duo_skey }} + AUTH_DUO_HOST: ${{ secrets.auth_duo_host }} + AUTH_DUO_MIRROR_URL: ${{ secrets.auth_duo_mirror_url }} + release: + runs-on: ubuntu-latest + needs: + - lint + - molecule + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v5 + with: + go-version: '1.22' + - name: Install gitea provider for Go Semantic Release + run: | + mkdir -p .semrel/$(go env GOOS)_$(go env GOARCH)/provider-gitea/${GITEA_PROVIDER_VER}/ && \ + wget https://github.com/cybercinch/go-semantic-release-provider-gitea/releases/download/v${GITEA_PROVIDER_VER}/go-semantic-release-provider-gitea_v${GITEA_PROVIDER_VER}_linux_amd64 \ + -O .semrel/$(go env GOOS)_$(go env GOARCH)/provider-gitea/${GITEA_PROVIDER_VER}/gitea && \ + chmod a+x .semrel/$(go env GOOS)_$(go env GOARCH)/provider-gitea/${GITEA_PROVIDER_VER}/gitea + env: + GITEA_PROVIDER_VER: 1.0.11 + - run: | + echo "github repo: ${GITHUB_REPOSITORY}" + echo "env vars: $(env)" + - uses: go-semantic-release/action@v1 + with: + custom-arguments: --provider=gitea + env: + GITEA_TOKEN: ${{ secrets.G_TOKEN }} + GITEA_HOST: ${{ secrets.G_SERVER_URL}} + notify: + runs-on: ubuntu-latest + needs: + - lint + - molecule + - release + steps: + - name: ntfy-success-notifications + uses: niniyas/ntfy-action@master + if: success() + with: + url: '${{ vars.NTFY_URL }}' + title: Workflow success - ansible-role-auth-duo + topic: 'ci-status' + priority: 4 + tags: +1,partying_face,action,successfully,completed + details: Workflow has been successfully completed! + icon: 'https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png' + image: true + + - name: ntfy-failed-notifications + uses: niniyas/ntfy-action@master + if: failure() + with: + url: '${{ vars.NTFY_URL }}' + title: Workflow failed - ansible-role-auth-duo + topic: 'ci-status' + priority: 5 + tags: -1,skull,action,failed + details: Workflow has failed! + actions: 'default' \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index e1585f8..6646d6f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,6 @@ ansible-core<2.17 -ansible-compat<4 -molecule[docker]<5.0.0 -ansible-lint==6.16.2 -yamllint==1.32.0 -passlib==1.7.4 +ansible-compat >= 4 +molecule[docker]== 24.2.1 +ansible-lint==24.2.2 +yamllint==1.35.1 +passlib==1.7.4 \ No newline at end of file diff --git a/requirements.yml b/requirements.yml index 34f8eba..db87661 100644 --- a/requirements.yml +++ b/requirements.yml @@ -1,3 +1,4 @@ collections: - ansible.windows - community.general + - community.docker