ldap_acceptance.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. name: Acceptance
  2. # Optional, enabling concurrency limits: https://docs.github.com/en/actions/using-jobs/using-concurrency
  3. #concurrency:
  4. # group: ${{ github.ref }}-${{ github.workflow }}
  5. # cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
  6. # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
  7. permissions:
  8. actions: none
  9. checks: none
  10. contents: none
  11. deployments: none
  12. id-token: none
  13. issues: none
  14. discussions: none
  15. packages: none
  16. pages: none
  17. pull-requests: none
  18. repository-projects: none
  19. security-events: none
  20. statuses: none
  21. on:
  22. push:
  23. branches-ignore:
  24. - gh-pages
  25. - metakitty
  26. pull_request:
  27. branches:
  28. - '*'
  29. paths:
  30. - 'metsploit-framework.gemspec'
  31. - 'Gemfile.lock'
  32. - '**/**ldap**'
  33. - 'spec/acceptance/**'
  34. - 'spec/support/acceptance/**'
  35. - 'spec/acceptance_spec_helper.rb'
  36. # Example of running as a cron, to weed out flaky tests
  37. # schedule:
  38. # - cron: '*/15 * * * *'
  39. jobs:
  40. ldap:
  41. runs-on: ${{ matrix.os }}
  42. timeout-minutes: 40
  43. strategy:
  44. fail-fast: true
  45. matrix:
  46. ruby:
  47. - '3.2'
  48. os:
  49. - ubuntu-latest
  50. env:
  51. RAILS_ENV: test
  52. name: LDAP Acceptance - ${{ matrix.os }} - Ruby ${{ matrix.ruby }}
  53. steps:
  54. - name: Install system dependencies
  55. run: sudo apt-get install -y --no-install-recommends libpcap-dev graphviz
  56. - name: Checkout code
  57. uses: actions/checkout@v4
  58. - name: Run samba/ldap docker container
  59. working-directory: 'test/ldap'
  60. run: |
  61. docker compose build
  62. docker compose up --wait -d
  63. - name: Setup Ruby
  64. env:
  65. BUNDLE_WITHOUT: "coverage development pcap"
  66. # Nokogiri doesn't release pre-compiled binaries for preview versions of Ruby; So force compilation with BUNDLE_FORCE_RUBY_PLATFORM
  67. BUNDLE_FORCE_RUBY_PLATFORM: "${{ contains(matrix.ruby, 'preview') && 'true' || 'false' }}"
  68. uses: ruby/setup-ruby@v1
  69. with:
  70. ruby-version: '${{ matrix.ruby }}'
  71. bundler-cache: true
  72. - name: acceptance
  73. env:
  74. SPEC_HELPER_LOAD_METASPLOIT: false
  75. SPEC_OPTS: "--tag acceptance --require acceptance_spec_helper.rb --color --format documentation --format AllureRspec::RSpecFormatter"
  76. RUNTIME_VERSION: latest
  77. # Unix run command:
  78. # SPEC_HELPER_LOAD_METASPLOIT=false bundle exec ./spec/acceptance
  79. # Windows cmd command:
  80. # set SPEC_HELPER_LOAD_METASPLOIT=false
  81. # bundle exec rspec .\spec\acceptance
  82. # Note: rspec retry is intentionally not used, as it can cause issues with allure's reporting
  83. # Additionally - flakey tests should be fixed or marked as flakey instead of silently retried
  84. run: |
  85. bundle exec rspec spec/acceptance/ldap_spec.rb
  86. - name: Archive results
  87. if: always()
  88. uses: actions/upload-artifact@v4
  89. with:
  90. # Provide a unique artifact for each matrix os, otherwise race conditions can lead to corrupt zips
  91. name: ldap-acceptance-${{ matrix.os }}
  92. path: tmp/allure-raw-data
  93. # Generate a final report from the previous test results
  94. report:
  95. name: Generate report
  96. needs:
  97. - ldap
  98. runs-on: ubuntu-latest
  99. if: always()
  100. steps:
  101. - name: Checkout code
  102. uses: actions/checkout@v4
  103. if: always()
  104. - name: Install system dependencies (Linux)
  105. if: always()
  106. run: sudo apt-get -y --no-install-recommends install libpcap-dev graphviz
  107. - name: Setup Ruby
  108. if: always()
  109. env:
  110. BUNDLE_WITHOUT: "coverage development"
  111. BUNDLE_FORCE_RUBY_PLATFORM: true
  112. uses: ruby/setup-ruby@v1
  113. with:
  114. ruby-version: '${{ matrix.ruby }}'
  115. bundler-cache: true
  116. cache-version: 4
  117. # Github actions with Ruby requires Bundler 2.2.18+
  118. # https://github.com/ruby/setup-ruby/tree/d2b39ad0b52eca07d23f3aa14fdf2a3fcc1f411c#windows
  119. bundler: 2.2.33
  120. - uses: actions/download-artifact@v4
  121. id: download
  122. if: always()
  123. with:
  124. # Note: Not specifying a name will download all artifacts from the previous workflow jobs
  125. path: raw-data
  126. - name: allure generate
  127. if: always()
  128. run: |
  129. export VERSION=2.22.1
  130. curl -o allure-$VERSION.tgz -Ls https://github.com/allure-framework/allure2/releases/download/$VERSION/allure-$VERSION.tgz
  131. tar -zxvf allure-$VERSION.tgz -C .
  132. ls -la ${{steps.download.outputs.download-path}}
  133. ./allure-$VERSION/bin/allure generate ${{steps.download.outputs.download-path}}/* -o ./allure-report
  134. find ${{steps.download.outputs.download-path}}
  135. bundle exec ruby tools/dev/report_generation/support_matrix/generate.rb --allure-data ${{steps.download.outputs.download-path}} > ./allure-report/support_matrix.html
  136. - name: archive results
  137. if: always()
  138. uses: actions/upload-artifact@v4
  139. with:
  140. name: final-report-${{ github.run_id }}
  141. path: |
  142. ./allure-report