Newer
Older
dub_jkp / .github / workflows / main.yml
  1. # Cross platform tests for DUB
  2.  
  3. name: Testsuite
  4.  
  5. # Only triggers on pushes to master & stable, as well as PR to master and stable
  6. # Sometimes reverts appear in the upstream repository (e.g. when the revert button
  7. # is clicked by a contributor with commit access), this should be tested as PR).
  8. #
  9. # Also note that Github actions does not retrigger on target branch changes,
  10. # hence the check on push.
  11. on:
  12. pull_request:
  13. branches:
  14. - master
  15. - stable
  16. paths-ignore:
  17. - 'changelog/**'
  18. push:
  19. branches:
  20. - master
  21. - stable
  22. # Use this branch name in your fork to test changes
  23. - github-actions
  24.  
  25. jobs:
  26. single_checks:
  27. name: "Single sanity check"
  28. runs-on: ubuntu-latest
  29. steps:
  30. - name: Install latest DMD
  31. uses: dlang-community/setup-dlang@v1
  32. - name: Checkout
  33. uses: actions/checkout@v3
  34. - name: Run tests
  35. run: |
  36. # check for trailing whitespace
  37. TRAILING_WS_COUNT=$(find . -type f -name '*.d' -exec grep -Hn "[[:blank:]]$" {} \; | wc -l)
  38. if [ $TRAILING_WS_COUNT -ne 0 ]; then
  39. echo "========================================"
  40. find . -type f -name '*.d' -exec grep -Hn "[[:blank:]]$" {} \;
  41. echo "========================================"
  42. echo "The files above have trailing whitespace"
  43. exit 1
  44. fi
  45. # check that the man page generation still works
  46. dub --single -v scripts/man/gen_man.d
  47.  
  48. main:
  49. name: Run
  50. strategy:
  51. # Default, disable if you want to debug
  52. fail-fast: false
  53. matrix:
  54. # Latest stable version, update at will
  55. os: [ macOS-11, ubuntu-20.04, windows-2019 ]
  56. dc:
  57. # Always test latest as that is what we use to compile on release
  58. - dmd-latest
  59. - ldc-latest
  60. # Provide some testing for upstream
  61. - dmd-master
  62. - ldc-master
  63. # Test some intermediate versions
  64. - ldc-1.26.0
  65. - dmd-2.098.1
  66. - dmd-2.101.1
  67. - dmd-2.104.2
  68. include:
  69. - { do_test: false }
  70. - { dc: dmd-latest, do_test: true }
  71. - { dc: ldc-latest, do_test: true }
  72. - { dc: dmd-master, do_test: true }
  73. - { dc: ldc-master, do_test: true }
  74.  
  75. runs-on: ${{ matrix.os }}
  76. steps:
  77.  
  78. # Install required dependencies
  79. - name: '[OSX] Install dependencies'
  80. if: runner.os == 'macOS'
  81. run: |
  82. brew install pkg-config coreutils
  83. echo "PKG_CONFIG_PATH=/usr/local/opt/openssl@1.1/lib/pkgconfig/" >> $GITHUB_ENV
  84.  
  85. - name: '[Linux] Install dependencies'
  86. if: runner.os == 'Linux'
  87. run: |
  88. sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev netcat
  89.  
  90. # Compiler to test with
  91. - name: Prepare compiler
  92. uses: dlang-community/setup-dlang@v1
  93. with:
  94. compiler: ${{ matrix.dc }}
  95.  
  96. # Checkout the repository
  97. - name: Checkout
  98. uses: actions/checkout@v3
  99.  
  100. - name: '[POSIX] Test'
  101. if: runner.os != 'Windows'
  102. env:
  103. COVERAGE: true
  104. run: |
  105. dub build --compiler=${{ env.DC }}
  106. if [[ ${{ matrix.do_test }} == 'true' ]]; then
  107. dub run --compiler=${{ env.DC }} --single test/issue2051_running_unittests_from_dub_single_file_packages_fails.d
  108. ./scripts/ci/ci.sh
  109. fi
  110.  
  111. - name: '[Windows] Test'
  112. if: runner.os == 'Windows'
  113. env:
  114. DUB: ${{ github.workspace }}\bin\dub.exe
  115. run: |
  116. dub build --compiler=${{ env.DC }}
  117. if [[ ${{ matrix.do_test }} == 'true' ]]; then
  118. dub test --compiler=${{ env.DC }}
  119. dub run --compiler=${{ env.DC }} --single test/issue2051_running_unittests_from_dub_single_file_packages_fails.d
  120. dub --single test/run-unittest.d
  121.  
  122. # FIXME: DMD fails a few tests on Windows; remove them for now
  123. if [[ '${{ matrix.dc }}' = dmd* ]]; then
  124. # DLL support is lacking
  125. rm -rf test/{1-dynLib-simple,2-dynLib-dep,2-dynLib-with-staticLib-dep}
  126. # Unicode in paths too
  127. rm -rf test/issue130-unicode-СНА*
  128. # ImportC probably requires set-up MSVC environment variables
  129. rm -rf test/use-c-sources
  130. fi
  131. test/run-unittest.sh
  132. fi
  133. shell: bash
  134.  
  135. - name: Codecov
  136. uses: codecov/codecov-action@v3