From ced0e10b9271aff08fa281a1edaea812aa6b4579 Mon Sep 17 00:00:00 2001 From: Kieran O'Neill Date: Sat, 9 Nov 2024 23:59:53 +0000 Subject: [PATCH] ci: add action to install algokit --- .github/actions/use-algokit/action.yml | 37 +++++++++++++++++++ .../action.yml | 4 +- .github/workflows/pull_request_checks.yml | 16 ++++---- .github/workflows/release.yml | 8 +++- README.md | 8 ++-- packages/contract/.algokit.toml | 15 -------- 6 files changed, 58 insertions(+), 30 deletions(-) create mode 100644 .github/actions/use-algokit/action.yml rename .github/actions/{use-dependencies => use-npm-dependencies}/action.yml (82%) delete mode 100644 packages/contract/.algokit.toml diff --git a/.github/actions/use-algokit/action.yml b/.github/actions/use-algokit/action.yml new file mode 100644 index 0000000..1e44c45 --- /dev/null +++ b/.github/actions/use-algokit/action.yml @@ -0,0 +1,37 @@ +name: "Use AlgoKit" + +description: "Checks if the dependencies have been cached with the hash of the package-lock.json file." + +inputs: + algokit_version: + description: "The version of AlgoKit to install" + required: false + default: "latest" + +runs: + using: "composite" + steps: + - name: "๐Ÿ”‘ Set up cache key" + id: cache-key + run: echo "CACHE_KEY=algokit-${{ inputs.algokit_version }}-$(python --version | cut -d' ' -f2)" >> $GITHUB_ENV + - name: "๐Ÿ’พ Cache dependencies" + id: algokit-cache + uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ env.CACHE_KEY }} + restore-keys: | + ${{ runner.os }}-algokit-${{ inputs.algokit_version }} + ${{ runner.os }}-algokit- + ${{ runner.os }}- + - name: "๐Ÿ”ง Setup" + uses: actions/setup-python@v4 + with: + python-version: '3.12' + - name: "๐Ÿ“ค Upgrade pip" + run: python -m pip install --upgrade pip + shell: bash + - name: "๐Ÿ“ฆ Install" + if: steps.algokit-cache.outputs.cache-hit != 'true' + run: pip install algokit==${{ inputs.algokit_version }} + shell: bash diff --git a/.github/actions/use-dependencies/action.yml b/.github/actions/use-npm-dependencies/action.yml similarity index 82% rename from .github/actions/use-dependencies/action.yml rename to .github/actions/use-npm-dependencies/action.yml index a9431c3..726a0a2 100644 --- a/.github/actions/use-dependencies/action.yml +++ b/.github/actions/use-npm-dependencies/action.yml @@ -1,6 +1,6 @@ -name: "Use Dependencies" +name: "Use npm Dependencies" -description: "Checks if the dependencies have been cached with the hash of the package-lock.json file." +description: "Checks if the npm dependencies have been cached with the hash of the package-lock.json file." runs: using: "composite" diff --git a/.github/workflows/pull_request_checks.yml b/.github/workflows/pull_request_checks.yml index 6107d5b..e959cd4 100644 --- a/.github/workflows/pull_request_checks.yml +++ b/.github/workflows/pull_request_checks.yml @@ -15,7 +15,7 @@ jobs: - name: "๐Ÿ›Ž Checkout" uses: actions/checkout@v4 - name: "๐Ÿ”ง Setup" - uses: ./.github/actions/use-dependencies + uses: ./.github/actions/use-npm-dependencies get_changed_files: name: "Get Changed Files" @@ -51,7 +51,7 @@ jobs: - name: "๐Ÿ›Ž Checkout" uses: actions/checkout@v4 - name: "๐Ÿ”ง Setup" - uses: ./.github/actions/use-dependencies + uses: ./.github/actions/use-npm-dependencies - name: "๐Ÿ“ฅ Get PR Title" id: get_pr_title uses: actions/github-script@v7 @@ -80,7 +80,7 @@ jobs: - name: "๐Ÿ›Ž Checkout" uses: actions/checkout@v4 - name: "๐Ÿ”ง Setup" - uses: ./.github/actions/use-dependencies + uses: ./.github/actions/use-npm-dependencies - name: "๐Ÿ” Type Check" run: npm run check:types --workspace=@kibisis/pinakion-js-client @@ -93,7 +93,7 @@ jobs: - name: "๐Ÿ›Ž Checkout" uses: actions/checkout@v4 - name: "๐Ÿ”ง Setup" - uses: ./.github/actions/use-dependencies + uses: ./.github/actions/use-npm-dependencies - name: "๐Ÿ‘• Lint" run: npm run lint:contract @@ -106,7 +106,7 @@ jobs: - name: "๐Ÿ›Ž Checkout" uses: actions/checkout@v4 - name: "๐Ÿ”ง Setup" - uses: ./.github/actions/use-dependencies + uses: ./.github/actions/use-npm-dependencies - name: "๐Ÿ‘• Lint" run: npm run lint:js-client @@ -118,7 +118,9 @@ jobs: steps: - name: "๐Ÿ›Ž Checkout" uses: actions/checkout@v4 - - name: "๐Ÿ”ง Setup" - uses: ./.github/actions/use-dependencies + - name: "๐Ÿ”ง Setup npm Dependencies" + uses: ./.github/actions/use-npm-dependencies + - name: "๐Ÿ”ง Setup AlgoKit" + uses: ./.github/actions/use-algokit - name: "๐Ÿงช Test" run: npm run test:js-client diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a9812f2..224104b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,9 @@ jobs: - name: "๐Ÿ›Ž Checkout" uses: actions/checkout@v4 - name: "๐Ÿ”ง Setup" - uses: ./.github/actions/use-dependencies + uses: ./.github/actions/use-npm-dependencies + - name: "๐Ÿ”ง Setup AlgoKit" + uses: ./.github/actions/use-algokit - name: "๐Ÿ—๏ธ Build" run: npm run build:contract - name: "๐Ÿ”– Release" @@ -45,7 +47,9 @@ jobs: - name: "๐Ÿ›Ž Checkout" uses: actions/checkout@v4 - name: "๐Ÿ”ง Setup" - uses: ./.github/actions/use-dependencies + uses: ./.github/actions/use-npm-dependencies + - name: "๐Ÿ”ง Setup AlgoKit" + uses: ./.github/actions/use-algokit - name: "๐Ÿ“ Create .npmrc" run: | echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_PUBLISH_PACKAGES_ACCESS_TOKEN }}" >> .npmrc diff --git a/README.md b/README.md index 5bc4d00..de25e32 100644 --- a/README.md +++ b/README.md @@ -83,10 +83,10 @@ npm install ### 3.1. Packages -| Name | Description | -|-----------------------------------------------------------------|-------------------------------------------------------------------| -| [`pinakion-contract`](./packages/pinakion-contract/README.md) | The Kibisis Pinakion NFT contract written in TEALScript. | -| [`pinakion-js-client`](./packages/pinakion-js-client/README.md) | The JS client to interact with the Kibisis Pinakion NFT contract. | +| Name | Description | +|--------------------------------------------------------|-------------------------------------------------------------------| +| [`contract`](./packages/pinakion-contract/README.md) | The Kibisis Pinakion NFT contract written in TEALScript. | +| [`js-client`](./packages/pinakion-js-client/README.md) | The JS client to interact with the Kibisis Pinakion NFT contract. | [Back to top ^][table-of-contents] diff --git a/packages/contract/.algokit.toml b/packages/contract/.algokit.toml deleted file mode 100644 index 9b225c1..0000000 --- a/packages/contract/.algokit.toml +++ /dev/null @@ -1,15 +0,0 @@ -[algokit] -min_version = "v2.0.0" - -[project] -type = 'contract' -name = 'pinakion-contract' -artifacts = 'dist' - -[project.run] -build = { commands = [ - 'npm run build', -], description = 'Build all smart contracts in the project' } -test = { commands = [ - 'npm run test', -], description = 'Run smart contract tests' }