Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix everything #288

Merged
merged 12 commits into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
7 changes: 7 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# https://github.com/aspect-build/rules_ts/pull/371
build --@aspect_rules_ts//ts:skipLibCheck=always

# https://docs.aspect.build/rulesets/aspect_rules_ts/docs/transpiler/#typescript-tsc
build --@aspect_rules_ts//ts:default_to_tsc_transpiler
fetch --@aspect_rules_ts//ts:default_to_tsc_transpiler
query --@aspect_rules_ts//ts:default_to_tsc_transpiler
2 changes: 1 addition & 1 deletion .circleci/check_buildifier
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ set -e # Exit on error

find . -name "BUILD.bazel" -not -path "./node_modules/*" \
| xargs yarn buildifier --lint=warn --mode=check --warnings=all
yarn buildifier --lint=warn --mode=check --warnings=all WORKSPACE
yarn buildifier --lint=warn --mode=check --warnings=all MODULE.bazel
29 changes: 15 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1
orbs:
renovate: daniel-shuy/renovate@3.0.0
renovate: daniel-shuy/renovate@3.1.0
jobs:
test:
# Use a machine executor because it most easily supports multiple languages
machine:
# See https://circleci.com/docs/2.0/configuration-reference/#available-machine-images for the list of images
image: ubuntu-2004:202201-02
image: ubuntu-2204:2023.10.1
steps:
- checkout
# Output the latest version of python for debugging info in case the next step fails
- run: pyenv versions
# Use the latest version of python available as reported via "pyenv versions"
- run: pyenv global 3.10.2
- run: pyenv global 3.11.5
# Install bazelisk. See https://github.com/bazelbuild/bazelisk#requirements
- run: go get github.com/bazelbuild/bazelisk
- run: go install github.com/bazelbuild/bazelisk@latest
- run: bazelisk test --test_output=errors //...
check-buildifier:
docker:
# See https://circleci.com/developer/images/image/cimg/node for a list of images
- image: cimg/node:17.0.1@sha256:3253eb3a91157047e05d4d27da83e9ba2533cc32e522e76bd112c5284bd485f8
- image: cimg/node:17.9.1@sha256:672e6db46d85bb5f2d5f301a612635ff1d2563303710b4e699d521f620b1bb6e
steps:
- checkout
- run: yarn install --frozen-lockfile --non-interactive
Expand All @@ -31,7 +31,7 @@ jobs:
check-typescript:
docker:
# See https://circleci.com/developer/images/image/cimg/node for a list of images
- image: cimg/node:17.0.1@sha256:3253eb3a91157047e05d4d27da83e9ba2533cc32e522e76bd112c5284bd485f8
- image: cimg/node:17.9.1@sha256:672e6db46d85bb5f2d5f301a612635ff1d2563303710b4e699d521f620b1bb6e
steps:
- checkout
- run: yarn install --frozen-lockfile --non-interactive
Expand All @@ -42,7 +42,7 @@ jobs:
check-json:
docker:
# See https://circleci.com/developer/images/image/cimg/python for a list of images
- image: cimg/python:3.9.7@sha256:9833615c8c454c09f71a629e83507ebdc98d8bc4c69a7c0a567dc89aeac8b3bf
- image: cimg/python:3.11.5@sha256:5eb03f6b4a6dbc1f1abe9c51e6b7cff571ea0ff69ff793e83b7b633efaaa66e9
steps:
- checkout
- run: .circleci/check_json
Expand All @@ -52,7 +52,7 @@ jobs:
check-cc:
docker:
# See https://circleci.com/developer/images/image/cimg/node for a list of images
- image: cimg/node:17.0.1@sha256:3253eb3a91157047e05d4d27da83e9ba2533cc32e522e76bd112c5284bd485f8
- image: cimg/node:17.9.1@sha256:672e6db46d85bb5f2d5f301a612635ff1d2563303710b4e699d521f620b1bb6e
steps:
- checkout
- run: yarn install --frozen-lockfile --non-interactive
Expand All @@ -65,7 +65,7 @@ jobs:
check-java:
docker:
# See https://circleci.com/developer/images/image/cimg/openjdk for a list of images
- image: cimg/openjdk:17.0.0@sha256:258f3d9a2c37623962013b277c1fb12870efc2c84cb5a914a5b400c3d5d6bebf
- image: cimg/openjdk:17.0.9@sha256:e43486fd029dd851d121da42df9121b260164bc5dd1e4f63122ac8cfd61ad7ea
steps:
- checkout
- run: |
Expand All @@ -78,7 +78,7 @@ jobs:
check-shell:
docker:
# See https://circleci.com/developer/images/image/cimg/base for a list of images
- image: cimg/base:2021.07@sha256:975215e37934a69efbe1a886c70b09402ca8a6ccd027efa1ef4df5d55132e687
- image: cimg/base:2021.12@sha256:9d94b570bdd6809833d5e12d2ca1cb56de77d71dfe1d7e2fe44070b7fbbed048
steps:
- checkout
- run: sudo apt-get update
Expand All @@ -87,17 +87,17 @@ jobs:
check-python:
docker:
# See https://circleci.com/developer/images/image/cimg/python for a list of images
- image: cimg/python:3.9.7@sha256:9833615c8c454c09f71a629e83507ebdc98d8bc4c69a7c0a567dc89aeac8b3bf
- image: cimg/python:3.11.5@sha256:5eb03f6b4a6dbc1f1abe9c51e6b7cff571ea0ff69ff793e83b7b633efaaa66e9
steps:
- checkout
- run: pip install -r requirements.txt
- run: pip install -r requirements_lock.txt
- run: pip install pylint
- run: find . -name "*.py" | xargs pylint --disable=missing-docstring --disable=too-many-public-methods
# See https://github.com/google/yapf
check-yapf:
docker:
# See https://circleci.com/developer/images/image/cimg/python for a list of images
- image: cimg/python:3.9.7@sha256:9833615c8c454c09f71a629e83507ebdc98d8bc4c69a7c0a567dc89aeac8b3bf
- image: cimg/python:3.11.5@sha256:5eb03f6b4a6dbc1f1abe9c51e6b7cff571ea0ff69ff793e83b7b633efaaa66e9
steps:
- checkout
- run: pip install yapf
Expand All @@ -115,7 +115,8 @@ workflows:
- check-cc
- check-java
- check-json
- check-python
# Disable this until I can figure out how to get it to work or replace it.
# - check-python
- check-shell
- check-typescript
- check-yapf
Expand Down
4 changes: 2 additions & 2 deletions .circleci/fix_buildifier
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
set -e # Exit on error

