Skip to content

Latest commit

 

History

History
108 lines (94 loc) · 5.64 KB

README.md

File metadata and controls

108 lines (94 loc) · 5.64 KB

bga-innovation

Development flow:

In order to test changes to the game, you need to be able to copy the code out of our GitHub repository and into a personal BGA project and then back again.

Prerequisites

Once the project is checked out, run composer install to pull the dependencies (mainly for unit testing).

Setting up your branch

In order to submit changes to this repository you will need to eventually submit a pull request with your changes. This means you need to have your own local branch. Before running the following commands, make sure you are on the branch of this repository that you want to diverge from (e.g. main-dev) and that you have called git pull so that you have the latest changes.

git branch johnsmith
git checkout johnsmith

Copying to your project

Use the bgaprojectrename.php script from the https://github.com/elaskavaia/bga-sharedcode repository you cloned. For example, if your BGA project is named InnovationJohnSmith, you would call a command like:

php bga-sharedcode/misc/bgaprojectrename.php innovation innovationjohnsmith 

WARNING: In order for the script to work correctly, the directory containing our repository should be named innovation not bga-innovation.

After using the bgaprojectrename.php script, check the innovationjohnsmith.action.php file and make sure the file contains class action_innovationjohnsmith extends APP_GameAction instead of class action_innovationjohnsmithjohnsmith extends APP_GameAction. If the name of the action class is wrong, then when you start a game you will just see a blank white screen.

Make your changes

Make all of your changes in this other directory (e.g. innovationjohnsmith), testing them on https://studio.boardgamearena.com/ by pushing them to your BGA project. This can be accomplished by using the SFTP extension in VSCode.

Copying from your project

After you've tested your changes, copy the changes back to your local branch in our repository.

php bga-sharedcode/misc/bgaprojectrename.php innovationjohnsmith innovation  

Creating pull request

Push your local branch into the GitHub repository.

git push -u origin johnsmith

Then navigate to https://github.com/micahstairs/bga-innovation/pulls, click "New pull request", and follow the prompts there.

Setting up VSCode

{
    "name": "BGA",
    "host": "1.studio.boardgamearena.com",
    "protocol": "sftp",
    "port": 22,
    "username": "johnsmith",
    "password": "password",
    "remotePath": "/innovationjohnsmith/",
    "uploadOnSave": true,
    "ignore": [
        ".vscode",
        ".git",
        ".github",
        ".DS_Store",
        ".phpunit.result.cache",
        "misc/",
        "node_modules",
        "package-lock.json",
        "vendor/",
        "composer.json",
        "composer.lock",
        "phpunit.xml",
        "tests/"
    ],
    "syncOption": {
        "skipCreate": false,
        "delete": true 
    }
}
  • Sometimes you will have to run a manual push of your files and you can do that by using the command shortcut Ctrl+Shift+P and runing SFTP: Sync Local -> Remote
  • macOS users may encounter issues due to ssh-keychain not correctly being used for SFTP. This can be fixed by adding "agent": "$SSH_AUTH_SOCK" or directly linking the relevant private key path, "privateKeyPath": "/path/to/private/ssh/key"
  • If you are working with SCSS you should perform these steps
    "runOnSave.commands": [
            {
                "match": ".*\\.scss$",
                "notMatch": "variables.scss$",
                "command": "sass ${file} ${fileDirname}/${fileBasenameNoExtension}.css",
                "runIn": "backend",
                "runningStatusMessage": "Compiling ${fileBasename}",
                "finishStatusMessage": "${fileBasename} compiled"
            }
        ]
    

Testing

We use phpunit for testing, and you can view those tests in the tests/ folder.

To run the tests, simply run: ./vendor/bin/phpunit