ci.yml 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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@01f397834f7acc553593abefbba135b18f580730 # v1.34.0
  10. permissions:
  11. contents: read
  12. id-token: write
  13. with:
  14. 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"
  15. # tofu test in each directory; every test file mocks its providers, so
  16. # the job needs no credential, which is all a pull request may have.
  17. test: true
  18. # opa fmt, check --strict and test over the Spacelift push policy.
  19. policy-directories: .spacelift/policies
  20. # The workflow-lint job installs pyflakes with pipx; GYST v1.28.0 runs
  21. # secretless jobs in block and the tofu-ci default allow-list has no
  22. # PyPI hosts.
  23. extra-allowed-endpoints: "files.pythonhosted.org:443 pypi.org:443"
  24. python:
  25. uses: ChiefGyk3D/git-your-ship-together/.github/workflows/python-ci.yml@01f397834f7acc553593abefbba135b18f580730 # v1.34.0
  26. permissions:
  27. contents: read
  28. id-token: write
  29. with:
  30. python-versions: '["3.12", "3.13"]'
  31. install-command: pip install pytest==9.2.0 pyyaml==6.0.2
  32. # The cost gate first: it is a script in this repository, so it rides the
  33. # Python job rather than needing a job of its own. The settings page check
  34. # fails when docs/wiki/Settings-Reference.md is stale against
  35. # docs/settings.json, and the project status check fails when
  36. # docs/wiki/Project-Status.md does not match its committed snapshot (offline;
  37. # no GitHub token in CI). The repository growth check is offline too: it
  38. # compares the snapshot, its recorded hashes, the committed chart PNG and the
  39. # growth page, with no token and no plotting library. The wiki navigation check
  40. # fails when a page is missing from (or dead in) docs/wiki/_nav.yaml or when
  41. # Contents.md or _Sidebar.md is stale against it. The identifier check (no cloud account ids in a
  42. # public repository) runs last.
  43. 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
  44. lint-install-command: pip install ruff==0.17.0
  45. lint-command: ruff check scripts tests
  46. workflow-lint: false
  47. docker-build: false
  48. security:
  49. uses: ChiefGyk3D/git-your-ship-together/.github/workflows/security.yml@01f397834f7acc553593abefbba135b18f580730 # v1.34.0
  50. permissions:
  51. contents: read
  52. security-events: write
  53. pull-requests: write
  54. id-token: write
  55. with:
  56. codeql-languages: actions
  57. pip-audit-requirements: ""
  58. ci-green:
  59. name: CI green
  60. if: ${{ always() }}
  61. needs: [tofu, python, security]
  62. runs-on: ubuntu-latest
  63. permissions: {}
  64. steps:
  65. - name: Fail unless every needed job succeeded
  66. env:
  67. RESULTS: ${{ join(needs.*.result, ' ') }}
  68. run: |
  69. for r in $RESULTS; do
  70. [ "$r" = "success" ] || { echo "a needed job finished as: $r"; exit 1; }
  71. done