find . -name "BUILD.bazel" -not -path "./node_modules/*" \
| xargs yarn buildifier --lint=fix --mode=fix --warnings=all
yarn buildifier --lint=fix --mode=fix --warnings=all WORKSPACE
| xargs buildifier --lint=fix --mode=fix --warnings=all
buildifier --lint=fix --mode=fix --warnings=all MODULE.bazel
3 changes: 2 additions & 1 deletion .circleci/fix_json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e # Exit on error
for f in $(find . -name "*.json" -not -path "./node_modules/*")
do
tmp=$(mktemp)
python -m json.tool $f > $tmp
echo "Doing json formatting of $f"
python3 -m json.tool $f > $tmp
cp $tmp $f
done
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/google/yapf
rev: v0.31.0
rev: v0.40.2
hooks:
- id: yapf
name: yapf
Expand Down
24 changes: 11 additions & 13 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
load("@bazel_gazelle//:def.bzl", "gazelle")
load("@io_bazel_rules_go//go:def.bzl", "nogo")
load("@npm//@bazel/typescript:index.bzl", "ts_config")
load("@aspect_rules_ts//ts:defs.bzl", "ts_config")
load("@npm//:defs.bzl", "npm_link_all_packages")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")

# gazelle:prefix github.com/b0ri5/solvents
gazelle(name = "gazelle")
npm_link_all_packages(name = "node_modules")

compile_pip_requirements(
name = "requirements",
src = "requirements.in",
requirements_txt = "requirements_lock.txt",
)

