Skip to content

Commit b5fbf1b

Browse files
authored
new: Github Actions CI (#49)
* new: actions ci * new: changelog file * new: sphinx template * temp: move to `disabled-workflows` * cleanup * cleanup * more cleanup * 0.1? * 1.0
1 parent cffda39 commit b5fbf1b

File tree

15 files changed

+274
-59
lines changed

15 files changed

+274
-59
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: analyze
13+
on:
14+
workflow_dispatch:
15+
push:
16+
branches: [ main ]
17+
pull_request:
18+
branches: [ main ]
19+
schedule:
20+
- cron: "00 9 1,15 * *"
21+
jobs:
22+
analyze:
23+
runs-on: ubuntu-latest
24+
permissions:
25+
actions: read
26+
contents: read
27+
security-events: write
28+
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
language: ["python"]
33+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
34+
# Learn more:
35+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
36+
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v4
40+
41+
# Initializes the CodeQL tools for scanning.
42+
- name: Initialize CodeQL
43+
uses: github/codeql-action/init@v3
44+
with:
45+
languages: ${{ matrix.language }}
46+
# If you wish to specify custom queries, you can do so here or in a config file.
47+
# By default, queries listed here will override any specified in a config file.
48+
# Prefix the list here with "+" to use these queries and those in the config file.
49+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
50+
51+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
52+
# If this step fails, then you should remove it and run the build manually (see below)
53+
- name: Autobuild
54+
uses: github/codeql-action/autobuild@v3
55+
56+
# ℹ️ Command-line programs to run using the OS shell.
57+
# 📚 https://git.io/JvXDl
58+
59+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
60+
# and modify them (or add more) to build your code if your project
61+
# uses a compiled language
62+
63+
#- run: |
64+
# make bootstrap
65+
# make release
66+
67+
- name: Perform CodeQL Analysis
68+
uses: github/codeql-action/analyze@v3

.github/disabled-workflows/docs.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: docs
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
jobs:
8+
docs:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v4
13+
14+
- name: Fetch all tags and branches
15+
run: git fetch --prune --unshallow
16+
17+
- name: Set up Python
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: '3.10'
21+
22+
- name: Install dependencies
23+
run: pip install .[dev] && pip install -r docs/requirements.txt
24+
25+
- name: Generate Sphinx HTML
26+
run: cd docs && make html
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: release
2+
on:
3+
workflow_dispatch:
4+
release:
5+
types: [published]
6+
jobs:
7+
release:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
12+
- name: Fetch complete history for all tags and branches
13+
run: git fetch --prune --unshallow
14+
15+
- name: Setup Python
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: "3.10"
19+
20+
- name: Install release packages
21+
run: pip install build twine
22+
23+
- name: Build distribution
24+
run: python -m build
25+
26+
- name: Publish to Test PyPi
27+
env:
28+
TWINE_USERNAME: __token__
29+
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD_TEST }}
30+
run: twine upload --repository testpypi dist/*
31+
32+
- name: Publish to PyPi
33+
env:
34+
TWINE_USERNAME: __token__
35+
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
36+
run: twine upload --repository pypi dist/*
37+
38+
changelog:
39+
needs: release
40+
runs-on: ubuntu-latest
41+
steps:
42+
- uses: actions/checkout@v4
43+
with:
44+
fetch-depth: 0
45+
46+
- name: Create new branch
47+
run: git checkout -b actions/changelog
48+
49+
- name: Set branch upstream
50+
run: git push -u origin actions/changelog
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
54+
- name: Setup Python
55+
uses: actions/setup-python@v4
56+
with:
57+
python-version: "3.10"
58+
59+
- name: Install release packages
60+
run: pip install wheel gitchangelog pystache
61+
62+
- name: Set variables
63+
run: echo "VERSION=$(curl ${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/releases/latest | python -c "import sys; import json; print(json.load(sys.stdin)['tag_name'])")" >> $GITHUB_ENV
64+
65+
- name: Generate newest changelog
66+
run: gitchangelog ${{env.VERSION}} > CHANGELOG.md
67+
68+
- name: Make commit for auto-generated changelog
69+
uses: EndBug/add-and-commit@v9
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
with:
73+
add: "CHANGELOG.md"
74+
new_branch: actions/changelog
75+
message: "!gitchangelog"
76+
77+
- name: Create pull request for the auto generated changelog
78+
run: |
79+
echo "PR_URL=$(gh pr create \
80+
--title "changelog: release ${{env.VERSION}}" \
81+
--body "beep boop, i am a robot" \
82+
--label documentation)" >> $GITHUB_ENV
83+
env:
84+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Whitespace-only changes.

Makefile

Lines changed: 0 additions & 25 deletions
This file was deleted.

_nx_arangodb/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0
1+
1.0.0

_nx_arangodb/__init__.py

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"backend_name": "arangodb",
2626
"project": "nx-arangodb",
2727
"package": "nx_arangodb",
28-
"url": f"https://github.com/aMahanna/nx-arangodb",
28+
"url": "https://github.com/arangodb/nx-arangodb",
2929
"short_summary": "Remote storage backend.",
3030
# "description": "TODO",
3131
"functions": {
@@ -91,22 +91,6 @@ def get_info():
9191
if __name__ == "__main__":
9292
from pathlib import Path
9393

94-
# This script imports nx_arangodb modules, which imports nx_arangodb runtime
95-
# dependencies. The modules do not need the runtime deps, so stub them out
96-
# to avoid installing them.
97-
class Stub:
98-
def __getattr__(self, *args, **kwargs):
99-
return Stub()
100-
101-
def __call__(self, *args, **kwargs):
102-
return Stub()
103-
104-
import sys
105-
106-
sys.modules["cupy"] = Stub()
107-
sys.modules["numpy"] = Stub()
108-
sys.modules["python-arango"] = Stub()
109-
11094
from _nx_arangodb.core import main
11195

11296
filepath = Path(__file__)

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/conf.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
6+
# -- Project information -----------------------------------------------------
7+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8+
9+
import os
10+
import sys
11+
12+
sys.path.insert(0, os.path.abspath(".."))
13+
14+
project = 'nx-arangodb'
15+
copyright = '2024, ArangoDB'
16+
author = 'ArangoDB'
17+
18+
# -- General configuration ---------------------------------------------------
19+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
20+
21+
extensions = [
22+
"sphinx_rtd_theme",
23+
"sphinx.ext.autodoc",
24+
"sphinx.ext.viewcode",
25+
]
26+
templates_path = ['_templates']
27+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
28+
29+
30+
# -- Options for HTML output -------------------------------------------------
31+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
32+
33+
html_theme = 'sphinx_rtd_theme'
34+
html_static_path = ['_static']
35+
autodoc_member_order = "bysource"

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello World

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
sphinx_rtd_theme

nx_arangodb/typing.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Copied from nx-cugraph
2-
31
from __future__ import annotations
42

53
from collections.abc import Hashable

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# Copied from nx-cugraph
2-
31
[build-system]
42

53
requires = [
@@ -54,6 +52,8 @@ dev = [
5452
"isort",
5553
"mypy",
5654
"pandas",
55+
"sphinx",
56+
"sphinx_rtd_theme",
5757
]
5858
gpu = [
5959
"nx-cugraph-cu12 @ https://pypi.nvidia.com"

run_nx_tests.sh

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,10 @@
1-
# Copied from nx-cugraph
21
set -e
32

4-
# TODO: address the following tests
5-
# --pyargs networkx.algorithms.community.louvain \
6-
7-
DATABASE_HOST=http://localhost:8529
8-
DATABASE_USERNAME=root
9-
DATABASE_PASSWOR=test
10-
DATABASE_NAME=_system
11-
123
NETWORKX_GRAPH_CONVERT=arangodb \
134
NETWORKX_TEST_BACKEND=arangodb \
145
NETWORKX_FALLBACK_TO_NX=True \
156
pytest \
167
--pyargs networkx.classes \
17-
--pyargs networkx.algorithms.centrality \
18-
--pyargs networkx.algorithms.link_analysis \
19-
--pyargs networkx.algorithms.shortest_paths \
208
--cov-config=$(dirname $0)/pyproject.toml \
219
--cov=nx_arangodb \
2210
--cov-report= \

0 commit comments

Comments
 (0)