|
| 1 | +--- |
| 2 | +# CI for this repository: lint the reusable workflows and the caller examples. |
| 3 | +name: "CI" |
| 4 | +concurrency: |
| 5 | + group: "${{ github.workflow }}-${{ github.ref }}" |
| 6 | + cancel-in-progress: true |
| 7 | +on: # yamllint disable-line rule:truthy rule:comments |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - "main" |
| 11 | + pull_request: ~ |
| 12 | + |
| 13 | +permissions: |
| 14 | + contents: "read" |
| 15 | + |
| 16 | +jobs: |
| 17 | + yamllint: |
| 18 | + name: "Linting: yamllint" |
| 19 | + runs-on: "ubuntu-latest" |
| 20 | + steps: |
| 21 | + - name: "Check out repository code" |
| 22 | + uses: "actions/checkout@v7" |
| 23 | + - name: "Set up Python" |
| 24 | + uses: "actions/setup-python@v6" |
| 25 | + with: |
| 26 | + python-version: "3.12" |
| 27 | + - name: "Install yamllint" |
| 28 | + run: "pip install yamllint" |
| 29 | + - name: "Linting: yamllint" |
| 30 | + run: "yamllint --strict ." |
| 31 | + |
| 32 | + actionlint: |
| 33 | + name: "Linting: actionlint" |
| 34 | + runs-on: "ubuntu-latest" |
| 35 | + steps: |
| 36 | + - name: "Check out repository code" |
| 37 | + uses: "actions/checkout@v7" |
| 38 | + - name: "Install actionlint" |
| 39 | + run: "bash <(curl -fsSL https://raw.githubusercontent.com/rhysd/actionlint/v1.7.7/scripts/download-actionlint.bash) 1.7.7 /usr/local/bin" |
| 40 | + - name: "Linting: actionlint (reusable workflows)" |
| 41 | + run: "actionlint -color" |
| 42 | + # The caller examples live outside .github/workflows, so lint them explicitly. |
| 43 | + - name: "Linting: actionlint (caller examples)" |
| 44 | + run: "actionlint -color examples/*/*.yml" |
| 45 | + |
| 46 | + action-smoke-test: |
| 47 | + name: "Smoke test: setup-poetry-environment" |
| 48 | + runs-on: "ubuntu-latest" |
| 49 | + steps: |
| 50 | + - name: "Check out repository code" |
| 51 | + uses: "actions/checkout@v7" |
| 52 | + # The action installs whatever Poetry project sits in the workspace root, so borrow a real NTC project. |
| 53 | + - name: "Check out a Poetry project to install" |
| 54 | + uses: "actions/checkout@v7" |
| 55 | + with: |
| 56 | + repository: "networktocode/netutils" |
| 57 | + ref: "develop" |
| 58 | + path: "project" |
| 59 | + - name: "Place the project files in the workspace root" |
| 60 | + run: "cp project/pyproject.toml project/poetry.lock ." |
| 61 | + - name: "Run the action from this branch" |
| 62 | + id: "setup" |
| 63 | + uses: "./.github/actions/setup-poetry-environment" |
| 64 | + with: |
| 65 | + poetry-version: "2.1.3" |
| 66 | + python-version: "3.12" |
| 67 | + poetry-install-options: "--only dev --no-root" |
| 68 | + - name: "Verify the environment" |
| 69 | + run: | |
| 70 | + poetry --version |
| 71 | + poetry run ruff --version |
| 72 | + echo "python-version output: ${{ steps.setup.outputs.python-version }}" |
| 73 | + echo "cache-used output: ${{ steps.setup.outputs.cache-used }}" |
0 commit comments