pr.yml 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. name: pr-checks
  2. # Verificacion de PRs (#1546): compila y testea server y agente en cada
  3. # pull_request (forks incluidos, token read-only, sin publicar nada). Los
  4. # assets de go-latest siguen saliendo solo del push a main (go.yml); aqui
  5. # solo se verifica. Los PRs de first-time contributors quedan "awaiting
  6. # approval" hasta que un maintainer apruebe el run (Actions).
  7. on:
  8. pull_request:
  9. concurrency:
  10. group: pr-checks-${{ github.event.pull_request.number }}
  11. cancel-in-progress: true
  12. jobs:
  13. eslint:
  14. runs-on: ubuntu-latest
  15. steps:
  16. - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
  17. - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  18. with:
  19. node-version: 24
  20. cache: npm
  21. cache-dependency-path: app/package-lock.json
  22. - name: ESLint (app)
  23. working-directory: app
  24. run: npm ci --no-audit --no-fund && npm run lint
  25. landing:
  26. runs-on: ubuntu-latest
  27. steps:
  28. - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
  29. - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  30. with:
  31. node-version: 24
  32. cache: npm
  33. cache-dependency-path: web/package-lock.json
  34. - name: Install landing dependencies and Chromium
  35. working-directory: web
  36. run: npm ci --no-audit --no-fund && npx playwright install --with-deps chromium
  37. - name: Test prerendered languages under the production CSP
  38. working-directory: web
  39. run: npm run test:langs
  40. server:
  41. runs-on: ubuntu-latest
  42. steps:
  43. - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
  44. - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
  45. with:
  46. node-version: 24
  47. cache: npm
  48. cache-dependency-path: app/package-lock.json
  49. - uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5.6.0
  50. with:
  51. go-version: '1.26'
  52. cache-dependency-path: |
  53. server-go/go.sum
  54. agent/go.sum
  55. # npm run build = tsc -b && vite build: el type-check va dentro.
  56. - name: Build frontend
  57. working-directory: app
  58. run: npm ci --no-audit --no-fund && npm run build
  59. - name: Copia dist al embed del binario
  60. run: rm -rf server-go/internal/staticspa/dist && cp -r app/dist server-go/internal/staticspa/dist
  61. # Los agentes embebidos son go:embed del server: sin ellos no compila,
  62. # y TestOpenArmVariants los abre. Version dummy: los assets reales con
  63. # version los compila solo main (go.yml). Nombres segun normalizeArch:
  64. # armv7 -> "arm" con GOARM=7 (#458), MIPS softfloat sin FPU (#488).
  65. - name: Build agent binaries para embed
  66. env:
  67. CGO_ENABLED: 0
  68. GOOS: linux
  69. run: |
  70. set -e
  71. (cd agent && GOARCH=amd64 go build -trimpath -ldflags "-s -w -X main.Version=0.0.0-pr" -o ../server-go/internal/agentbin/agents/netpulse-agent-amd64 ./cmd/netpulse-agent)
  72. (cd agent && GOARCH=arm64 go build -trimpath -ldflags "-s -w -X main.Version=0.0.0-pr" -o ../server-go/internal/agentbin/agents/netpulse-agent-arm64 ./cmd/netpulse-agent)
  73. (cd agent && GOARCH=arm GOARM=7 go build -trimpath -ldflags "-s -w -X main.Version=0.0.0-pr" -o ../server-go/internal/agentbin/agents/netpulse-agent-arm ./cmd/netpulse-agent)
  74. (cd agent && GOARCH=mipsle GOMIPS=softfloat go build -trimpath -ldflags "-s -w -X main.Version=0.0.0-pr" -o ../server-go/internal/agentbin/agents/netpulse-agent-mipsle ./cmd/netpulse-agent)
  75. (cd agent && GOARCH=mips GOMIPS=softfloat go build -trimpath -ldflags "-s -w -X main.Version=0.0.0-pr" -o ../server-go/internal/agentbin/agents/netpulse-agent-mips ./cmd/netpulse-agent)
  76. - name: Tests server (server-go)
  77. working-directory: server-go
  78. run: go test ./...
  79. # Modulo separado (agent/go.mod): go test ./... en server-go no lo cubre.
  80. - name: Tests agente (agent)
  81. working-directory: agent
  82. run: go test ./...