test.yml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. name: test
  2. on:
  3. push:
  4. pull_request:
  5. jobs:
  6. skip:
  7. runs-on: ubuntu-latest
  8. steps:
  9. - run: echo "Skip job"
  10. before:
  11. runs-on: ubuntu-latest
  12. if: "! contains(github.event.head_commit.message, '[skip ci]')"
  13. steps:
  14. - run: echo "not contains '[skip ci]'"
  15. build:
  16. runs-on: ${{ matrix.os }}
  17. strategy:
  18. matrix:
  19. os:
  20. - ubuntu-latest
  21. #- windows-latest
  22. #- macOS-latest
  23. nim_version:
  24. - '1.2.0'
  25. - '1.4.8'
  26. - 'stable'
  27. needs: before
  28. env:
  29. TIMEOUT_EXIT_STATUS: 124
  30. steps:
  31. - uses: actions/checkout@v1
  32. - name: Cache nimble
  33. id: cache-nimble
  34. uses: actions/cache@v1
  35. with:
  36. path: ~/.nimble
  37. key: ${{ runner.os }}-nimble-${{ hashFiles('*.nimble') }}
  38. - uses: jiro4989/setup-nim-action@v1
  39. with:
  40. nim-version: ${{ matrix.nim_version }}
  41. - name: Fix apt packages
  42. run: |
  43. # see. https://github.com/actions/virtual-environments/issues/675
  44. sudo sed -i 's/azure\.//' /etc/apt/sources.list
  45. sudo apt update -yqq
  46. - name: Install xvfb
  47. run: sudo apt install -y xvfb
  48. - name: Install sdl2
  49. run: sudo apt install --fix-missing -y libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev
  50. - name: Build examples
  51. run: |
  52. cd examples
  53. for dir in hello_world calculator novel snake screensaver roguelike builder_features; do
  54. (
  55. cd "$dir"
  56. nim c main.nim
  57. timeout 2 xvfb-run --auto-servernum --server-num=1 ./main || [ $? -eq ${{ env.TIMEOUT_EXIT_STATUS }} ]
  58. )
  59. done
  60. shell: bash
  61. - name: Build tests
  62. run: |
  63. cd tests
  64. for file in $(ls -v test*.nim); do
  65. echo "test: $file"
  66. nim c $file
  67. timeout 2 xvfb-run --auto-servernum --server-num=1 ./${file%%.nim} || [ $? -eq ${{ env.TIMEOUT_EXIT_STATUS }} ]
  68. done
  69. shell: bash