Skip to content

Commit

Permalink
Update READMEs, add to filter, split off python-lint
Browse files Browse the repository at this point in the history
  • Loading branch information
LivInTheLookingGlass committed Jul 19, 2024
1 parent a157716 commit 686ba3f
Show file tree
Hide file tree
Showing 16 changed files with 255 additions and 50 deletions.
1 change: 1 addition & 0 deletions .github/workflows/c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths-ignore:
- 'docs/**'
- 'README.rst'
- '**/README.rst'
schedule:
- cron: "0 0 1 * *"

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:
paths-ignore:
- 'docs/**'
- 'README.rst'
- '**/README.rst'
branches: [ "master" ]
pull_request:
branches: [ "master" ]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cplusplus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths-ignore:
- 'docs/**'
- 'README.rst'
- '**/README.rst'
schedule:
- cron: "0 0 1 * *"

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/csharp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths-ignore:
- 'docs/**'
- 'README.rst'
- '**/README.rst'
schedule:
- cron: "0 0 1 * *"

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
paths-ignore:
- 'docs/**'
- 'README.rst'
- '**/README.rst'
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/javascript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ on:
paths-ignore:
- 'docs/**'
- 'README.rst'
- '**/README.rst'
schedule:
- cron: "0 0 1 * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
javascript:
strategy:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/python-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Python-Lint

on:
push:
paths-ignore:
- 'docs/**'
- 'README.rst'
- '**/README.rst'
schedule:
- cron: "0 0 1 * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
python-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Use Python 3.12
uses: actions/setup-python@v5
with:
python-version: 3.12
cache: 'pip'
cache-dependency-path: |
python/requirements.txt
c/requirements.txt
- name: Lint
run: make pytest LINT=only
18 changes: 1 addition & 17 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths-ignore:
- 'docs/**'
- 'README.rst'
- '**/README.rst'
schedule:
- cron: "0 0 1 * *"

Expand All @@ -13,23 +14,6 @@ concurrency:
cancel-in-progress: true

jobs:
# python-lint:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
#
# - name: Use Python 3.12
# uses: actions/setup-python@v5
# with:
# python-version: 3.12
# cache: 'pip'
# cache-dependency-path: |
# python/requirements.txt
# c/requirements.txt
#
# - name: Lint
# run: make pytest LINT=only

python:
strategy:
fail-fast: false
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/rust-clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
paths-ignore:
- 'docs/**'
- 'README.rst'
- '**/README.rst'
branches: [ "master" ]
pull_request:
# The branches below must be a subset of the branches above
Expand All @@ -24,7 +25,7 @@ on:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
rust-clippy-analyze:
name: Run rust-clippy analyzing
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
paths-ignore:
- 'docs/**'
- 'README.rst'
- '**/README.rst'
schedule:
- cron: "0 0 1 * *"

Expand Down
63 changes: 34 additions & 29 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,42 +19,47 @@ LivInTheLookingGlass’s Project Euler solutions
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/eslint.yml
.. |RustClippy| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/rust-clippy.yml/badge.svg
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/rust-clippy.yml
.. |PythonLint| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python-lint.yml/badge.svg
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/python-lint.yml
.. |Pages| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/pages.yml/badge.svg
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/pages.yml
.. |Coverage| image:: https://codecov.io/github/LivInTheLookingGlass/Euler/graph/badge.svg?token=6GHBNILEHG
:target: https://codecov.io/github/LivInTheLookingGlass/Euler
.. |br| raw:: html

<br/>

+------------+---------------------+--------+---------------+
| Language | Version | Solved | Status |
+============+=====================+========+===============+
| C | C99+ in: ``gcc``, | 17 | |Ci| |
| | |br| ``clang``, | | |
| | ``msvc``, |br| | | |
| | ``pcc``, ``tcc`` | | |
+------------+---------------------+--------+---------------+
| C++ | C++98+ | 1 | |Cpi| |
+------------+---------------------+--------+---------------+
| C# | .NET 2+ | 6 | |C#i| |
+------------+---------------------+--------+---------------+
| JavaScript | Node 12+ | 5 | |JavaScript| |
+------------+---------------------+--------+---------------+
| Python | CPython 3.6+ |br| | 70 | |Python| |
| | Pypy 3.6+ |br| | | |
| | GraalPy 23.1+ | | |
+------------+---------------------+--------+---------------+
| Rust | 1.69+ | 10 | |Rust| |
+------------+---------------------+--------+---------------+
| Documentation (in progress) | |Pages| |
+-------------------------------------------+---------------+
| Code Coverage | |Coverage| |
+-------------------------------------------+---------------+
| Code Scanning | |CodeQL| |br| |
| | |ESLint| |br| |
| | |RustClippy| |
+-------------------------------------------+---------------+

+------------+---------------------+--------+-------------------+
| Language | Version | Solved | Status |
+============+=====================+========+===================+
| C | C99+ in: ``gcc``, | 17 | |Ci| |
| | |br| ``clang``, | | |
| | ``msvc``, |br| | | |
| | ``pcc``, ``tcc`` | | |
+------------+---------------------+--------+-------------------+
| C++ | C++98+ in ``g++`` | 1 | |Cpi| |
| | |br| ``clang``, | | |
| | ``msvc`` | | |
+------------+---------------------+--------+-------------------+
| C# | .NET 2+ | 6 | |C#i| |
+------------+---------------------+--------+-------------------+
| JavaScript | Node 12+ | 5 | |JavaScript| |
+------------+---------------------+--------+-------------------+
| Python | CPython 3.6+ |br| | 70 | |Python| |
| | Pypy 3.6+ |br| | | |
| | GraalPy 23.1+ | | |
+------------+---------------------+--------+-------------------+
| Rust | 1.69+ | 10 | |Rust| |
+------------+---------------------+--------+-------------------+
| Documentation (in progress) | |Pages| |
+-------------------------------------------+-------------------+
| Code Coverage | |Coverage| |
+-------------------------------------------+-------------------+
| Code Scanning | |CodeQL| |br| |
| | |ESLint| |br| |
| | |PythonLint| |br| |
| | |RustClippy| |
+-------------------------------------------+-------------------+

