Skip to content

Commit

Permalink
build: add semantic release to CI/CD (#26)
Browse files Browse the repository at this point in the history
algokit cli is now part of poetry CICD group so that it's included in cache and to simplify steps

algokit localnet stop command has been removed to speed things up a tiny bit

minor tweaks to reduce coverage comment size

---------

Co-authored-by: Adam Chidlow <[email protected]>
  • Loading branch information
daniel-makerx and achidlow authored Dec 14, 2023
1 parent 2982680 commit f32e760
Show file tree
Hide file tree
Showing 7 changed files with 1,045 additions and 232 deletions.
42 changes: 29 additions & 13 deletions .github/workflows/cd.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
name: Continuous Delivery of Python package

on:
push:
branches:
- main
workflow_dispatch:
inputs:
run_checks:
description: "Run checks?"
type: boolean
required: true
default: true
production_release:
description: "Production release?"
type: boolean
Expand All @@ -19,13 +21,8 @@ permissions:
packages: read

jobs:
ci-check-python:
name: Check Python
uses: ./.github/workflows/check-python.yaml

release:
name: Release Library
needs: ci-check-python
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
Expand All @@ -49,7 +46,16 @@ jobs:
cache: "poetry"

- name: Install dependencies
run: poetry install --no-interaction --no-root
run: poetry install --no-interaction --with cicd

- name: pre-commit and pytest
if: inputs.run_checks
run: |
set -o pipefail
source $(poetry env info --path)/bin/activate
pre-commit run --all-files && git diff --exit-code
algokit localnet start
pytest
- name: Get branch name
shell: bash
Expand All @@ -59,11 +65,21 @@ jobs:
- name: Set Git user as GitHub actions
run: git config --global user.email "[email protected]" && git config --global user.name "github-actions"

- name: Create Continuous Deployment - Production
- name: Update release - Production
if: steps.get_branch.outputs.branch == 'main' && inputs.production_release
run: |
poetry build --format wheel
run: semantic-release version

- name: Update release - Prerelease
if: steps.get_branch.outputs.branch == 'main' && !inputs.production_release
run: semantic-release version --prerelease

- name: Create Wheel
run: poetry build --format wheel

- name: Publish to GitHub
if: steps.get_branch.outputs.branch == 'main'
run: semantic-release publish

- name: Publish package distributions to PyPI
- name: Publish to PyPI
if: steps.get_branch.outputs.branch == 'main' && inputs.production_release
uses: pypa/gh-action-pypi-publish@release/v1
13 changes: 3 additions & 10 deletions .github/workflows/check-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,30 +24,23 @@ jobs:
cache: "poetry"

- name: Install dependencies
run: poetry install --no-interaction
run: poetry install --no-interaction --with cicd

- name: Check pre-commits
run: |
set -o pipefail
poetry run pre-commit run --all-files && git diff --exit-code
- name: Install algokit
run: pipx install algokit

- name: Start LocalNet
run: algokit localnet start
run: poetry run algokit localnet start

- name: pytest + coverage
shell: bash
run: |
set -o pipefail
poetry run pytest --junitxml=pytest-junit.xml --cov | tee pytest-coverage.txt
- name: Stop LocalNet
run: algokit localnet stop

- name: pytest coverage comment - using Python 3.12 on ubuntu-latest
if: matrix.python == '3.12' && matrix.os == 'ubuntu-latest'
- name: pytest coverage comment
continue-on-error: true # forks fail to add a comment, so continue any way
uses: MishaKav/pytest-coverage-comment@main
with:
Expand Down
Loading

1 comment on commit f32e760

@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/puya
   __main__.py27270%1–101
   arc32.py72494%84–85, 96, 196
   compile.py1444867%41–43, 53, 73, 83, 92, 99, 120, 129–142, 149–158, 163–176, 222–234
   errors.py682169%41, 69–83, 94–99
   logging_config.py1183372%15, 32, 36–39, 45, 47, 50–54, 72, 106, 132–134, 137–139, 141, 154–163, 176–178, 185, 198
   parse.py1241191%70, 110–116, 133, 156, 194, 207–208
   utils.py1011288%37, 50, 54, 89, 99, 108, 113–116, 121, 148, 150
src/puya/awst
   function_traverser.py150398%77, 107–108
   nodes.py7225992%36, 45, 76–79, 85, 89–92, 100, 126, 132, 136–139, 267, 273, 430, 451–452, 469, 509, 515–516, 542, 635–636, 641, 656, 707, 712, 770, 793, 810, 986, 991–992, 999–1004, 1088, 1098, 1107, 1135, 1142, 1155, 1213, 1215, 1220, 1228, 1233, 1238, 1247, 1252, 1257, 1264, 1283
   to_code_visitor.py2647970%23, 33, 36, 39–40, 46, 49, 52, 55, 58–59, 62–64, 67–70, 86, 91, 94–95, 105, 108, 116, 154–176, 215–216, 248–251, 263, 272, 275, 278, 286–294, 300–305, 315, 317, 322, 325, 328–331, 340, 357–358, 361–362, 365, 368–371, 404–405, 426, 437, 461, 466
   visitors.py1775867%7, 15, 19, 23, 27, 31, 35, 39, 43, 47, 53, 59, 65, 69, 73, 79, 83, 87, 91, 95, 101, 105, 109, 113, 117, 121, 125, 129, 135, 139, 143, 147, 151, 155, 159, 163, 167, 171, 175, 179, 183, 187, 191, 197, 200, 203, 206, 212, 218, 222, 226, 230, 234, 238, 242, 246, 250, 254
   wtypes.py2263385%20, 63, 171–182, 197–200, 217, 219, 261, 264, 289, 291, 295–296, 299, 320, 341, 377, 380, 407–408, 417–418, 426–427, 438, 441
src/puya/awst_build
   base_mypy_visitor.py1334566%39, 55, 59, 71–77, 95, 106–121, 135, 139, 143, 154, 158, 166, 172, 178, 196, 202, 207, 210, 213, 222, 226, 231, 236, 242, 247, 253, 260, 264, 268, 272, 276, 280, 284, 288, 292, 296, 300, 304, 308
   context.py1191786%101–103, 111, 113–118, 121–122, 142, 147, 151, 164, 176–177
   contract.py3079170%63–69, 112, 128–129, 131–134, 142–143, 146, 155, 166, 185, 203, 209, 211, 222, 229, 236, 260, 264, 279–283, 291–292, 297, 300, 303, 306, 309–312, 315, 318, 321, 324, 327, 330, 333, 336, 339, 342, 345, 359, 371–376, 382–383, 411, 421, 450, 452, 461, 488–489, 504, 508, 511, 517, 520, 523, 526, 534, 539, 542, 545, 548–560, 563, 572, 575, 592, 602–603, 610, 616
   intrinsic_models.py30583%21, 26–29
   main.py541278%38, 41, 51, 61, 67–76
   module.py2809267%88, 106–107, 114, 122, 128, 134–138, 147, 155–163, 189, 204–205, 207, 223–258, 261–267, 277–278, 300–310, 333–334, 350, 353, 360, 368–381, 389–395, 418–423, 454, 465–468, 477–478, 486–489, 513, 516, 522, 530, 533, 540, 546, 558, 561
   subroutine.py6057887%208, 218, 269, 312, 346–347, 465–469, 477, 485, 488, 500, 529–530, 536, 541, 577, 631–637, 657, 678–680, 688–689, 703, 726, 729, 732, 740–746, 769, 787–790, 794–797, 801, 805–806, 810–811, 827, 829, 832–834, 861–862, 870, 905–913, 948, 976, 980, 1011, 1062, 1108, 1115, 1125, 1136–1140, 1149, 1152, 1155, 1158, 1161, 1166, 1171, 1178, 1185, 1209
   utils.py1762288%48–49, 64, 101, 116–117, 119, 139–140, 160, 174, 185, 190, 197, 209, 223–226, 247, 318–319
src/puya/awst_build/eb
   array.py684534%26–27, 30–32, 37–44, 57–73, 78–80, 83, 86–89, 94–96, 101–103, 113–123
   base.py1725170%21–27, 97, 101, 105, 111, 115, 121–126, 137–143, 148–154, 160, 166, 176, 187, 191, 195, 205, 208, 211, 214, 217, 220, 225, 228, 236, 249, 260, 263, 276, 294, 297, 302, 312, 315, 319, 325, 328, 331, 336, 341, 346, 352
   biguint.py932573%35–39, 64–65, 79, 94, 104–107, 127–132, 136, 149–154, 184–192, 195–196
   bool.py401270%27–31, 48–55, 73
   bytes.py1442483%55–59, 84–85, 96–97, 118–119, 123, 127, 132, 134–135, 155, 177, 252–256, 270–271, 317, 364–365
   bytes_backed.py29486%38–39, 48–49
   contracts.py1573677%94–96, 104, 121, 123, 161–162, 196, 198, 201–202, 215, 253, 256, 259, 262, 267, 272, 282, 292, 301, 311, 314, 317, 328–335, 353–354, 357
   ensure_budget.py481569%25–29, 50–51, 71–72, 80, 92, 98–103
   intrinsics.py1514173%32–34, 56–57, 65–66, 72–73, 90–91, 120, 129, 131–155, 162–163, 207, 215, 227–228, 230, 247–248, 260, 265, 275
   named_int_constants.py20385%18, 23–24
   struct.py321553%21–22, 25, 36–42, 47–49, 52–57
   subroutine.py35294%52, 72
   temporary_assignment.py36683%23, 34, 40, 43, 46, 51
   transaction.py1091983%29–33, 59–60, 63, 85, 139–152, 290–291
   tuple.py852274%35–36, 43, 54, 56–57, 79–80, 89–90, 103, 109, 127–128, 133–134, 146, 154–160, 165
   type_registry.py22291%105–107
   uint64.py791778%37–41, 63–64, 85, 103, 125–128, 145–148, 162–170, 173–174
   unsigned_builtins.py53787%28–32, 56, 91, 94–95
src/puya/awst_build/eb/arc4
   arrays.py1281588%39–43, 56–57, 85, 116, 136–137, 173, 175, 209, 228, 269–270
   base.py961683%29–33, 48, 74–75, 94–95, 120–121, 135–136, 151–152, 158, 163
   bool.py28679%26–33, 59–60
   numeric.py831977%26–31, 43, 58, 89–90, 92, 95–96, 113, 120–121, 139, 153–154, 159, 164
   string.py25676%19–24, 54–55
   struct.py50884%24–31, 67, 70, 103–104
   tuple.py832175%30–34, 49, 53–54, 79, 84–86, 95, 106, 115, 128, 132–133, 145, 161–162, 171–172
src/puya/awst_build/eb/reference_types
   account.py46980%24–26, 44, 53–57, 106
   application.py31487%17–19, 41–42
   asset.py52688%27–29, 51–52, 89–90
   base.py44491%25–27, 61, 87
src/puya/codegen
   builder.py183697%101, 148, 151, 282–283, 361
   callgraph.py25868%27–35
   ops.py2592292%12–18, 29, 40, 52, 63, 74, 85, 115, 227, 273, 282, 312, 324, 341–347
   stack.py2983090%28–30, 79–83, 118, 122, 157, 161, 167, 176, 188, 199, 209, 220, 234, 244, 263, 277, 283, 285, 319, 326, 343, 368, 373, 415
   stack_baileys.py209697%33, 105, 125, 329–333, 359
   stack_frame_allocation.py76396%22, 63–65
   stack_koopmans.py216896%59, 157, 220, 229, 233, 255, 260, 376
   stack_simplify_teal.py3142891%61, 96, 100, 107, 118, 130, 138, 159–162, 169, 183–184, 198, 203, 231, 233, 236–237, 265, 284–285, 320–328
   teal_annotaters.py177995%59, 101, 105, 118, 141, 145, 150, 153, 217
   visitor.py732368%7, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 71, 75, 79, 83, 87, 91, 95, 99
src/puya/ir
   arc4_router.py2121792%166, 174, 319, 451–452, 466, 506–507, 519, 524, 529, 534, 539, 544, 564–569
   arc4_util.py61690%24–25, 28, 60, 72, 91
   avm_ops.py290299%42–43
   avm_ops_models.py34294%19, 27
   blocks_builder.py931386%55, 63, 65, 69, 83–88, 105, 113, 117, 141–143, 149–151
   builder.py8898191%104, 171–172, 187, 223, 245–246, 326–327, 393–399, 423, 480, 520, 535, 560, 577–578, 627–628, 643–644, 671, 676–679, 686–687, 746–749, 751–757, 776–777, 792, 804, 821, 841, 919, 927, 935, 1107, 1313–1314, 1341, 1400–1401, 1423, 1465, 1512, 1559, 1578, 1592, 1643, 1651, 1670–1671, 1685, 1742, 1751, 1779, 1891–1892, 2308, 2311, 2335–2336, 2352–2353, 2387, 2422–2424, 2433, 2436–2437
   context.py691775%38–45, 54–55, 57, 80, 87–93, 98
   main.py132695%52, 55, 168, 170, 232, 239
   models.py3632194%26, 47, 145, 149, 287, 341, 380, 442, 480–481, 484, 487, 527, 536, 544, 550, 561–563, 573, 622
   ssa.py134894%48–49, 96, 102, 138, 142, 163, 167
   to_text_visitor.py1297244%17–21, 30, 33, 36, 39, 42–51, 54–55, 74–75, 78, 81–83, 99, 104–105, 108, 112–116, 120–126, 130–145, 149–153, 157–161, 165–170
   types_.py39685%25–26, 51–54
   visitor.py1222480%7–9, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, 85, 89, 162, 168–169
   visitor_mutator.py89298%132–133
   vla.py73297%50, 87
src/puya/ir/destructure
   coalesce_locals.py85298%32, 35
   main.py23483%20, 23, 29, 34
   parcopy.py84890%47, 75, 83, 88–92, 110
src/puya/ir/optimize
   arithmetic.py2213684%137, 144, 201, 205, 207, 209, 211, 214, 230, 232, 252, 256, 258, 260, 267, 298, 301–304, 306, 308, 310, 312, 314, 320, 322, 324, 326, 328, 330, 332, 335–336, 339–340
   collapse_blocks.py92298%62, 68
   constant_propagation.py1251191%68–69, 86–87, 98–99, 180–186
   dead_code_elimination.py86495%21–22, 86, 122
   main.py79692%99–104, 123–124
TOTAL12017170586% 

Tests Skipped Failures Errors Time
151 2 💤 0 ❌ 0 🔥 11m 4s ⏱️

Please sign in to comment.