Skip to content

Commit

Permalink
feat: orchestration support (#3)
Browse files Browse the repository at this point in the history
* feat: orchestration refinements

* feat: refinements to include template workflows

* chore: patching ci

* chore: tweaks

* chore: fixing permissions in codespace; ensuring localnet is reset every time

* chore: testing vscode code workspace

* feat: baseline code workspace file for vscode

* chore: adjusting devcontainer

* chore: minor tweaks

* chore: minor tweaks

* chore: minor tweaks

* chore: minor tweaks

* chore: minor tweaks

* chore: minor tweaks

* chore: bumping min version

BREAKING CHANGE: Support for algokit-cli v2.0
  • Loading branch information
aorumbayev authored Mar 27, 2024
1 parent 0aeca4e commit 4bd3281
Show file tree
Hide file tree
Showing 10 changed files with 154 additions and 35 deletions.
32 changes: 16 additions & 16 deletions .devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"forwardPorts": [4001, 4002, 8980, 5173],
"portsAttributes": {
"4001": {
"label": "algod"
},
"4002": {
"label": "kmd"
},
"8980": {
"label": "indexer"
},
"5173": {
"label": "vite"
}
"forwardPorts": [4001, 4002, 8980, 5173],
"portsAttributes": {
"4001": {
"label": "algod"
},
"postCreateCommand": "pipx install algokit",
"postStartCommand": "rm -rf template_content copier.yaml && algokit localnet start"
"4002": {
"label": "kmd"
},
"8980": {
"label": "indexer"
},
"5173": {
"label": "vite"
}
},
"postCreateCommand": "mkdir -p ~/.config/algokit && pipx install algokit && rm -rf template_content copier.yaml && sudo chown -R codespace:codespace ~/.config/algokit",
"postStartCommand": "for i in {1..5}; do algokit localnet status > /dev/null 2>&1 && break || sleep 30; algokit localnet reset; done"
}
2 changes: 1 addition & 1 deletion .github/workflows/check-copier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ jobs:
shell: bash
run: |
set -o pipefail
algokit init --template-url=. --template-url-ref="HEAD" -n test_run --UNSAFE-SECURITY-accept-template-url --no-bootstrap --no-git
algokit init --template-url=. --template-url-ref="HEAD" -n test_run --UNSAFE-SECURITY-accept-template-url --no-bootstrap --no-git -a projects_root_path 'projects'
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,14 @@ The base workspace project structure looks as follows:

To use this template, [install AlgoKit](https://github.com/algorandfoundation/algokit-cli#readme) and then either execute `algokit init`. Any standalone template will auto include the content of this template as a base. To disable this behavior use the `--no-workspace` flag.

### Notes for template builders

Template contains a set of hidden questions that can be altered via explicit `-a` flag in `algokit init` command. Those are useful when base template is part of your copier `_tasks` (see [fullstack](https://github.com/algorandfoundation/algokit-fullstack-template/blob/main/copier.yaml) for reference) invocation and you want to control behavior around optional artifacts that are disabled by default.

### GitHub Codespaces

If executing this repository in GitHub Codespaces, the container will automatically cleanup templatized content and pre-install `algokit` for you. To get started execute:

- `algokit init` - to invoke interactive wizard to guide you through the process of creating a new AlgoKit project
- `algokit init` - to invoke interactive wizard to guide you through the process of creating a new AlgoKit project

Powered by [Copier templates](https://copier.readthedocs.io/en/stable/).
50 changes: 37 additions & 13 deletions copier.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
_subdirectory: ./template_content

# All of the below are hidden questions without any user interaction.
# Given that baseline is primarily aimed to be used as part of the invocation of
# official and custom fullstack, standalone algokit projects, control
# over the below is recommended via -a flag available in both algokit init and copier directly

include_readme:
type: bool
when: false
help: Include a default README.md file
default: yes
type: bool
when: false
help: Include a default README.md file
default: yes

include_algokit_toml:
type: bool
when: false
help: Include a default algokit.toml file
default: yes
type: bool
when: false
help: Include a default algokit.toml file
default: yes

include_github_workflow_template:
type: bool
when: false
help: Include a template github workflow for workspace-based projects
default: no

include_vscode_code_workspace:
type: bool
help: Include a default VSCode code-workspace
when: no
default: yes

project_name:
type: str
help: Name for this project.
when: "{{ include_readme }}"
placeholder: "algorand-app"
default: "myproject"
type: str
help: Name for this project.
when: "{{ include_readme }}"
placeholder: "algorand-app"
default: "myproject"

projects_root_path:
type: str
help: Name of the directory to host sub projects in the workspace (Defaults to 'projects').
when: "{{ include_algokit_toml }}"
placeholder: "projects"
default: "projects"
4 changes: 2 additions & 2 deletions template_content/.devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
"label": "vite"
}
},
"postCreateCommand": "pipx install algokit",
"postStartCommand": "algokit localnet start && echo 'Run algokit init in terminal to get started with Algorand development 🚀'"
"postCreateCommand": "mkdir -p ~/.config/algokit && pipx install algokit && sudo chown -R codespace:codespace ~/.config/algokit",
"postStartCommand": "for i in {1..5}; do algokit localnet status > /dev/null 2>&1 && break || sleep 30; algokit localnet reset; done"
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[algokit]
min_version = "v1.8.0"
min_version = "v1.12.1"

[project]
type = 'workspace'
projects_root_path = 'projects'
projects_root_path = '{{ projects_root_path }}'
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release

on:
push:
branches:
- main
paths-ignore:
- "docs/**"
- "**.md"
- ".vscode/**"
- ".idea/**"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: false

permissions:
contents: read
packages: read

jobs:
# Sample of referencing a separate workflow file with workflow_call
example-ci:
name: Example CI
uses: ./.github/workflows/example-project-cd.yaml

# We recommend, treating this as a generic workflow aggregating
# multiple workflow references. This way, you can easily
# customize the workflow to your needs using workflow references.
# ===
# How to use?
# ===
# 1. Duplicate and remove .template from the file name
# 2. Adapt the workflow as needed using workflow references.
# 3. Commit and push the changes
# 4. Remove the original .template file (if no longer needed)

Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Pull Request validation

on: [pull_request]

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: false

jobs:
# Sample of referencing a separate workflow file with workflow_call
example-ci:
name: Example CI
uses: ./.github/workflows/example-project-ci.yaml

# We recommend, treating this as a generic workflow aggregating
# multiple workflow references. This way, you can easily
# customize the workflow to your needs using workflow references.
# ===
# How to use?
# ===
# 1. Duplicate and remove .template from the file name
# 2. Adapt the workflow as needed using workflow references.
# 3. Commit and push the changes
# 4. Remove the original .template file (if no longer needed)

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
// Disabled due to matangover.mypy extension not supporting monorepos
// To be addressed as part of https://github.com/matangover/mypy-vscode/issues/82
"mypy.enabled": false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"folders": [
{
"path": "./",
"name": "ROOT"
}
],
"settings": {
"files.exclude": {
"{{ projects_root_path }}/": true
},
"jest.disabledWorkspaceFolders": ["ROOT", "{{ projects_root_path }}"]
},
"extensions": {
"recommendations": ["joshx.workspace-terminals"]
},
"tasks": {
"version": "2.0.0",
"tasks": []
},
"launch": {
"configurations": []
}
}

0 comments on commit 4bd3281

Please sign in to comment.