Skip to content

Commit

Permalink
Create wiki.yml (#229)
Browse files Browse the repository at this point in the history
* Create wiki.yml

Allow the creation of wiki files automatically for documentation purposes

* list docs for compiling

* runs python step

* Changed to using relative imports

* fix wiki error

* setup protobuf inside the action

* adding init.py

* try installing via an action

* the action does not work for us

* adding logging

* added new step

* maybe dont copy everything

* local copying

* Update wiki.yml

* Update wiki.yml

* trying something

* checking for protoc

* sequential execution

* sequential execution (2)

* success condition + full path names

* small syntax fix?

* smaller fix

* fix?

* fix? (2)

* Print dirs for debug.

* Duplicate works!
Sequential execution for Dependencies.

* Duplicate didn't solve the problem. Checking logs w/o it.

* Install wheel before protobuf setup.

* Split-up for debugging.

* Bunch of prints

* Catch exception?

* Full fix: added shared library refresh to install-protoc.sh, which supposedly fixes the .libs directory problem.

NOTE: Currently not skipping df_methods/summary.md to see if anything uploads.

* Using the output folder; reformatting files for proper markdown.

* Final touches (hopefully).

Co-authored-by: Matthew Mage <[email protected]>
Co-authored-by: DivvyCr <[email protected]>
  • Loading branch information
3 people authored Apr 29, 2020
1 parent f8515c3 commit ff1ab80
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 18 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/wiki.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Update and upload DataFrame information.

on:
push:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
with:
python-version: '3.7' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified

- name: Install/Update pip and wheel.
run:
python -m pip install --upgrade pip &&
pip install wheel

- name: Set-up and install protobuf.
run: chmod 777 ./_travis/install-protoc.sh && ./_travis/install-protoc.sh 2.6.1

- name: Install dependencies.
run: pip install -r requirements.txt

- name: Initialise.
run: python init.py

- name: Create document
run: python -m carball.tests.docs.data_frame_docs

- name: wiki-page-creator-action
uses: Decathlon/[email protected]
env:
GH_PAT: ${{ secrets.GH_WIKI_EDIT_TOKEN }}
ACTION_MAIL: [email protected]
ACTION_NAME: saltie
OWNER: SaltieRL
REPO_NAME: carball
MD_FOLDER: carball/tests/docs/
SKIP_MD: df_methods.md, df_summary.md
7 changes: 6 additions & 1 deletion _travis/install-protoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ unzip protobuf-${protoc_version}.zip
cd protobuf-${protoc_version}
echo "CONFIGURING PROTOBUF"
./configure
echo "COMPILING PROTOBUF"
echo "COMPILING and INSTALLING PROTOBUF and SHARED LIBRARIES (.libs)"
make
make check
sudo make install
sudo ldconfig
echo "GETTING PROTOBUF VERSION"
./src/protoc --version
echo "CLEANING UP"
Expand All @@ -25,3 +28,5 @@ pwd
ls -lh
echo "COPYING PROTOBUF TO NEW DIRECTORY"
cp ./protobuf-${protoc_version}/src/protoc carball/generated/binaries
cd carball/generated/binaries
ls -lh
16 changes: 6 additions & 10 deletions carball/tests/docs/data_frame_docs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os

import carball
from carball.tests.utils import get_replay_path
from ... import analyze_replay_file
from ..utils import get_replay_path


# All relevant files begin with df_ .
Expand All @@ -10,16 +10,12 @@ def create_df_docs():
replay_path = get_replay_path("SHORT_SAMPLE.replay")

working_dir = os.path.dirname(__file__)
output_dir = os.path.join(working_dir, 'output')

df_summary_path = os.path.join(working_dir, 'df_summary.md')
df_methods_path = os.path.join(working_dir, 'df_methods.md')
df_docs_path = os.path.join(output_dir, "DATA_FRAME_INFO.md")
df_docs_path = os.path.join(working_dir, "data_frame.md")

if not os.path.exists(output_dir):
os.mkdir(output_dir)

analysis = carball.analyze_replay_file(replay_path, clean=False)
analysis = analyze_replay_file(replay_path, clean=False)

data_frame = analysis.get_data_frame()

Expand All @@ -38,7 +34,7 @@ def create_df_docs():

df_docs.write("\n")

df_docs.write("##Example (list of columns)\n")
df_docs.write("## Example (list of columns)\n")
df_docs.write("Each subheading is the primary column heading, and each row is the secondary column heading."
"The 'Player' subheading will be unique for each player in the replay (i.e. for a 3v3 game, there "
"will be 6 distinct players)\n")
Expand All @@ -47,7 +43,7 @@ def create_df_docs():
for c in data_frame.columns:
if current_heading != c[0]:
current_heading = c[0]
df_docs.write("\n####" + c[0])
df_docs.write("\n#### " + c[0])

df_docs.write("\n\t" + c[1])

Expand Down
8 changes: 4 additions & 4 deletions carball/tests/docs/df_methods.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
##Important Methods
## Important Methods
To effectively use the DataFrame object, below are listed some of the more valuable methods. Please make sure that you
search the pandas docs for clarifications, *before* asking questions.

####data_frame.x.y
#### data_frame.x.y
For example, `data_frame.game.time`.

This method simply narrows the scope to the selected column(s). The *x* variable refers to the first value of the tuple,
Expand All @@ -14,7 +14,7 @@ The first (left-most) column still refers to the consecutive in-game frames.
**Notes:**
* To see all available columns, either refer to the given example, or do data_frame.info(verbose=True)

####data_frame.loc()
#### data_frame.loc()

For example, `data_frame.loc[1, 'Player']` `data_frame.loc[1, ('Player', 'ping')]`

Expand All @@ -25,6 +25,6 @@ to access (to access a single, specific column, use the desired tuple in bracket
* The index is an integer, not a string.
* The column keys are always strings.

####data_frame.at()
#### data_frame.at()

Exactly the same as .loc(), but should preferably be used to access single values, as opposed to many rows/columns.
2 changes: 1 addition & 1 deletion carball/tests/docs/df_summary.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
##Summary
## Summary
The DataFrame is an instance of two-dimensional, size-mutable, potentially heterogeneous tabular data. It comes as part
of the pandas package (often imported as *pd*).

Expand Down
5 changes: 4 additions & 1 deletion init.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ def initalize_rattletrap():
print('Issue adding rattletrap')

def initialize_project():
print("Importing necessary methods...")
from utils.create_proto import create_proto_files
from utils.import_fixer import convert_to_relative_imports


print("Creating proto files...")
create_proto_files()
convert_to_relative_imports()
initalize_rattletrap()

if __name__ == "__main__":
print("Initialising project...")
initialize_project()
2 changes: 1 addition & 1 deletion utils/create_proto.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def create_proto_files():
print('creating proto file', file, end='\t')
result = call([get_proto(), '--python_out=' + proto_dir, '--proto_path=' + current_dir, file])
if result != 0:
raise result
raise ValueError(result)
print(result)


Expand Down

0 comments on commit ff1ab80

Please sign in to comment.