Coverage
--------
Expand Down
158 changes: 158 additions & 0 deletions cplusplus/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
C++ Section
===========

.. |C++ Check| image:: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/cplusplus.yml/badge.svg
:target: https://github.com/LivInTheLookingGlass/Euler/actions/workflows/cplusplus.yml

|C++ Check|

All problems are solved in C++98. It is tested on clang, g++, and msvc (the Visual Studios compiler).

Organization
------------

All C++ files share a common prefix with their problem number. All shared
functions are moved to header files in the include subfolder

Makefile
--------

There are three main recipes in this Makefile

dependencies
~~~~~~~~~~~~

This recipe installs all the required and test dependencies. See the
Dependencies section for more info

test
~~~~

This recipe runs tests in a single thread and performs benchmarks on
each. This test infrastructure is recycled from the python section.

test\_\*
~~~~~~~~

This recipe runs tests in multiple threads, using however many are
specified by the number after the \_. For example, ``test_3`` would
spawn three python processes. Because benchmark disables itself when
running in children processes, benchmark info is not available with this
recipe.

Tests
-----

Compiler Detection Macros
~~~~~~~~~~~~~~~~~~~~~~~~~

There are a set of macros which detect which compiler is being used.
These macros are mostly used to route around issues with particular
compilers. For instance, PCC does not allow me to include ``<stdlib.h>``
or ``<math.h>`` on the systems I've tested it on, so I need to route
around that. This test checks that those macros are correct.

Prime Infrastructure Test
~~~~~~~~~~~~~~~~~~~~~~~~~

This test checks five things:

1. It checks ``is_prime()`` for numbers up to ``MAX_PRIME``, where that
is defined in the test
2. It checks that ``is_composite()`` returns truthy values on composites
in that range, and falsey values on primes
3. It checks that ``is_composite()`` returns the smallest prime factor
on composite numbers
4. It checks that the prime numbers are generated in the correct order
5. It checks that all these operations are completed in less than 200ns
\* ``MAX_PRIME``

Generic Problems
~~~~~~~~~~~~~~~~

For each problem it will check the answer against a known dictionary. If
the problem is not in the "known slow" category (meaning that I generate
the correct answer with a poor solution), it will run it as many times
as the benchmark plugin wants. Otherwise it is run exactly once.

A test fails if it gets the wrong answer or if it takes more than 1
minute.

Dependencies
------------

I try to keep the dependencies of this project as small as possible,
except for test plugins. At the moment there are no non-test
dependencies for this section.

Note that there are optional test that leverage the Python
infrastructure. If you want these tests to work you need to go to the
python folder and run ``make dependencies`` or define the
`NO_OPTIONAL_TESTS <#no-slow-tests>`__ environment variable.

Environment Variables
---------------------

COMPILER_OVERRIDE
~~~~~~~~~~~~~~~~~

If this variable is defined, it should contain a comma-separated list of
the compilers you would like to test from the following list (case
insensitive):

- aocc (AMD Optimized C Compiler)
- cl (Visual Studios compiler)
- clang
- gcc
- icc (Intel C Compiler)
- pcc (Portable C Compiler)
- tcc (Tiny C Compiler)

If this variable is not defined, compilers will be auto-detected using
``which()``.

AOCC_OVERRIDE
~~~~~~~~~~~~~

If this variable is defined, it should hold a string representing the
AMD compiler binary you would like to use. One case you may want this in
is to test both the AMD compiler and traditional clang by renaming the
AMD compiler's executable.

GCC_OVERRIDE
~~~~~~~~~~~~

If this variable is defined, it should hold a string representing the
``gcc`` binary you would like to use. One case you may want this in is
on OSX or Termux, where ``gcc`` is often remapped to ``clang``.

NO_OPTIONAL_TESTS
~~~~~~~~~~~~~~~~~

If this variable is defined to something other than 0 or an empty
string, the test suite will skip any tests which are not directly
related to Project Euler problems. This value will default to the same
value as `ONLY_SLOW <#only-slow>`__.

NO_SLOW
~~~~~~~

If this variable is defined to something other than 0 or an empty
string, problems in the known_slow group will not be tested. This
variable defaults to True on Termux systems. If both
`NO_SLOW <#no-slow>`__ and `ONLY_SLOW <#only-slow>`__ are
truthy, they will be ignored and a warning will be issued.

ONLY_SLOW
~~~~~~~~~

If this variable is defined to something other than 0 or an empty
string, *only* problems in the known_slow group will be tested. If both
`NO_SLOW <#no-slow>`__ and `ONLY_SLOW <#only-slow>`__ are
truthy, they will be ignored and a warning will be issued.

Problems Solved
---------------

- ☒ `1 <./p0001.cpp>`__

6 changes: 6 additions & 0 deletions csharp/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,9 @@ Problems Solved
---------------

- ☒ `1 <./p0001.cs>`__
- ☒ `2 <./p0002.cs>`__
- ☒ `4 <./p0004.cs>`__
- ☒ `6 <./p0006.cs>`__
- ☒ `8 <./p0008.cs>`__
- ☒ `9 <./p0009.cs>`__

Loading

0 comments on commit 686ba3f

Please sign in to comment.