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.10.1
  35. - 1.11.2
  36. - 1.12.1
  37. - 1.13.2
  38. - 1.14.0
  39. include:
  40. - crystal: nightly
  41. stable: false
  42. steps:
  43. - uses: actions/checkout@v4
  44. with:
  45. submodules: true
  46. - name: Install required APT packages
  47. run: |
  48. sudo apt install -y libsqlite3-dev
  49. shell: bash
  50. - name: Install Crystal
  51. uses: crystal-lang/install-crystal@v1.8.0
  52. with:
  53. crystal: ${{ matrix.crystal }}
  54. - name: Cache Shards
  55. uses: actions/cache@v3
  56. with:
  57. path: |
  58. ./lib
  59. ./bin
  60. key: shards-${{ hashFiles('shard.lock') }}
  61. - name: Install Shards
  62. run: |
  63. if ! shards check; then
  64. shards install
  65. fi
  66. - name: Run tests
  67. run: crystal spec
  68. - name: Build
  69. run: crystal build --warnings all --error-on-warnings --error-trace src/invidious.cr
  70. build-docker:
  71. runs-on: ubuntu-latest
  72. steps:
  73. - uses: actions/checkout@v4
  74. - name: Build Docker
  75. run: docker compose build --build-arg release=0
  76. - name: Run Docker
  77. run: docker compose up -d
  78. - name: Test Docker
  79. run: while curl -Isf http://localhost:3000; do sleep 1; done
  80. build-docker-arm64:
  81. runs-on: ubuntu-latest
  82. steps:
  83. - uses: actions/checkout@v4
  84. - name: Set up QEMU
  85. uses: docker/setup-qemu-action@v3
  86. with:
  87. platforms: arm64
  88. - name: Set up Docker Buildx
  89. uses: docker/setup-buildx-action@v3
  90. - name: Build Docker ARM64 image
  91. uses: docker/build-push-action@v5
  92. with:
  93. context: .
  94. file: docker/Dockerfile.arm64
  95. platforms: linux/arm64/v8
  96. build-args: release=0
  97. - name: Test Docker
  98. run: while curl -Isf http://localhost:3000; do sleep 1; done
  99. lint:
  100. runs-on: ubuntu-latest
  101. continue-on-error: true
  102. steps:
  103. - uses: actions/checkout@v4
  104. with:
  105. submodules: true
  106. - name: 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') }}
  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