ci.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. name: CI
  2. on:
  3. push:
  4. branches: [main]
  5. pull_request:
  6. permissions: {}
  7. jobs:
  8. tofu:
  9. uses: ChiefGyk3D/git-your-ship-together/.github/workflows/tofu-ci.yml@5c1a813d8ad21adf845d221c59d17ce9406d5e53 # v1.41.0
  10. permissions:
  11. contents: read
  12. pull-requests: read
  13. id-token: write
  14. with:
  15. directories: "stacks/00-foundation stacks/10-access stacks/20-telemetry stacks/30-workloads stacks/50-edge stacks/aws/00-foundation stacks/aws/10-access modules/vpc modules/firewall modules/twingate-bootstrap modules/twingate-connector modules/edge-host modules/docker-host modules/aws/vpc modules/aws/firewall modules/aws/twingate-connector modules/spaces-bucket"
  16. # tofu test in each directory; every test file mocks its providers, so
  17. # the job needs no credential, which is all a pull request may have.
  18. test: true
  19. # opa fmt, check --strict and test over the Spacelift push policy.
  20. policy-directories: .spacelift/policies
  21. # The workflow-lint job installs pyflakes with pipx. The tofu-ci default
  22. # allow-list at v1.41.0 already includes pypi.org and
  23. # files.pythonhosted.org, so no extra endpoints are needed.
  24. python:
  25. uses: ChiefGyk3D/git-your-ship-together/.github/workflows/python-ci.yml@5c1a813d8ad21adf845d221c59d17ce9406d5e53 # v1.41.0
  26. permissions:
  27. contents: read
  28. pull-requests: read
  29. id-token: write
  30. with:
  31. python-versions: '["3.12", "3.13"]'
  32. install-command: pip install pytest==9.2.0 pyyaml==6.0.2
  33. # The cost gate first: it is a script in this repository, so it rides the
  34. # Python job rather than needing a job of its own. The settings page check
  35. # fails when docs/wiki/Settings-Reference.md is stale against
  36. # docs/settings.json, and the project status check fails when
  37. # docs/wiki/Project-Status.md does not match its committed snapshot (offline;
  38. # no GitHub token in CI). The repository growth check is offline too: it
  39. # compares the snapshot, its recorded hashes, the committed chart PNG and the
  40. # growth page, with no token and no plotting library. The wiki navigation check
  41. # fails when a page is missing from (or dead in) docs/wiki/_nav/ or when
  42. # Contents.md or _Sidebar.md is stale against it. The identifier check (no cloud account ids in a
  43. # public repository) runs last.
  44. test-command: bash scripts/ci_cost_gate.sh && python -I scripts/gen_settings_doc.py --check && python -I scripts/gen_project_status.py --check && python3 -I scripts/gen_repo_metrics.py --check && python -I scripts/gen_wiki_nav.py --check && python -I -m pytest tests -q && python -I scripts/identifier_check.py --root . && python -I scripts/threat_dragon_layout.py --check
  45. lint-install-command: pip install ruff==0.17.0
  46. lint-command: ruff check scripts tests
  47. workflow-lint: false
  48. docker-build: false
  49. security:
  50. uses: ChiefGyk3D/git-your-ship-together/.github/workflows/security.yml@5c1a813d8ad21adf845d221c59d17ce9406d5e53 # v1.41.0
  51. permissions:
  52. contents: read
  53. security-events: write
  54. pull-requests: write
  55. id-token: write
  56. with:
  57. codeql-languages: actions
  58. pip-audit-requirements: ""
  59. ci-green:
  60. name: CI green
  61. if: ${{ always() }}
  62. needs: [tofu, python, security]
  63. runs-on: ubuntu-latest
  64. permissions: {}
  65. steps:
  66. - name: Fail unless every needed job succeeded
  67. env:
  68. RESULTS: ${{ join(needs.*.result, ' ') }}
  69. run: |
  70. for r in $RESULTS; do
  71. [ "$r" = "success" ] || { echo "a needed job finished as: $r"; exit 1; }
  72. done