Skip to content

Commit

Permalink
refactor: changes for taqueria final release v0.14.4 (#35)
Browse files Browse the repository at this point in the history
* chore: uses new prerelease version

* chore: updated package versions

* chore: changed compile command to specify the fikles

* chore: changed originate to deploy

* chore: fix deploy environment variable

* chore: reworked compile and deploy

* chore: fix package versions

* chore: fix package versions

* chore: fix counter storage

* chore: use latest binary and packages

* chore: use latest packages in hello-tacos

* chore: update README
  • Loading branch information
GImbrailo authored Sep 6, 2022
1 parent ff93716 commit d3eba46
Show file tree
Hide file tree
Showing 12 changed files with 1,104 additions and 500 deletions.
14 changes: 6 additions & 8 deletions .github/workflows/action-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ jobs:
uses: ./
with:
plugins: '@taqueria/plugin-ligo, @taqueria/plugin-flextesa, @taqueria/plugin-taquito, @taqueria/plugin-jest'
contracts: 'counter.jsligo'
compile_command: compile
compile_contracts: counter.jsligo
sandbox_name: local
originate: 'True'
deploy_contracts: counter.tz

- name: upload artifacts
uses: actions/upload-artifact@v3
Expand All @@ -65,24 +64,23 @@ jobs:
cd example-projects/hello-tacos
npm update
- name: register and compile contracts
- name: compile contracts
uses: ./
with:
project_directory: 'example-projects/hello-tacos'
contracts: 'hello-tacos.mligo'
compile_command: 'compile'
compile_contracts: 'hello-tacos.mligo'

- name: start local sandbox
uses: ./
with:
project_directory: 'example-projects/hello-tacos'
sandbox_name: 'local'

- name: originate contracts
- name: deploy contracts
uses: ./
with:
project_directory: 'example-projects/hello-tacos'
originate: True
deploy_contracts: hello-tacos.tz

- name: run tests
uses: ./
Expand Down
5 changes: 1 addition & 4 deletions .taq/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@
"networks": [],
"sandboxes": [
"local"
],
"storage": {
"counter.tz": 42
}
]
}
},
"accounts": {
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

FROM debian:bullseye
FROM node:16
FROM node:18

# Set the DENO_DIR environment variable to controll where the cache is built
RUN mkdir deno
Expand Down
60 changes: 24 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,81 +4,69 @@ A docker action that helps simplify and standardize the use of [Taqueria](https:

## Inputs

### `project_directory`
### `compile_contracts`

The name of the project directory. If nothing is specified the repository root directory is used.
A list of contract file names to be compiled into Michelson. The artifacts are saved to the `artifacts` directory with the `.tz` extension.

### `task`
### `deploy_contracts`

The name of a specific task to run. This input is mainly used for testing purposes.
A list of Michelson smart contract files including the `.tz` extension to be deployed to a specified environment. The Taquito plugin needs to be installed.

### `plugins`
### `environment`

A comma separated list of plugins to install.
This input is used to select the configured environment for `taqueria` to originate to. The default is set to `development`.

### `sandbox_name`

The name of the Flextesa sandbox to use. A sandbox will only be created if this input is specified. When running the sandbox, the action will automatically change the value of `rpcUrl` for the sandbox in `config.json`. This is to enable origination to the local sandbox in CI.
### `plugins`

### `contracts`
A comma separated list of plugins to install.
### `project_directory`

A comma separated list of contracts to be added to the Taqueria project.
The name of the project directory. If nothing is specified the repository root directory is used.

### `compile_command`
### `sandbox_name`

The compile command used to compile the contracts.
The name of the Flextesa sandbox to use. A sandbox will only be created if this input is specified. When running the sandbox, the action will automatically change the value of `rpcUrl` for the sandbox in `config.json`. This is to enable origination to the local sandbox in CI.

### `originate`
### `task`

When set to true, contracts will be originated to the environment defined with the `environment` variable (leave empty for default). This option makes use of the `taquito` plugin so please make sure to install it.
The name of a specific task to run. This input is mainly used for testing purposes.

### `tests`

When set to true, all tests in the `tests` directory will be run using the Jest plugin. This option makes use of the `jest` plugin so please make sure to install it.

### `environment`

This input is used to select the configured environment for `taqueria` to originate to. The default is set to `development`.

## Example usage

### Single step action
```yaml
- name: taqueria tasks
uses: ecadlabs/taqueria-github-action@v0.2.0
uses: ecadlabs/taqueria-github-action@v0.4.0
with:
plugins: '@taqueria/plugin-ligo, @taqueria/plugin-flextesa, @taqueria/plugin-taquito'
contracts: 'counter.jsligo'
compile_command: compile
plugins: '@taqueria/plugin-ligo, @taqueria/plugin-flextesa, @taqueria/plugin-taquito, @taqueria/plugin-jest'
compile_contracts: counter.jsligo
sandbox_name: local
originate: 'true'
deploy_contracts: counter.tz
tests: 'true'
```
### Multiple step action
```yaml
- name: compile contracts
uses: ecadlabs/taqueria-github-action@v0.2.0
uses: ecadlabs/taqueria-github-action@v0.4.0
with:
project_directory: 'example-projects/hello-tacos'
contracts: 'hello-tacos.mligo'
compile_command: 'compile'
compile_contracts: 'hello-tacos.mligo'

- name: start local sandbox
uses: ecadlabs/taqueria-github-action@v0.2.0
uses: ecadlabs/taqueria-github-action@v0.4.0
with:
project_directory: 'example-projects/hello-tacos'
sandbox_name: 'local'

- name: originate contracts
uses: ecadlabs/[email protected]
with:
project_directory: 'example-projects/hello-tacos'
originate: 'true'

- name: originate contracts
uses: ecadlabs/[email protected]
- name: deploy contracts
uses: ecadlabs/[email protected]
with:
project_directory: 'example-projects/hello-tacos'
tests: 'true'
deploy_contracts: hello-tacos.tz
```
14 changes: 5 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ branding:
icon: circle
color: red
inputs:
compile_command:
description: 'A command to compile the contracts'
compile_contracts:
description: 'A comma separated list of contracts compiled'
required: false
contracts:
description: 'A comma separated list of contracts to be added to the Taqueria project'
deploy_contracts:
description: 'A comma seperated list of contracts to deploy to a specific environment. The Taquito plugin needs to be installed'
required: false
environment:
description: 'The environment to execute commands on. The default is "development"'
Expand All @@ -20,9 +20,6 @@ inputs:
project_directory:
description: 'The name of the project to create'
required: false
originate:
description: 'Set to True/true to originate any contracts. The Taquito plugin needs to be installed'
required: false
sandbox_name:
description: 'The name of the sandbox if any'
required: false
Expand All @@ -37,11 +34,10 @@ runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.compile_command }}
- ${{ inputs.environment }}
- ${{ inputs.plugins }}
- ${{ inputs.project_directory }}
- ${{ inputs.sandbox_name }}
- ${{ inputs.originate }}
- ${{ inputs.deploy_contracts }}
- ${{ inputs.task }}
- ${{ inputs.tests }}
5 changes: 5 additions & 0 deletions contracts/counter.storages.jsligo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// All storage values must be in this file

