Add universal paginator to use page/per on search #3446
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Kitsu Test Suite | |
on: | |
push: | |
pull_request: | |
# Branches from forks have the form 'user:branch-name' so we only run | |
# this job on pull_request events for branches that look like fork | |
# branches. Without this we would end up running this job twice for non | |
# forked PRs, once for the push and then once for opening the PR. | |
branches: | |
- '**:**' | |
env: | |
STREAM_API_KEY: q3k9n9kqk3fb | |
STREAM_API_SECRET: vkw87x3p323z6ma75n8dvnse98jrr9gkauf2zfjnzbgjpmm54ssnbync4yhhzugc | |
CC_TEST_REPORTER_ID: 5e2172ea5a30b07e172058a3b33dfe08c6354699808e8f3010acc32b1ef41395 | |
BUNDLE_GITHUB__HTTPS: true | |
LOG_LEVEL: warn | |
AWS_DEFAULT_REGION: us-east-1 | |
IMAGEMAGICK_VERSION: 7.1.0-61 | |
SENTRY_ORG: kitsu | |
SENTRY_PROJECT: server | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_TOKEN }} | |
jobs: | |
check_secrets: | |
runs-on: ubuntu-latest | |
outputs: | |
SECRETS_AVAILABLE: ${{ steps.check.outputs.SECRETS_AVAILABLE }} | |
steps: | |
- id: check | |
run: | | |
echo "SECRETS_AVAILABLE=${{ env.SECRETS_AVAILABLE == 'yes' }}" >> $GITHUB_OUTPUT | |
env: | |
SECRETS_AVAILABLE: ${{ secrets.AVAILABLE }} | |
test: | |
name: RSpec Test Suite | |
runs-on: ubuntu-latest | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby: | |
- ruby-3.1 | |
experimental: [false] | |
include: | |
- ruby: ruby-3.2 | |
experimental: true | |
services: | |
minio: | |
image: fclairamb/minio-github-actions | |
options: --health-cmd "curl -s -o /dev/null -I http://127.0.0.1:9000/minio/index.html" --health-interval 10s --health-timeout 5s --health-retries 5 | |
ports: | |
- 9000:9000 | |
env: | |
MINIO_ACCESS_KEY: miniotest | |
MINIO_SECRET_KEY: miniotest | |
postgres: | |
image: postgres:10-alpine | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_DB: kitsu_test | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis:alpine | |
ports: | |
- 6379:6379 | |
elasticsearch: | |
image: elasticsearch:2-alpine | |
ports: | |
- 9200:9200 | |
typesense: | |
image: typesense/typesense:0.25.0 | |
ports: | |
- 8108:8108 | |
env: | |
TYPESENSE_DATA_DIR: /tmp | |
TYPESENSE_API_KEY: xyz | |
env: | |
AWS_ENDPOINT: http://localhost:9000 | |
AWS_BUCKET: kitsu-ugc-test | |
AWS_ACCESS_KEY_ID: miniotest | |
AWS_SECRET_ACCESS_KEY: miniotest | |
DATABASE_URL: postgresql://postgres:postgres@localhost:5432/kitsu_test | |
REDIS_URL: redis://localhost:6379/1 | |
ELASTICSEARCH_URL: localhost:9200 | |
TYPESENSUAL_API_KEY: xyz | |
TYPESENSUAL_NODES: http://localhost:8108/ | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Install Dependencies | |
run: | | |
sudo add-apt-repository universe | |
sudo apt-get update | |
sudo apt-get -yqq install libpq-dev libfuse2 | |
- name: Install ImageMagick (${{ env.IMAGEMAGICK_VERSION }}) | |
uses: ./.github/actions/install-imagemagick | |
with: | |
version: ${{ env.IMAGEMAGICK_VERSION }} | |
- name: Install libvips | |
run: | | |
sudo apt-get -yqq install libvips libvips-dev libraqm-dev ffmpeg | |
- name: Set up Ruby (${{ matrix.ruby }}) | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
bundler-cache: true | |
- name: Set up Test Environment | |
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" | |
run: | | |
aws --endpoint-url $AWS_ENDPOINT s3 mb s3://$AWS_BUCKET | |
bundle exec rake db:create db:schema:load | |
- name: Run RSpec Suite | |
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" | |
run: | | |
bundle exec rspec | |
- name: Dump Schema | |
run: | | |
bundle exec rake graphql:dump_schema | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: graphql-schema-${{ matrix.ruby }} | |
path: schema.graphql | |
- name: Publish code coverage | |
uses: paambaati/[email protected] | |
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" | |
continue-on-error: true | |
build: | |
needs: [check_secrets] | |
name: Build Docker Image | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && needs.check_secrets.outputs.SECRETS_AVAILABLE == 'true' | |
steps: | |
- name: Install Sentry CLI | |
run: curl -sL https://sentry.io/get-cli/ | bash | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Connect to Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: Senkosan | |
password: ${{ secrets.SENKO_SAN_KEY }} | |
- name: Set version | |
run: | | |
echo "version=${GITHUB_SHA::8}" >> $GITHUB_ENV | |
echo "${GITHUB_SHA::8}" > .version | |
- name: Report Release to Sentry | |
run: sentry-cli releases new ${{ env.version }} | |
- name: Add Commits to Sentry Release | |
run: sentry-cli releases set-commits --auto ${{ env.version }} | |
- name: Build Docker Image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
push: true | |
tags: ghcr.io/hummingbird-me/kitsu-server:${{ env.version }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Finalize Sentry Release | |
if: success() | |
run: sentry-cli releases finalize ${{ env.version }} | |
deploy: | |
name: Deploy to Staging | |
runs-on: ubuntu-latest | |
needs: [test, build] | |
if: success() && github.ref == 'refs/heads/the-future' | |
steps: | |
- name: Trigger Deployment | |
uses: octokit/[email protected] | |
with: | |
route: POST /repos/:repo/deployments | |
repo: ${{ github.repository }} | |
ref: ${{ github.sha }} | |
environment: staging | |
auto_merge: false | |
description: "Deploy ${{ github.sha }} to Staging" | |
mediaType: '{"previews": ["flash"]}' | |
required_contexts: "[]" | |
env: | |
GITHUB_TOKEN: ${{ secrets.SENKO_SAN_KEY }} |