Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: orchestration support #7

Merged
merged 29 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
54bb16c
feat: refining pipelines to rely on orchestration; defining run commands
aorumbayev Mar 8, 2024
3b2d772
chore: regen examples
aorumbayev Mar 8, 2024
441e3f8
docs: refresh readme
aorumbayev Mar 11, 2024
1497a7c
chore: bumping min version
aorumbayev Mar 11, 2024
0c505db
chore: bump min version
aorumbayev Mar 11, 2024
980831e
chore: apply suggestions from code review
aorumbayev Mar 15, 2024
4927795
chore: regen examples
aorumbayev Mar 15, 2024
2973caf
chore: swapping to final prerelease branch
aorumbayev Mar 19, 2024
4b415ea
chore: change build and deploy to use new .ar32.json app specs
neilcampbell Mar 22, 2024
8da8fc6
chore: fix up the ts deployer build command
neilcampbell Mar 22, 2024
49dc5db
chore: renaming puya to python
aorumbayev Mar 25, 2024
0021df4
chore: update badge
aorumbayev Mar 25, 2024
3da69e7
chore: regen examples
aorumbayev Mar 25, 2024
a95905b
chore: use algorand-python package
neilcampbell Mar 26, 2024
8b11b99
chore: ignore pylance warning
neilcampbell Mar 26, 2024
a432ca0
chore: ignore pylance warning
neilcampbell Mar 26, 2024
6d5caf6
chore: fixing race condition in tests (xdist)
aorumbayev Mar 26, 2024
78f0fa6
refactor: more robust tests; refined contributing guideline
aorumbayev Mar 26, 2024
dfe578b
chore: updating algokit install (temp)
aorumbayev Mar 26, 2024
872b651
chore: minor tweaks
aorumbayev Mar 26, 2024
58a1755
chore: minor tweaks
aorumbayev Mar 26, 2024
30bc12c
chore: use algokit compile
neilcampbell Mar 27, 2024
f8d0dae
chore: adjust mypy settings
neilcampbell Mar 27, 2024
d50ad7d
chore: regen examples
aorumbayev Mar 27, 2024
fd36424
chore: regen examples
aorumbayev Mar 27, 2024
3506d6b
chore: regen examples
aorumbayev Mar 27, 2024
78eab26
chore: regen examples
aorumbayev Mar 27, 2024
99ad000
chore: bumping min version
aorumbayev Mar 27, 2024
7c65618
chore: fixing tests
aorumbayev Mar 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/check-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ jobs:
run: pipx install poetry

- name: Install algokit
run: pipx install algokit
# TODO: restore to algokit prior to release
run: pipx install git+https://github.com/algorandfoundation/algokit-cli@feat/orchestration-linking

- name: Set up Python 3.12
uses: actions/setup-python@v5
Expand Down
43 changes: 24 additions & 19 deletions copier.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
_subdirectory: template_content
_templates_suffix: ".jinja"

use_workspace:
type: bool
when: false # never prompted to user explicitly, instead expect cli to auto fill (supported cli versions > v1.13.x)
help: Automatically filled by AlgoKit CLI (>1.13.x) - passes the --workspace/--no-workspace flag's value, can be used to reason whether this template is currently being instantiated as part of a workspace or not.
default: no

# questions
# project_name should never get prompted, AlgoKit should always pass it by convention
project_name:
type: str
help: Name for this project.
placeholder: "algorand-app"

contract_name:
type: str
help: Name of the default smart contract app.
placeholder: "hello_world"
default: "hello_world"
validator: >-
{% if not (contract_name | regex_search('^[a-z]+(?:_[a-z]+)*$')) %}
contract_name must be formatted in snake case.
{% endif %}

author_name:
type: str
help: Package author name
Expand All @@ -30,6 +25,16 @@ author_email:
placeholder: "[email protected]"
default: "[email protected]"

contract_name:
type: str
help: Name of the default smart contract app.
placeholder: "hello_world"
default: "hello_world"
validator: >-
{% if not (contract_name | regex_search('^[a-z]+(?:_[a-z]+)*$')) %}
contract_name must be formatted in snake case.
{% endif %}

preset_name:
type: str
help: Name of the template preset to use.
Expand Down Expand Up @@ -57,7 +62,7 @@ ide_jetbrains:
type: bool
help: Do you want to add JetBrains configuration (primarily optimized for PyCharm CE)?
when: "{{ preset_name == 'custom' }}"
default: no
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"

use_python_pytest:
type: bool
Expand All @@ -79,40 +84,40 @@ python_linter:
Ruff: "ruff"
Flake8: "flake8"
No thanks: "none"
default: "ruff"
default: "{{ 'ruff' if preset_name == 'production' else 'none' }}"

