ci.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. name: Invidious CI
  2. on:
  3. schedule:
  4. - cron: "0 0 * * *" # Every day at 00:00
  5. push:
  6. branches:
  7. - "master"
  8. - "api-only"
  9. pull_request:
  10. branches: "*"
  11. paths-ignore:
  12. - "*.md"
  13. - LICENCE
  14. - TRANSLATION
  15. - invidious.service
  16. - .git*
  17. - .editorconfig
  18. - screenshots/*
  19. - assets/**
  20. - locales/*
  21. - config/**
  22. - .github/ISSUE_TEMPLATE/*
  23. - kubernetes/**
  24. jobs:
  25. build:
  26. runs-on: ubuntu-latest
  27. name: "build - crystal: ${{ matrix.crystal }}, stable: ${{ matrix.stable }}"
  28. continue-on-error: ${{ !matrix.stable }}
  29. strategy:
  30. fail-fast: false
  31. matrix:
  32. stable: [true]
  33. crystal:
  34. - 1.12.1
  35. - 1.13.2
  36. - 1.14.0
  37. - 1.15.0
  38. include:
  39. - crystal: nightly
  40. stable: false
  41. steps:
  42. - uses: actions/checkout@v4
  43. with:
  44. submodules: true
  45. - name: Install required APT packages
  46. run: |
  47. sudo apt install -y libsqlite3-dev
  48. shell: bash
  49. - name: Install Crystal
  50. uses: crystal-lang/install-crystal@v1.8.0
  51. with:
  52. crystal: ${{ matrix.crystal }}
  53. - name: Cache Shards
  54. uses: actions/cache@v3
  55. with:
  56. path: |
  57. ./lib
  58. ./bin
  59. key: shards-${{ hashFiles('shard.lock') }}
  60. - name: Install Shards
  61. run: |
  62. if ! shards check; then
  63. shards install
  64. fi
  65. - name: Run tests
  66. run: crystal spec
  67. - name: Build
  68. run: crystal build --warnings all --error-on-warnings --error-trace src/invidious.cr
  69. build-docker:
  70. runs-on: ubuntu-latest
  71. steps:
  72. - uses: actions/checkout@v4
  73. - name: Build Docker
  74. run: docker compose build --build-arg release=0
  75. - name: Run Docker
  76. run: docker compose up -d
  77. - name: Test Docker
  78. run: while curl -Isf http://localhost:3000; do sleep 1; done
  79. build-docker-arm64:
  80. runs-on: ubuntu-latest
  81. steps:
  82. - uses: actions/checkout@v4
  83. - name: Set up QEMU
  84. uses: docker/setup-qemu-action@v3
  85. with:
  86. platforms: arm64
  87. - name: Set up Docker Buildx
  88. uses: docker/setup-buildx-action@v3
  89. - name: Build Docker ARM64 image
  90. uses: docker/build-push-action@v5
  91. with:
  92. context: .
  93. file: docker/Dockerfile.arm64
  94. platforms: linux/arm64/v8
  95. build-args: release=0
  96. - name: Test Docker
  97. run: while curl -Isf http://localhost:3000; do sleep 1; done
  98. lint:
  99. runs-on: ubuntu-latest
  100. continue-on-error: true
  101. steps:
  102. - uses: actions/checkout@v4
  103. with:
  104. submodules: true
  105. - name: Install Crystal
  106. id: lint_step_install_crystal
  107. uses: crystal-lang/install-crystal@v1.8.0
  108. with:
  109. crystal: latest
  110. - name: Cache Shards
  111. uses: actions/cache@v3
  112. with:
  113. path: |
  114. ./lib
  115. ./bin
  116. key: shards-${{ hashFiles('shard.lock') }}-${{ steps.lint_step_install_crystal.outputs.crystal }}
  117. - name: Install Shards
  118. run: |
  119. if ! shards check; then
  120. shards install
  121. fi
  122. - name: Check Crystal formatter compliance
  123. run: |
  124. if ! crystal tool format --check; then
  125. crystal tool format
  126. git diff
  127. exit 1
  128. fi
  129. - name: Run Ameba linter
  130. run: bin/ameba