Skip to content

Commit

Permalink
feat: GitHub Codespaces support in LocalNet command group (#456)
Browse files Browse the repository at this point in the history
* chore: wip codespaces

* feat: algokit localnet + github codespaces integration

* chore: minor tweaks

* chore: minor refinements

* chore: minor refinements

* docs: regen docs

* chore: minor tweaks

* feat: initial implementation and first batch of snapshot tests

* chore: minor typo fixes

* docs: regen docs

* refactor: further refinements

* chore: minor refinements

* chore: reverting to 60 seconds for extra buffer

* chore: apply suggestions from code review

Co-authored-by: Neil Campbell <[email protected]>

* chore: patch snapshot

* chore: minor tweaks

* refactor: adding podman integration; refreshing tests and docs

* chore: adding podman ci workflow

* chore: testing ci

* docs: update docs/features/localnet.md

Co-authored-by: Neil Campbell <[email protected]>

* docs: update docs/features/localnet.md

Co-authored-by: Neil Campbell <[email protected]>

* refactor: addressing pr comments; refining retry mechanism

* chore: patching print

* chore: patching tests

* chore: patching tests; adding idle timeout option

* chore: patching tests

* refactor: windows behaviour; port forwarding max execution timeout

* chore: update docs

* docs: update localnet.md

* refactor: auto creating goal mount if podman is active engine; refining the codespace

* chore: pr comments

* fix: use the supplied timeout correctly

* chore: set a corresponding timeout in the codespace

---------

Co-authored-by: Neil Campbell <[email protected]>
  • Loading branch information
aorumbayev and neilcampbell authored Jun 11, 2024
1 parent 7c56b18 commit 7eeaead
Show file tree
Hide file tree
Showing 96 changed files with 1,566 additions and 448 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Pull Request validation
name: Codebase validation

on: [pull_request]
on:
pull_request:
schedule:
- cron: "0 8 * * 1" # Each monday 8 AM UTC

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ repos:
- id: ruff
name: ruff
description: "Run 'ruff' for extremely fast Python linting"
entry: poetry run ruff
entry: poetry run ruff check
language: system
"types": [python]
args: [--fix, --no-cache]
Expand Down
202 changes: 155 additions & 47 deletions docs/cli/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,48 +24,53 @@
- [Options](#options-3)
- [--shell ](#--shell--1)
- [config](#config)
- [version-prompt](#version-prompt)
- [container-engine](#container-engine)
- [Options](#options-4)
- [-f, --force](#-f---force)
- [Arguments](#arguments-2)
- [ENGINE](#engine)
- [version-prompt](#version-prompt)
- [Arguments](#arguments-3)
- [ENABLE](#enable)
- [dispenser](#dispenser)
- [fund](#fund)
- [Options](#options-4)
- [Options](#options-5)
- [-r, --receiver ](#-r---receiver-)
- [-a, --amount ](#-a---amount-)
- [--whole-units](#--whole-units)
- [limit](#limit)
- [Options](#options-5)
- [Options](#options-6)
- [--whole-units](#--whole-units-1)
- [login](#login)
- [Options](#options-6)
- [Options](#options-7)
- [--ci](#--ci)
- [-o, --output ](#-o---output-)
- [-f, --file ](#-f---file-)
- [logout](#logout)
- [refund](#refund)
- [Options](#options-7)
- [Options](#options-8)
- [-t, --txID ](#-t---txid-)
- [doctor](#doctor)
- [Options](#options-8)
- [Options](#options-9)
- [-c, --copy-to-clipboard](#-c---copy-to-clipboard)
- [explore](#explore)
- [Arguments](#arguments-3)
- [Arguments](#arguments-4)
- [NETWORK](#network)
- [generate](#generate)
- [client](#client)
- [Options](#options-9)
- [Options](#options-10)
- [-o, --output ](#-o---output--1)
- [-l, --language ](#-l---language-)
- [-v, --version ](#-v---version--1)
- [Arguments](#arguments-4)
- [Arguments](#arguments-5)
- [APP_SPEC_PATH_OR_DIR](#app_spec_path_or_dir)
- [goal](#goal)
- [Options](#options-10)
- [Options](#options-11)
- [--console](#--console)
- [Arguments](#arguments-5)
- [Arguments](#arguments-6)
- [GOAL_ARGS](#goal_args)
- [init](#init)
- [Options](#options-11)
- [Options](#options-12)
- [-n, --name ](#-n---name-)
- [-t, --template ](#-t---template-)
- [--template-url ](#--template-url-)
Expand All @@ -78,67 +83,82 @@
- [--workspace, --no-workspace](#--workspace---no-workspace)
- [-a, --answer ](#-a---answer--)
- [localnet](#localnet)
- [codespace](#codespace)
- [Options](#options-13)
- [-m, --machine ](#-m---machine-)
- [-a, --algod-port ](#-a---algod-port-)
- [-i, --indexer-port ](#-i---indexer-port-)
- [-k, --kmd-port ](#-k---kmd-port-)
- [-n, --codespace-name ](#-n---codespace-name-)
- [-r, --repo-url ](#-r---repo-url-)
- [-t, --timeout ](#-t---timeout-)
- [-f, --force](#-f---force-1)
- [config](#config-1)
- [Options](#options-14)
- [-f, --force](#-f---force-2)
- [Arguments](#arguments-7)
- [ENGINE](#engine-1)
- [console](#console)
- [explore](#explore-1)
- [logs](#logs)
- [Options](#options-12)
- [Options](#options-15)
- [--follow, -f](#--follow--f)
- [--tail ](#--tail-)
- [reset](#reset)
- [Options](#options-13)
- [Options](#options-16)
- [--update, --no-update](#--update---no-update)
- [start](#start)
- [Options](#options-14)
- [Options](#options-17)
- [-n, --name ](#-n---name--1)
- [status](#status)
- [stop](#stop)
- [project](#project)
- [bootstrap](#bootstrap)
- [Options](#options-15)
- [Options](#options-18)
- [--force](#--force)
- [Options](#options-16)
- [Options](#options-19)
- [--interactive, --non-interactive, --ci](#--interactive---non-interactive---ci)
- [-p, --project-name ](#-p---project-name-)
- [-t, --type ](#-t---type-)
- [Options](#options-17)
- [Options](#options-20)
- [--interactive, --non-interactive, --ci](#--interactive---non-interactive---ci-1)
- [deploy](#deploy)
- [Options](#options-18)
- [Options](#options-21)
- [-C, --command ](#-c---command-)
- [--interactive, --non-interactive, --ci](#--interactive---non-interactive---ci-2)
- [-P, --path ](#-p---path-)
- [--deployer ](#--deployer-)
- [--dispenser ](#--dispenser-)
- [-p, --project-name ](#-p---project-name--1)
- [Arguments](#arguments-6)
- [Arguments](#arguments-8)
- [ENVIRONMENT_NAME](#environment_name)
- [link](#link)
- [Options](#options-19)
- [Options](#options-22)
- [-p, --project-name ](#-p---project-name--2)
- [-l, --language ](#-l---language--1)
- [-a, --all](#-a---all)
- [-f, --fail-fast](#-f---fail-fast)
- [-v, --version ](#-v---version--2)
- [list](#list)
- [Arguments](#arguments-7)
- [Arguments](#arguments-9)
- [WORKSPACE_PATH](#workspace_path)
- [run](#run)
- [task](#task)
- [analyze](#analyze)
- [Options](#options-20)
- [Options](#options-23)
- [-r, --recursive](#-r---recursive)
- [--force](#--force-1)
- [--diff](#--diff)
- [-o, --output ](#-o---output--2)
- [-e, --exclude ](#-e---exclude-)
- [Arguments](#arguments-8)
- [Arguments](#arguments-10)
- [INPUT_PATHS](#input_paths)
- [ipfs](#ipfs)
- [Options](#options-21)
- [Options](#options-24)
- [-f, --file ](#-f---file--1)
- [-n, --name ](#-n---name--2)
- [mint](#mint)
- [Options](#options-22)
- [Options](#options-25)
- [--creator ](#--creator-)
- [-n, --name ](#-n---name--3)
- [-u, --unit ](#-u---unit-)
Expand All @@ -150,67 +170,67 @@
- [--nft, --ft](#--nft---ft)
- [-n, --network ](#-n---network-)
- [nfd-lookup](#nfd-lookup)
- [Options](#options-23)
- [Options](#options-26)
- [-o, --output ](#-o---output--3)
- [Arguments](#arguments-9)
- [Arguments](#arguments-11)
- [VALUE](#value)
- [opt-in](#opt-in)
- [Options](#options-24)
- [Options](#options-27)
- [-a, --account ](#-a---account-)
- [-n, --network ](#-n---network--1)
- [Arguments](#arguments-10)
- [Arguments](#arguments-12)
- [ASSET_IDS](#asset_ids)
- [opt-out](#opt-out)
- [Options](#options-25)
- [Options](#options-28)
- [-a, --account ](#-a---account--1)
- [--all](#--all)
- [-n, --network ](#-n---network--2)
- [Arguments](#arguments-11)
- [Arguments](#arguments-13)
- [ASSET_IDS](#asset_ids-1)
- [send](#send)
- [Options](#options-26)
- [Options](#options-29)
- [-f, --file ](#-f---file--2)
- [-t, --transaction ](#-t---transaction-)
- [-n, --network ](#-n---network--3)
- [sign](#sign)
- [Options](#options-27)
- [Options](#options-30)
- [-a, --account ](#-a---account--2)
- [-f, --file ](#-f---file--3)
- [-t, --transaction ](#-t---transaction--1)
- [-o, --output ](#-o---output--4)
- [--force](#--force-2)
- [transfer](#transfer)
- [Options](#options-28)
- [Options](#options-31)
- [-s, --sender ](#-s---sender-)
- [-r, --receiver ](#-r---receiver--1)
- [--asset, --id ](#--asset---id-)
- [-a, --amount ](#-a---amount--1)
- [--whole-units](#--whole-units-2)
- [-n, --network ](#-n---network--4)
- [vanity-address](#vanity-address)
- [Options](#options-29)
- [Options](#options-32)
- [-m, --match ](#-m---match-)
- [-o, --output ](#-o---output--5)
- [-a, --alias ](#-a---alias-)
- [--file-path ](#--file-path-)
- [-f, --force](#-f---force)
- [Arguments](#arguments-12)
- [-f, --force](#-f---force-3)
- [Arguments](#arguments-14)
- [KEYWORD](#keyword)
- [wallet](#wallet)
- [Options](#options-30)
- [Options](#options-33)
- [-a, --address ](#-a---address-)
- [-m, --mnemonic](#-m---mnemonic)
- [-f, --force](#-f---force-1)
- [Arguments](#arguments-13)
- [-f, --force](#-f---force-4)
- [Arguments](#arguments-15)
- [ALIAS_NAME](#alias_name)
- [Arguments](#arguments-14)
- [Arguments](#arguments-16)
- [ALIAS](#alias)
- [Options](#options-31)
- [-f, --force](#-f---force-2)
- [Arguments](#arguments-15)
- [Options](#options-34)
- [-f, --force](#-f---force-5)
- [Arguments](#arguments-17)
- [ALIAS](#alias-1)
- [Options](#options-32)
- [-f, --force](#-f---force-3)
- [Options](#options-35)
- [-f, --force](#-f---force-6)

# algokit

Expand Down Expand Up @@ -342,6 +362,26 @@ Configure settings used by AlgoKit
algokit config [OPTIONS] COMMAND [ARGS]...
```

### container-engine

Set the default container engine for use by AlgoKit CLI to run LocalNet images.

```shell
algokit config container-engine [OPTIONS] [[docker|podman]]
```

### Options


### -f, --force
Skip confirmation prompts. Defaults to 'yes' to all prompts.

### Arguments


### ENGINE
Optional argument

### version-prompt

Controls whether AlgoKit checks and prompts for new versions.
Expand Down Expand Up @@ -636,6 +676,74 @@ Manage the AlgoKit LocalNet.
algokit localnet [OPTIONS] COMMAND [ARGS]...
```

### codespace

Manage the AlgoKit LocalNet in GitHub Codespaces.

```shell
algokit localnet codespace [OPTIONS]
```

### Options


### -m, --machine <machine>
The GitHub Codespace machine type to use. Defaults to base tier.


* **Options**

basicLinux32gb | standardLinux32gb | premiumLinux | largePremiumLinux



### -a, --algod-port <algod_port>
The port for the Algorand daemon. Defaults to 4001.


### -i, --indexer-port <indexer_port>
The port for the Algorand indexer. Defaults to 8980.


### -k, --kmd-port <kmd_port>
The port for the Algorand kmd. Defaults to 4002.


### -n, --codespace-name <codespace_name>
The name of the codespace. Defaults to 'algokit-localnet_timestamp'.


### -r, --repo-url <repo_url>
The URL of the repository. Defaults to algokit base template repo.


### -t, --timeout <timeout_minutes>
Default max runtime timeout in minutes. Upon hitting the timeout a codespace will be shutdown to prevent accidental spending over GitHub Codespaces quota. Defaults to 4 hours.


### -f, --force
Force delete previously used codespaces with {CODESPACE_NAME_PREFIX}\* name prefix and skip prompts. Defaults to explicitly prompting for confirmation.

### config

Set the default container engine for use by AlgoKit CLI to run LocalNet images.

```shell
algokit localnet config [OPTIONS] [[docker|podman]]
```

### Options


### -f, --force
Skip confirmation prompts. Defaults to 'yes' to all prompts.

### Arguments


### ENGINE
Optional argument

### console

Run the Algorand goal CLI against the AlgoKit LocalNet via a Bash console so you can execute multiple goal commands and/or interact with a filesystem.
Expand Down
Loading

1 comment on commit 7eeaead

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/algokit
   __init__.py15753%6–13, 17–24, 32–34
   __main__.py440%1–7
src/algokit/cli
   __init__.py47394%31–34
   codespace.py50982%28, 114, 137, 150–155
   completions.py108992%63–64, 83, 93–99
   dispenser.py121199%77
   doctor.py53394%146–148
   explore.py501276%34–39, 41–46
   generate.py70396%76–77, 155
   goal.py47198%79
   init.py3092492%493–494, 499–500, 503, 524, 527–529, 540, 544, 602, 628, 657, 690, 699–701, 704–709, 722, 741, 753–754
   localnet.py1523279%65, 86–113, 133–137, 170, 182, 197–207, 220, 271, 292–293
   task.py34391%25–28
src/algokit/cli/common
   utils.py26292%120, 123
src/algokit/cli/project
   bootstrap.py32197%33
   deploy.py992080%47, 49, 101, 124, 146–148, 227, 234, 248–256, 259–268
   link.py891682%60, 65–66, 101–105, 115–120, 148–149, 218–219, 223
   list.py33585%21–23, 51–56
   run.py46393%38, 71, 160
src/algokit/cli/tasks
   analyze.py81199%81
   assets.py821384%65–66, 72, 74–75, 105, 119, 125–126, 132, 134, 136–137
   ipfs.py51884%52, 80, 92, 94–95, 105–107
   mint.py66494%48, 70, 91, 250
   send_transaction.py651085%52–53, 57, 89, 158, 170–174
   sign_transaction.py59886%21, 28–30, 71–72, 109, 123
   transfer.py39392%26, 90, 117
   utils.py994555%26–34, 40–43, 75–76, 100–101, 125–133, 152–162, 209, 258–259, 279–290, 297–299
   vanity_address.py561082%41, 45–48, 112, 114, 121–123
   wallet.py79495%21, 66, 136, 162
src/algokit/core
   codespace.py1756861%34–37, 41–44, 48–71, 111–112, 125–133, 191, 200–202, 210, 216–217, 229–236, 251–298, 311–313, 338–344, 348, 395
   conf.py57984%12, 24, 28, 36, 38, 73–75, 80
   dispenser.py2022687%91, 123–124, 141–149, 191–192, 198–200, 218–219, 259–260, 318, 332–334, 345–346, 356, 369, 384
   doctor.py65789%67–69, 92–94, 134
   generate.py48394%44, 81, 99
   goal.py65494%21, 36–37, 47
   init.py671085%53, 57–62, 70, 81, 88, 108–109
   log_handlers.py68790%50–51, 63, 112–116, 125
   proc.py45198%99
   sandbox.py2532391%32, 84–87, 92, 96–98, 145, 192–199, 210, 502, 518, 543, 551
   typed_client_generation.py1702088%62–64, 103–108, 132, 135–138, 156, 159–162, 229, 232–235
   utils.py1463874%50–51, 57–66, 122–128, 152, 155, 161–174, 195–197, 226–229, 251
src/algokit/core/compilers
   python.py28582%19–20, 25, 49–50
src/algokit/core/config_commands
   container_engine.py412149%24, 29–31, 47–76
   version_prompt.py921485%37–38, 68, 87–90, 108, 118–125, 148
src/algokit/core/project
   __init__.py53394%50, 86, 145
   bootstrap.py120893%47, 126–127, 149, 176, 207–209
   deploy.py54983%61–64, 73–75, 79, 84
   run.py1251588%83, 88, 97–98, 133–134, 138–139, 143, 147, 261–269, 284
src/algokit/core/tasks
   analyze.py93397%105–112, 187
   ipfs.py63789%58–64, 140, 144, 146, 152
   nfd.py491373%25, 31, 34–41, 70–72, 99–101
   vanity_address.py903462%49–50, 54, 59–75, 92–108, 128–131
   wallet.py71593%37, 129, 155–157
src/algokit/core/tasks/mint
   mint.py781087%123–133, 187
   models.py901188%50, 52, 57, 71–74, 85–88
TOTAL462263886% 

Tests Skipped Failures Errors Time
487 0 💤 0 ❌ 0 🔥 26.426s ⏱️

Please sign in to comment.