// Define storage variable

let storage:storage = 42
18 changes: 13 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,26 @@ if [ -n "$INPUT_CONTRACTS" ]; then
done
fi

if [ -n "$INPUT_COMPILE_COMMAND" ]; then
if [ -n "$INPUT_COMPILE_CONTRACTS" ]; then
echo "PROJECT_DIR: $PROJECT_DIR"
echo "Compiling contracts using the command $INPUT_COMPILE_COMMAND"
taq $INPUT_COMPILE_COMMAND
# for each contract in the comma separated INPUT_CONTRACTS register the contract
for contract in $(echo $INPUT_COMPILE_CONTRACTS | tr "," "\n"); do
echo "Compiling $contract"
taq compile "$contract"
done
fi

if [ -n "$INPUT_SANDBOX_NAME" ]; then
taq start sandbox $INPUT_SANDBOX_NAME
fi

if [ "$INPUT_ORIGINATE" == "true" ] || [ "$INPUT_ORIGINATE" == "True" ]; then
taq originate --env $INPUT_ENVIRONMENT
if [ -n "$INPUT_DEPLOY_CONTRACTS" ]; then
taq deploy $INPUT_DEPLOY_CONTRACTS --env $INPUT_ENVIRONMENT
# for each contract in the comma separated INPUT_CONTRACTS register the contract
for contract in $(echo $INPUT_DEPLOY_CONTRACTS | tr "," "\n"); do
echo "Deploying $contract"
taq deploy "$contract"
done
fi

if [ -n "$INPUT_TASK" ] && [ "$INPUT_TASK" != "init" ]; then
Expand Down
50 changes: 25 additions & 25 deletions example-projects/hello-tacos/.taq/config.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,5 @@
{
"language": "en",
"plugins": [
{
"name": "@taqueria/plugin-ligo",
"type": "npm"
},
{
"name": "@taqueria/plugin-jest",
"type": "npm"
},
{
"name": "@taqueria/plugin-taquito",
"type": "npm"
},
{
"name": "@taqueria/plugin-flextesa",
"type": "npm"
}
],
"contractsDir": "contracts",
"artifactsDir": "artifacts",
"network": {},
Expand All @@ -27,6 +9,7 @@
"rpcUrl": "http://localhost:20000",
"protocol": "Psithaca2MLRFYargivpo7YvUr7wUDqyxrdhC5CQq78mRvimz6A",
"accounts": {
"default": "joe",
"bob": {
"encryptedKey": "edpkurPsQ8eUApnLUJ9ZPDvu98E8VNj4KtJa1aZr16Cr5ow5VHKnz4",
"publicKeyHash": "tz1aSkwEot3L2kmUvcoxzjMomb9mvBNuzFK6",
Expand Down Expand Up @@ -62,8 +45,10 @@
"sandboxes": [
"local"
],
"storage": {
"hello-tacos.tz": "100"
"aliases": {
"hello-tacos": {
"address": "KT1H6UfH8pAzg8A5umKbsoZ1M3d7f8DTZwcp"
}
}
}
},
Expand All @@ -74,10 +59,25 @@
"jane": "3_000_000_000",
"joe": "3_000_000_000"
},
"contracts": {
"hello-tacos.mligo": {
"sourceFile": "hello-tacos.mligo",
"hash": "530f224fb713e4fb6d250f1c94fdc4a10a4cdde16fe02385071021637cc914e6"
"plugins": [
{
"name": "@taqueria/plugin-ligo",
"type": "npm"
},
{
"name": "@taqueria/plugin-jest",
"type": "npm"
},
{
"name": "@taqueria/plugin-taquito",
"type": "npm"
},
{
"name": "@taqueria/plugin-flextesa",
"type": "npm"
}
}
],
"projectDir": "/home/gino/Documents/Repositories/taqueria-github-action/example-projects/hello-tacos",
"configFile": "/home/gino/Documents/Repositories/taqueria-github-action/example-projects/hello-tacos/.taq/config.json",
"hash": "f67002d5ab749a9c67897943cd738cda94eaf45bd836e639ce52fe83312eb759"
}
Loading

0 comments on commit d3eba46

Please sign in to comment.