use_python_black:
type: bool
help: Do you want to use a Python formatter (via Black)?
when: "{{ preset_name == 'custom' }}"
default: yes
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"

use_python_mypy:
type: bool
when: "{{ preset_name == 'custom' }}"
help: Do you want to use a Python type checker (via mypy)?
default: yes
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"

use_python_pip_audit:
type: bool
when: "{{ preset_name == 'custom' }}"
help: Do you want to include Python dependency vulnerability scanning (via pip-audit)?
default: yes
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"

use_github_actions:
type: bool
when: "{{ preset_name == 'custom' }}"
help: Do you want to include Github Actions workflows for build and testnet deployment?
default: yes
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"

use_pre_commit:
type: bool
when: "{{ preset_name == 'custom' }}"
help: Do you want to include pre-commit for linting, type checking and formatting?
default: yes
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"

use_dispenser:
type: bool
when: "{{ preset_name == 'custom' }}"
help: Do you want to fund your deployment account using an optional dispenser account?
default: no
default: "{{ 'yes' if preset_name == 'production' else 'no' }}"
Empty file removed examples/generators/.gitkeep
Empty file.
Original file line number Diff line number Diff line change
@@ -1,19 +1,49 @@
[algokit]
min_version = "v1.8.0"
min_version = "v1.12.1"

[deploy]
[generate.smart_contract]
description = "Adds new smart contract to existing project"
path = ".algokit/generators/create_contract"

[project]
type = 'contract'
name = 'production_puya_smart_contract_python'
artifacts = 'smart_contracts/artifacts'

[project.deploy]
command = "poetry run python -m smart_contracts deploy"
environment_secrets = [
"DEPLOYER_MNEMONIC",
"DISPENSER_MNEMONIC",
]

[deploy.localnet]
[project.deploy.localnet]
environment_secrets = []

[generate.smart_contract]
description = "Adds new smart contract to existing project"
path = ".algokit/generators/create_contract"
[project.run]
# Commands intented for use locally and in CI
aorumbayev marked this conversation as resolved.
Show resolved Hide resolved
build = { commands = [
'poetry run python -m smart_contracts build',
], description = 'Build all smart contracts in the project' }
test = { commands = [
'poetry run pytest',
], description = 'Run smart contract tests' }
audit = { commands = [
'poetry export --without=dev -o requirements.txt',
'poetry run pip-audit -r requirements.txt',
], description = 'Audit with pip-audit' }
lint = { commands = [
'poetry run black --check .',
'poetry run ruff .',
'poetry run mypy',
], description = 'Perform linting' }
audit-teal = { commands = [
# 🚨 IMPORTANT 🚨: For strict TEAL validation, remove --exclude statements. The default starter contract is not for production. Ensure thorough testing and adherence to best practices in smart contract development. This is not a replacement for a professional audit.
'algokit task analyze smart_contracts/artifacts --recursive --force --exclude rekey-to --exclude is-updatable --exclude missing-fee-check --exclude is-deletable --exclude can-close-asset --exclude can-close-account --exclude unprotected-deletable --exclude unprotected-updatable',
], description = 'Audit TEAL files' }

[project]
type = 'contract'
name = 'production_puya_smart_contract_python'
# Commands indented for CI only, prefixed with `ci-` by convention
aorumbayev marked this conversation as resolved.
Show resolved Hide resolved
ci-teal-diff = { commands = [
'git add -N ./smart_contracts/artifacts',
'git diff --exit-code --minimal ./smart_contracts/artifacts',
], description = 'Check TEAL files for differences' }

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release production_puya_smart_contract_python

on:
workflow_call:
push:
branches:
- main

jobs:
validate:
name: Validate production_puya_smart_contract_python
uses: ./.github/workflows/production-puya-smart-contract-python-ci.yaml
deploy-testnet:
runs-on: "ubuntu-latest"
needs: validate
environment: contract-testnet
steps:
- name: Checkout source code
uses: actions/checkout@v4

- name: Install poetry
run: pipx install poetry

- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "poetry"

- name: Install algokit
run: pipx install git+https://github.com/algorandfoundation/algokit-cli@feat/orchestration-linking

- name: Bootstrap dependencies
run: algokit bootstrap all --project-name 'production_puya_smart_contract_python'

- name: Configure git
shell: bash
run: |
# set git user and email as test invoke git
git config --global user.email "[email protected]" && git config --global user.name "github-actions"

- name: Deploy to testnet
run: algokit deploy testnet --project-name 'production_puya_smart_contract_python'
env:
# This is the account that becomes the creator of the contract
DEPLOYER_MNEMONIC: ${{ secrets.DEPLOYER_MNEMONIC }}
# The dispenser account is used to ensure the deployer account is funded
DISPENSER_MNEMONIC: ${{ secrets.DISPENSER_MNEMONIC }}
Loading