Merge pull request #1519 from saltycrys/github-actions-ci

Switch to GitHub Actions for CI
This commit is contained in:
TheFrenchGhosty 2020-12-04 20:59:07 +00:00 committed by GitHub
commit ca4408b343
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 131 additions and 49 deletions

88
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,88 @@
name: Invidious CI
on:
push:
branches:
- "master"
- "api-only"
pull_request:
branches: "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# - name: Find out latest Crystal version
# run: |
# crystal_latest=$(curl -ILs -o /dev/null -w %{url_effective} https://github.com/crystal-lang/crystal/releases/latest | grep -o '[^/]*$')
# echo "crystal_latest=$crystal_latest" >> $GITHUB_ENV
# echo $crystal_latest
#
# - name: Cache Crystal
# uses: actions/cache@v2
# with:
# path: ./crystal-bin
# key: crystal-${{ env.crystal_latest }}
#
# - name: Add custom Crystal dir to path
# run: echo "./crystal-bin" >> $GITHUB_PATH
#
# - name: Find out installed Crystal version
# run: |
# if ! [ -x "$(command -v crystal)" ]; then
# crystal_installed="none"
# else
# crystal_installed=$(crystal version | grep Crystal | awk '{print $2}')
# fi
# echo "crystal_installed=$crystal_installed" >> $GITHUB_ENV
# echo $crystal_installed
- name: Install Crystal
uses: oprypin/install-crystal@v1.2.4
# if: env.crystal_installed != env.crystal_latest
# with:
# destination: ./crystal-bin
- name: Cache Shards
uses: actions/cache@v2
with:
path: ./lib
key: shards-${{ hashFiles('shard.lock') }}
- name: Install Shards
run: |
if ! shards check; then
shards install
fi
- name: Run tests
run: crystal spec
- name: Run lint
run: |
if ! crystal tool format --check; then
crystal tool format
git diff
exit 1
fi
- name: Build
run: crystal build --warnings all --error-on-warnings --error-trace src/invidious.cr
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build Docker
run: docker-compose up -d
- name: Test Docker
run: while curl -Isf http://localhost:3000; do sleep 1; done

1
.gitignore vendored
View File

@ -6,4 +6,3 @@
/.vscode/
/invidious
/sentry
shard.lock

View File

@ -1,47 +0,0 @@
dist: bionic
# Work around broken Travis Crystal image
addons:
apt:
packages:
- gcc
- pkg-config
- git
- tzdata
- libpcre3-dev
- libevent-dev
- libyaml-dev
- libgmp-dev
- libssl-dev
- libxml2-dev
jobs:
include:
- stage: build
# TODO: Shallowly clone again once the .git folder is no longer required for building
git:
depth: false
language: crystal
crystal: latest
before_install:
- crystal --version
- shards update
- shards install
install:
- crystal build --warnings all --error-on-warnings src/invidious.cr
script:
- crystal tool format --check
- crystal spec
- stage: build_docker
# TODO: Shallowly clone again once the .git folder is no longer required for building
git:
depth: false
language: minimal
services:
- docker
install:
- docker-compose build
script:
- docker-compose up -d
- while curl -Isf http://localhost:3000; do sleep 1; done

View File

@ -1,6 +1,6 @@
# Invidious
[![Build Status](https://travis-ci.org/iv-org/invidious.svg?branch=master)](https://travis-ci.org/github/iv-org/invidious) [![Translation Status](https://hosted.weblate.org/widgets/invidious/-/translations/svg-badge.svg)](https://hosted.weblate.org/engage/invidious/)
[![Build Status](https://github.com/iv-org/invidious/workflows/Invidious%20CI/badge.svg)](https://github.com/iv-org/invidious/actions) [![Translation Status](https://hosted.weblate.org/widgets/invidious/-/translations/svg-badge.svg)](https://hosted.weblate.org/engage/invidious/)
## Invidious is an alternative front-end to YouTube

42
shard.lock Normal file
View File

@ -0,0 +1,42 @@
version: 2.0
shards:
db:
git: https://github.com/crystal-lang/crystal-db.git
version: 0.9.0
exception_page:
git: https://github.com/crystal-loot/exception_page.git
version: 0.1.4
kemal:
git: https://github.com/kemalcr/kemal.git
version: 0.26.1+git.commit.dfe7dca08f4c9a9456d6132af5f6b59fcd6865e4
kilt:
git: https://github.com/jeromegn/kilt.git
version: 0.4.0
lsquic:
git: https://github.com/iv-org/lsquic.cr.git
version: 2.18.1-1
pg:
git: https://github.com/will/crystal-pg.git
version: 0.21.1
pool:
git: https://github.com/ysbaddaden/pool.git
version: 0.2.3
protodec:
git: https://github.com/omarroth/protodec.git
version: 0.1.3
radix:
git: https://github.com/luislavena/radix.git
version: 0.3.9
sqlite3:
git: https://github.com/crystal-lang/crystal-sqlite3.git
version: 0.16.0