Answer checking API for CI/CD

Announcements, comments, ideas, feedback, and "How do I... ?" questions
Post Reply
MavicMaverick
Posts: 4
Joined: Tue Apr 14, 2020 10:47 am

Answer checking API for CI/CD

Post by MavicMaverick »

It would be good to have an API to check answers with. My use case is that I run a private GitHub repository with the code for my solutions which is integrated with Travis CI, Coveralls, Codecov, CodeScene, Better Code Hub and DeepSource. I run builds on Travis for each commit. It would be awesome if it was possible for me to add a script which could check the solutions to the puzzles in the builds which would fail if incorrect. Also, it would be useful to generally submit answers.

neighthann
Posts: 9
Joined: Thu Apr 09, 2020 5:15 pm

Re: Answer checking API for CI/CD

Post by neighthann »

You can write something up to submit answers for you if you give it your keep_alive cookie (it just has to do the HTTP request to get the problem page, extract a couple of things from that, then send back the solution). I did this recently for a Project Euler app that I'm making. I'm planning to put the code on GitHub once I release the app, but if you're interested in this approach but need more concrete guidance to implement it yourself, let me know, and I'm happy to put my code up sooner and give a pointer to the relevant file.

neighthann
Posts: 9
Joined: Thu Apr 09, 2020 5:15 pm

Re: Answer checking API for CI/CD

Post by neighthann »

See my thread on this (viewtopic.php?f=5&t=7066) for a couple more details.

pjt33
Posts: 32
Joined: Mon Oct 06, 2008 6:14 pm

Re: Answer checking API for CI/CD

Post by pjt33 »

MavicMaverick wrote:
Tue Apr 14, 2020 10:57 am
It would be awesome if it was possible for me to add a script which could check the solutions to the puzzles in the builds which would fail if incorrect.
For that use case you don't want an API: you want a local file with test cases. Otherwise your build can randomly fail due either to temporary network problems or to the PE team deciding to change a parameter in the question in order to adapt the difficulty to improved hardware. (There are a number of questions where it's obvious from the thread that earlier solvers were working against different parameters to the current question).

MavicMaverick
Posts: 4
Joined: Tue Apr 14, 2020 10:47 am

Re: Answer checking API for CI/CD

Post by MavicMaverick »

Thanks. I will try this.

Post Reply