Commit Graph

31 Commits

Author SHA1 Message Date
evazion
020ed7b735 ci: don't tag short commit hash on Docker images.
Tagging both the long and the short commit hash on images creates too
much clutter in the Github UI.
2021-09-18 05:14:36 -05:00
evazion
52cf13dff1 ci: limit workflow permissions.
Make it so pull requests from outside contributors can't edit workflows
under .github/workflows/ without approval. Also limit workflows to the
minimum permissions necessary.
2021-09-18 04:37:00 -05:00
evazion
39fa2fe02d ci: split docker build workflow from test workflow.
Split up the Github workflow. Instead of one workflow with two jobs, one
to build the Docker image and one to test it, split it into two separate
workflows, one to build and one to test. This way if the Docker build
fails it doesn't try to run the tests, and if the tests fail it only
marks the test workflow as failed, not the entire workflow.

This is especially so the workflows page doesn't show everything as
failing just because the tests failed.

https://github.com/danbooru/danbooru/actions
2021-09-18 01:34:07 -05:00
evazion
291758ddb7 ci: push docker images to dockerhub too. 2021-09-07 06:49:19 -05:00
evazion
266192c599 ci: fix docker image not including git hash.
Fix the Docker image not including the git hash of the build. On
DockerHub we had to set it with a build hook, but now with Github we
set it as part of the build-push-action.
2021-09-07 06:34:50 -05:00
evazion
906eec190d ci: run tests inside docker
Run the tests using the Docker image we just built, instead of
installing everything manually and running the tests outside of Docker.
Ensures the Docker image we built really works.
2021-09-06 08:53:26 -05:00
evazion
661368bdcf ci: add github actions debugging with tmate
Usage is to run a workflow manually with debug_enabled on.

https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow#running-a-workflow
https://github.com/marketplace/actions/debugging-with-tmate
2021-09-06 04:19:52 -05:00
evazion
e240c92d6f github: update docker build workflow to use cache.
Update the Docker build workflow to use premade actions so we can cache
the build.

https://github.com/docker/setup-buildx-action
https://github.com/docker/login-action
https://github.com/docker/metadata-action
https://github.com/docker/build-push-action
2021-09-04 04:07:53 -05:00
evazion
8aa7608816 github: add docker build workflow action.
Add an action to build a Docker image and push it to the Github Packages
registry.
2021-09-03 23:23:00 -05:00
evazion
f235b72b3f Export public database dumps to BigQuery.
* Export daily public database dumps to BigQuery and Google Cloud Storage.
* Only data visible to anonymous users is exported. Some tables have
  null or missing fields because of this.
* The bans table is excluded because some bans have an expires_at
  timestamp set beyond year 9999, which BigQuery doesn't support.
* The favorites table is excluded because it's too slow to dump (it
  doesn't have an id index, which is needed by find_each).
* Version tables are excluded because dumping them every day is
  inefficient, streaming insertions should be used instead.

Links:

* https://console.cloud.google.com/bigquery?project=danbooru1
* https://console.cloud.google.com/storage/browser/danbooru_public
* https://storage.googleapis.com/danbooru_public/data/posts.json
2021-03-10 02:52:16 -06:00
evazion
b63d8207a9 forum: automatically post new forum posts to Discord. 2021-02-18 07:08:45 -06:00
evazion
013fd38175 tests: add baraag credentials to github CI. 2021-02-18 03:53:33 -06:00
evazion
39cc3ed5cf pixiv: fix API breakage.
Fix the Pixiv API no longer working by rewriting the Pixiv strategy to
use the Ajax API instead of the mobile API.

Before we could authenticate in the mobile API by using the OAuth 2.0
grant_type=password authentication flow. This no longer works. Now it
requires logging in through a HTML page, which is protected by Google
reCaptcha. This makes using the mobile API infeasible.

Instead we switch to the Ajax API, which only needs a PHPSESSID to
authenticate. This can be obtained by logging in manually and using the
devtools to extract the cookie.

This also temporarily removes support for Pixiv novels. This should be
moved to a separate source strategy.
2021-02-09 06:18:36 -06:00
evazion
9a0a988572 tests: fix test breakage in Github CI.
Fix tests not working in Github. They were failing because the latest
version of Webpack needs a version of Node newer than the version in
shipped Ubuntu 20.04.

Also fix the Docker build failing because of the system timezone
database not being installed in Ubuntu 20.10.
2021-02-05 03:40:16 -06:00
evazion
0713751e3c tests: fix user upgrades not being tested in CI. 2021-01-27 16:55:46 -06:00
evazion
e5f459bd52 ci: remove merge conflict notifier job.
Seems to be broken and it's not worth debugging.
2020-08-17 14:47:43 -05:00
evazion
136bb9d8ae ci: fix codecov.io uploader not working.
We need to check out the full repo so the codecov.io uploader can detect
the branch and commit hash.
2020-06-27 20:26:48 -05:00
evazion
09dff5b929 ci: track coverage with codecov.io instead of codeclimate.com.
Comparison:

* Codecov has a simpler integration and a better UI.
* Codeclimate tracks both linter warnings (Rubocop, ESLint) and code
  coverage, but its UI for code coverage is worse than Codecov's.
* Codeclimate doesn't support Simplecov 0.18 because Codeclimate doesn't
  support 0.18's new coverage format yet.
2020-06-27 13:01:35 -05:00
evazion
1d369f4574 ci: notify when a PR has a merge conflict.
Adds a "merge conflict" label and posts a comment when a PR has a merge
conflict. See https://github.com/Marr11317/ConflictAdviser#limitations.
2020-06-24 02:01:41 -05:00
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
evazion
52367c79e2 ci: upload code coverage even when tests fail. 2020-06-15 20:21:09 -05:00
evazion
4c56447d66 ci: add codecov.io integration. 2020-06-15 17:32:59 -05:00
evazion
107729e17f ci: enable codeclimate reporter debug output. 2020-06-15 17:21:41 -05:00
evazion
a615a28b1b ci: disable warnings during tests. 2020-06-15 16:45:37 -05:00
evazion
f60b184a12 ci: don't trigger twice on pull requests. 2020-06-15 16:45:37 -05:00
evazion
025e09ff7f tests: upload test coverage reports to code climate.
Downgrade simplecov to 0.17 because 0.18 is incompatible with code
climate. Ref: github.com codeclimate/test-reporter/issues/413
2020-06-11 15:35:15 -05:00
evazion
04c8c25976 tests: initialize pawoo credentials in github tests. 2020-06-10 22:49:28 -05:00
evazion
5919fa0ca1 tests: enable parallel tests. 2020-06-10 22:26:47 -05:00
evazion
5e63a7cf77 Add test workflow. 2020-06-10 17:52:13 -05:00
evazion
060a585e34 stale.yml: bump timeouts, change wontfix -> stale 2019-08-05 17:52:15 -05:00
Albert Yi
2db8e9814b add yml file for stale bot 2019-07-29 14:10:47 -07:00