diff options
| author | omnom62 <omnom62@outlook.com> | 2026-06-01 06:12:38 +1000 |
|---|---|---|
| committer | omnom62 <omnom62@outlook.com> | 2026-06-01 06:12:38 +1000 |
| commit | 3d5580b801812dbbeefb37cfb7059b7f2b4adcbb (patch) | |
| tree | 3566f36822e1ae4bae19efaaab63a06f4bb525b8 /.github/workflows | |
| parent | 967a8c581df46f3c01d642ed08ec0d7ec43d79f6 (diff) | |
| download | rest.vyos-3d5580b801812dbbeefb37cfb7059b7f2b4adcbb.tar.gz rest.vyos-3d5580b801812dbbeefb37cfb7059b7f2b4adcbb.zip | |
Preparing first cut of modules
Diffstat (limited to '.github/workflows')
| -rw-r--r-- | .github/workflows/ah_token_refresh.yml | 14 | ||||
| -rw-r--r-- | .github/workflows/check_label.yaml | 11 | ||||
| -rw-r--r-- | .github/workflows/cla-check.yml | 15 | ||||
| -rw-r--r-- | .github/workflows/codecoverage.yml | 71 | ||||
| -rw-r--r-- | .github/workflows/release.yml | 13 | ||||
| -rw-r--r-- | .github/workflows/tests.yml | 52 |
6 files changed, 176 insertions, 0 deletions
diff --git a/.github/workflows/ah_token_refresh.yml b/.github/workflows/ah_token_refresh.yml new file mode 100644 index 0000000..09d2f9d --- /dev/null +++ b/.github/workflows/ah_token_refresh.yml @@ -0,0 +1,14 @@ +name: Refresh the automation hub token +# the token expires every 30 days, so we need to refresh it +on: + schedule: + - cron: '0 12 1,15 * *' # run 12pm on the 1st and 15th of the month + workflow_dispatch: + +jobs: + refresh: + uses: ansible/team-devtools/.github/workflows/ah_token_refresh.yml@v26.4.0 + with: + environment: release + secrets: + ah_token: ${{ secrets.AH_TOKEN }} diff --git a/.github/workflows/check_label.yaml b/.github/workflows/check_label.yaml new file mode 100644 index 0000000..000578b --- /dev/null +++ b/.github/workflows/check_label.yaml @@ -0,0 +1,11 @@ +--- +name: Check label +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +on: # yamllint disable-line rule:truthy + pull_request_target: + types: [opened, labeled, unlabeled, synchronize] +jobs: + check_label: + uses: ansible/ansible-content-actions/.github/workflows/check_label.yaml@main diff --git a/.github/workflows/cla-check.yml b/.github/workflows/cla-check.yml new file mode 100644 index 0000000..da3e6ef --- /dev/null +++ b/.github/workflows/cla-check.yml @@ -0,0 +1,15 @@ +name: "CLA Check" +permissions: + actions: write + contents: read + pull-requests: write + statuses: write +on: + pull_request_target: + types: [opened, synchronize, closed] + issue_comment: + types: [created] +jobs: + call-cla-assistant: + uses: vyos/vyos-cla-signatures/.github/workflows/cla-reusable.yml@current + secrets: inherit diff --git a/.github/workflows/codecoverage.yml b/.github/workflows/codecoverage.yml new file mode 100644 index 0000000..8ce3af3 --- /dev/null +++ b/.github/workflows/codecoverage.yml @@ -0,0 +1,71 @@ +--- +name: Code Coverage +# cloned from ansible-network/github_actions/.github/workflows/coverage_network_devices.yml@main +# in order to deal with token issue in codecov + +on: # yamllint disable-line rule:truthy + push: + pull_request: + branches: [main] +jobs: + codecoverage: + env: + PY_COLORS: "1" + source_directory: "./source" + python_version: "3.10" + ansible_version: "latest" + os: "ubuntu-latest" + collection_pre_install: >- + git+https://github.com/ansible-collections/ansible.utils.git + git+https://github.com/ansible-collections/ansible.netcommon.git + runs-on: ubuntu-latest + name: "Code Coverage | Python 3.10" + steps: + - name: Checkout the collection repository + uses: ansible-network/github_actions/.github/actions/checkout_dependency@main + with: + path: ${{ env.source_directory }} + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: "0" + + - name: Set up Python ${{ env.python_version }} + uses: actions/setup-python@v6 + with: + python-version: ${{ env.python_version }} + + - name: Install ansible-core (${{ env.ansible-version }}) + run: python3 -m pip install ansible-core pytest pytest-cov pytest-ansible-units pytest-forked pytest-xdist + + - name: Read collection metadata from galaxy.yml + id: identify + uses: ansible-network/github_actions/.github/actions/identify_collection@main + with: + source_path: ${{ env.source_directory }} + + - name: Build and install the collection + uses: ansible-network/github_actions/.github/actions/build_install_collection@main + with: + install_python_dependencies: true + source_path: ${{ env.source_directory }} + collection_path: ${{ steps.identify.outputs.collection_path }} + tar_file: ${{ steps.identify.outputs.tar_file }} + + - name: Print the ansible version + run: ansible --version + + - name: Print the python dependencies + run: python3 -m pip list + + - name: Run Coverage tests + run: | + pytest tests/unit -v --cov-report xml --cov=./ + working-directory: ${{ steps.identify.outputs.collection_path }} + + - name: Upload coverage report to Codecov + uses: codecov/codecov-action@v6 + with: + directory: ${{ steps.identify.outputs.collection_path }} + fail_ci_if_error: false + token: ${{ secrets.CODECOV_TOKEN }} + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7a2c493 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,13 @@ +--- +name: Release collection +on: # yamllint disable-line rule:truthy + release: + types: [published] +jobs: + release: + uses: ansible/ansible-content-actions/.github/workflows/release.yaml@main + with: + environment: release + secrets: + ah_token: ${{ secrets.AH_TOKEN }} + ansible_galaxy_api_key: ${{ secrets.ANSIBLE_GALAXY_API_KEY }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..dedbc9e --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,52 @@ +--- +name: CI + +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +on: # yamllint disable-line rule:truthy + pull_request: + branches: [main] + workflow_dispatch: + schedule: + - cron: 0 0 * * * + +jobs: + changelog: + uses: ansible/ansible-content-actions/.github/workflows/changelog.yaml@main + if: github.event_name == 'pull_request' + build-import: + uses: ansible/ansible-content-actions/.github/workflows/build_import.yaml@main + ansible-lint: + uses: ansible/ansible-content-actions/.github/workflows/ansible_lint.yaml@main + sanity: + uses: ansible/ansible-content-actions/.github/workflows/sanity.yaml@main + unit-galaxy: + uses: ansible/ansible-content-actions/.github/workflows/unit.yaml@main + unit-source: + uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main + with: + collection_pre_install: >- + git+https://github.com/ansible-collections/ansible.utils.git + git+https://github.com/ansible-collections/ansible.netcommon.git + all_green: + if: ${{ always() }} + needs: + - changelog + - build-import + - sanity + - unit-galaxy + - unit-source + - ansible-lint + runs-on: ubuntu-latest + steps: + - run: >- + python -c "assert 'failure' not in + set([ + '${{ needs.changelog.result }}', + '${{ needs.sanity.result }}', + '${{ needs.unit-galaxy.result }}' + '${{ needs.ansible-lint.result }}' + '${{ needs.unit-source.result }}' + ])" |
