Files
danbooru/.github/workflows/test.yaml
evazion 440bbbb288 Update nokogiri gem.
Fix gem version conflicts described in 20abd8a5f. Nokogiri couldn't be
upgraded past 1.10.9 because 1.11.0 causes a build failure in Nokogumbo
2.0.2, but we couldn't stay on 1.10.9 either because it has a hard
requirement on Ruby <2.7 and we require Ruby >=2.7. This made `bundle
update` fail with a Gemfile conflict.

The fix is to disable libxml2 support when building Nokogumbo. Nokogumbo
wants to use the same version of libxml2 as Nokogiri, but Nokogiri
1.11.0 changed how it reports which version of libxml2 it's using, which
causes Nokogumbo's build to fail. Disabling libxml2 may reduce
performance of Nokogumbo ([1]).

While we're at it, we also make Nokogiri use the system version of
libxml2 instead of its own bundled version. Nokogiri really wants
us to use its own patched version of libxml2 instead of the system
version, but the patches it applies look relatively minor and don't seem
relevant to us ([2]). Using the system version reduces build time during CI.

This adds libxml2 and libxslt as OS-level dependencies of Danbooru. You
may need to do `sudo apt-get install libxml2-dev libxslt-dev` to install
these libraries after this commit.

[1]: https://github.com/rubys/nokogumbo#flavors-of-nokogumbo
[2]: https://github.com/sparklemotion/nokogiri/tree/master/patches/libxml2
2020-06-19 02:27:15 -05:00

99 lines
3.6 KiB
YAML

name: Github
# Trigger on pushes to master or pull requests to master, but not both.
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
container: ubuntu:20.04
defaults:
run:
shell: bash
env:
DEBIAN_FRONTEND: noninteractive
PARALLEL_WORKERS: 8 # number of parallel tests to run
RUBYOPT: -W0 # silence ruby warnings
VIPS_WARNING: 0 # silence libvips warnings
# Code Climate configuration. https://docs.codeclimate.com/docs/finding-your-test-coverage-token
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
GIT_COMMIT_SHA: ${{ github.sha }}
GIT_BRANCH: ${{ github.ref }}
DATABASE_URL: postgresql://danbooru:danbooru@postgres/danbooru
ARCHIVE_DATABASE_URL: postgresql://danbooru:danbooru@postgres/danbooru
DANBOORU_SECRET_KEY_BASE: 1234
DANBOORU_AWS_SQS_ENABLED: false
DANBOORU_TWITTER_API_KEY: ${{ secrets.DANBOORU_TWITTER_API_KEY }}
DANBOORU_TWITTER_API_SECRET: ${{ secrets.DANBOORU_TWITTER_API_SECRET }}
DANBOORU_PIXIV_LOGIN: ${{ secrets.DANBOORU_PIXIV_LOGIN }}
DANBOORU_PIXIV_PASSWORD: ${{ secrets.DANBOORU_PIXIV_PASSWORD }}
DANBOORU_NIJIE_LOGIN: ${{ secrets.DANBOORU_NIJIE_LOGIN }}
DANBOORU_NIJIE_PASSWORD: ${{ secrets.DANBOORU_NIJIE_PASSWORD }}
DANBOORU_NICO_SEIGA_LOGIN: ${{ secrets.DANBOORU_NICO_SEIGA_LOGIN }}
DANBOORU_NICO_SEIGA_PASSWORD: ${{ secrets.DANBOORU_NICO_SEIGA_PASSWORD }}
DANBOORU_TUMBLR_CONSUMER_KEY: ${{ secrets.DANBOORU_TUMBLR_CONSUMER_KEY }}
DANBOORU_DEVIANTART_CLIENT_ID: ${{ secrets.DANBOORU_DEVIANTART_CLIENT_ID }}
DANBOORU_DEVIANTART_CLIENT_SECRET: ${{ secrets.DANBOORU_DEVIANTART_CLIENT_SECRET }}
DANBOORU_PAWOO_CLIENT_ID: ${{ secrets.DANBOORU_PAWOO_CLIENT_ID }}
DANBOORU_PAWOO_CLIENT_SECRET: ${{ secrets.DANBOORU_PAWOO_CLIENT_SECRET }}
DANBOORU_RAKISMET_KEY: ${{ secrets.DANBOORU_RAKISMET_KEY }}
DANBOORU_RAKISMET_URL: ${{ secrets.DANBOORU_RAKISMET_URL }}
DANBOORU_IP_REGISTRY_API_KEY: ${{ secrets.DANBOORU_IP_REGISTRY_API_KEY }}
services:
postgres:
image: evazion/postgres
env:
POSTGRES_USER: danbooru
POSTGRES_PASSWORD: danbooru
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Install OS dependencies
run: |
apt-get update
apt-get -y install --no-install-recommends build-essential ruby ruby-dev ruby-bundler git nodejs yarnpkg webpack ffmpeg mkvtoolnix libvips-dev libxml2-dev libxslt-dev zlib1g-dev postgresql-server-dev-all wget
ln -sf /usr/bin/yarnpkg /usr/bin/yarn
- name: Install Ruby dependencies
run: BUNDLE_DEPLOYMENT=true bundle install --jobs 4
- name: Install Javascript dependencies
run: yarn install
- name: Prepare database
run: config/docker/prepare-tests.sh
# https://docs.codeclimate.com/docs/configuring-test-coverage
- name: Prepare test coverage for Code Climate
run: |
wget https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
chmod +x test-reporter-latest-linux-amd64
./test-reporter-latest-linux-amd64 before-build
- name: Run tests
run: bin/rails test
- name: Upload test coverage to Code Climate
if: ${{ !cancelled() }}
run: GIT_COMMITTED_AT="$(date -u +%s)" ./test-reporter-latest-linux-amd64 after-build --debug
# https://docs.codecov.io/docs
- name: Upload test coverage to Codecov.io
if: ${{ !cancelled() }}
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}