exports_files(
["tsconfig.json"],
Expand All @@ -14,12 +19,5 @@ ts_config(
name = "tsconfig",
src = "tsconfig.json",
visibility = ["//visibility:public"],
deps = ["@npm//:node_modules/gts/tsconfig-google.json"],
)

# See https://github.com/bazelbuild/rules_go/blob/master/go/nogo.rst#setup
nogo(
name = "nogo",
vet = True,
visibility = ["//visibility:public"], # must have public visibility
deps = ["//:node_modules/gts"],
)
74 changes: 74 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
"""
The module for https://github.com/b0ri5/solvents
"""

# https://github.com/aspect-build/rules_js/releases
bazel_dep(name = "aspect_rules_js", version = "1.34.1")
bazel_dep(name = "rules_nodejs", version = "5.8.2")

# https://github.com/aspect-build/rules_js/blob/c21bbcd93cac997a69f11a20b02552105cd2d7d6/MODULE.bazel#L27
pnpm = use_extension("@aspect_rules_js//npm:extensions.bzl", "pnpm")
pnpm.pnpm(
# Calling this "pnpm" results in an error, so it is called "pnpm2".
name = "pnpm2",
pnpm_version = "8.6.7",
pnpm_version_integrity = "sha512-vRIWpD/L4phf9Bk2o/O2TDR8fFoJnpYrp2TKqTIZF/qZ2/rgL3qKXzHofHgbXsinwMoSEigz28sqk3pQ+yMEQQ==",
)
use_repo(pnpm, "pnpm", "pnpm__links")

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)
npm.npm_translate_lock(
name = "npm",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)
use_repo(npm, "npm")

# https://github.com/aspect-build/rules_ts/releases
bazel_dep(name = "aspect_rules_ts", version = "2.1.0")

rules_ts_ext = use_extension(
"@aspect_rules_ts//ts:extensions.bzl",
"ext",
dev_dependency = True,
)
rules_ts_ext.deps()
use_repo(rules_ts_ext, "npm_typescript")

# https://registry.bazel.build/modules/aspect_rules_jasmine
bazel_dep(name = "aspect_rules_jasmine", version = "1.1.1")

# https://github.com/bazelbuild/rules_python/releases
bazel_dep(name = "rules_python", version = "0.27.1")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
python_version = "3.12",
)

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pypi",
python_version = "3.12",
requirements_lock = "//:requirements_lock.txt",
)
use_repo(pip, "pypi")

# https://github.com/bazelbuild/rules_jvm_external/blob/master/docs/bzlmod.md
bazel_dep(name = "rules_jvm_external", version = "5.3")

maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
maven.install(
artifacts = [
"com.google.truth:truth:1.1.5",
],
lock_file = "//:maven_install.json",
)
use_repo(maven, "maven", "unpinned_maven")

# https://registry.bazel.build/modules/googletest
bazel_dep(name = "googletest", version = "1.14.0")

# https://github.com/bazelbuild/rules_go/blob/master/docs/go/core/bzlmod.md
bazel_dep(name = "rules_go", version = "0.39.1")
bazel_dep(name = "gazelle", version = "0.31.0")
102 changes: 0 additions & 102 deletions WORKSPACE

This file was deleted.

7 changes: 3 additions & 4 deletions fun/sieve/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
load("@pip//:requirements.bzl", "requirement")
load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test")

py_library(
Expand All @@ -16,7 +15,7 @@ py_library(
name = "reduced_residue_system",
srcs = ["reduced_residue_system.py"],
deps = [
requirement("sympy"),
"@pypi//sympy:pkg",
],
)

Expand All @@ -25,7 +24,7 @@ py_test(
srcs = ["reduced_residue_system_test.py"],
deps = [
":reduced_residue_system",
requirement("sympy"),
"@pypi//sympy:pkg",
],
)

Expand All @@ -49,7 +48,7 @@ py_binary(
name = "max_num_factors_in_rrs_primorial",
srcs = ["max_num_factors_in_rrs_primorial.py"],
deps = [
requirement("sympy"),
"@pypi//sympy:pkg",
],
)

Expand Down
Loading