Skip to content

Commit

Permalink
remove proposal generation
Browse files Browse the repository at this point in the history
  • Loading branch information
kwtalley committed Jul 28, 2023
1 parent ef308dc commit a028141
Show file tree
Hide file tree
Showing 10 changed files with 4 additions and 116 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/smart-contract-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,6 @@ jobs:
provenance_version: "v1.16.0"
smart_contract_action_version: ${{ needs.docker.outputs.smart_contract_action_version }}
test_script: "./smart-contract-action/test/test.sh"
generate_proposals: true
wasm_path: "./smart-contract-action/test/provwasm_tutorial.wasm"

test_with_provenance_release_no_script:
needs: docker
Expand All @@ -104,8 +102,6 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
provenance_version: "v1.16.0"
smart_contract_action_version: ${{ needs.docker.outputs.smart_contract_action_version }}
generate_proposals: true
wasm_path: "./smart-contract-action/test/provwasm_tutorial.wasm"

test_with_init_data:
needs: docker
Expand All @@ -122,5 +118,3 @@ jobs:
provenance_version: "v1.16.0"
smart_contract_action_version: ${{ needs.docker.outputs.smart_contract_action_version }}
init_data: "./smart-contract-action/test/init_data"
generate_proposals: true
wasm_path: "./smart-contract-action/test/provwasm_tutorial.wasm"
24 changes: 3 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,24 @@ For an example of this in use look at [this repository's test workflow](https://
- #### With a released version of Provenance
```yaml
- name: Smart Contract Test setup
uses: provenance-io/provenance-testing-action@v1.1.2
uses: provenance-io/provenance-testing-action@v1.2.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
provenance_version: "v1.14.1"
provenance_version: "v1.16.0"
test_script: "./scripts/name_test.sh"
```
- #### With a development version of Provenance
Note: `provenance_version` is a branch which has an associated `Pull Request` and a **successful** run of the [Provenance Build and Release action](https://github.com/provenance-io/provenance/actions/workflows/release.yml)
```yaml
- name: Smart Contract Test setup
uses: provenance-io/provenance-testing-action@v1.1.2
uses: provenance-io/provenance-testing-action@v1.2.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
provenance_version: "issue/new-feature"
test_script: "./scripts/name_test.sh"
```

#### Generating governance proposals
```yaml
- name: Smart Contract Test setup
uses: provenance-io/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
provenance_version: "v1.14.1"
test_script: "./scripts/name_test.sh"
generate_proposals: true
```

#### Using provided initial data for Provenance
```yaml
- name: Smart Contract Test setup
Expand All @@ -52,13 +41,8 @@ For an example of this in use look at [this repository's test workflow](https://
provenance_version: "v1.14.1"
init_data: "./smart_contract_action/test/init_data"
test_script: "./smart_contract_action/scripts/name_test.sh"
generate_proposals: true
```

After a successful run, the proposals will be added to an archive named `$GITHUB_JOB_proposals.zip` and attached to the build.

**IMPORTANT**: The json proposals have placeholders for user-specific data (e.g., title, account addresses, code_id). These placeholders must be replaced in order to submit the proposal. This includes either placing the metadata contents directly into the proposal json (on-chain storage) or storing the metadata on IPFS and updating the `CID` in the proposal json.

---

### Configuration
Expand All @@ -69,5 +53,3 @@ After a successful run, the proposals will be added to an archive named `$GITHUB
| `provenance_version` | string | **Required** | Version of Provenance to test, either a release or a branch |
| `init_data` | string | *Optional* | The directory that contains the initial seed data for Provenance. It should contain the `config`, `data`, and `keyring-test` directories. Example: [init_data](smart-contract-action%2Ftest%2Finit_data) |
| `test_script` | string | *Optional* | Script used to run tests after provenance has been setup and is running |
| `generate_proposals` | boolean | *Optional* | Generate the store, instantiate, and migrate governance proposals |
| `wasm_path` | string | *Optional* | Path to the smart contract wasm |
16 changes: 1 addition & 15 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ inputs:
test_script:
description: 'Script used to run tests after provenance has been setup and is running'
required: false
generate_proposals:
description: 'Generate the store, instantiate, and migrate governance proposals'
required: false
wasm_path:
description: 'Path to the smart contract wasm'
required: false
runs:
using: composite
steps:
Expand All @@ -43,14 +37,6 @@ runs:
IMAGE: "provenanceio/smart-contract-action:${{ inputs.smart_contract_action_version }}"
INIT_DATA: "${{ inputs.init_data != null && inputs.init_data || false }}"
TEST_SCRIPT: "${{ inputs.test_script != null && inputs.test_script || false }}"
GENERATE_PROPOSALS: "${{ inputs.generate_proposals }}"
WASM_PATH: "${{ inputs.wasm_path }}"
run: |
docker pull ${{ env.IMAGE }}
docker run -v $GITHUB_WORKSPACE:/scratch:Z ${{ env.IMAGE }} ${{ env.INIT_DATA }} ${{ env.TEST_SCRIPT }} ${{ env.GENERATE_PROPOSALS }} ${{ env.WASM_PATH }}
- name: attach artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ github.job }}_proposals
path: |
smart-contract-action/scripts/templates/governance/
docker run -v $GITHUB_WORKSPACE:/scratch:Z ${{ env.IMAGE }} ${{ env.INIT_DATA }} ${{ env.TEST_SCRIPT }}
10 changes: 0 additions & 10 deletions smart-contract-action/scripts/setup_provenance.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,3 @@ if [ "$TEST_SCRIPT" != false ]; then

echo "Test complete"
fi

if [ "$GENERATE_PROPOSALS" != false ]; then
printf "\n\nGenerating proposals...\n\n"

$(base64 --wrap=0 $WASM_PATH > wasm_base64)

# generate and sanitize the store code proposal
awk 'NR==FNR{a=a""$0"\n";next} {while (match($0, /\$BYTE_CODE/)) {printf "%s", substr($0, 1, RSTART-1) a; $0 = substr($0, RSTART+RLENGTH)}; print}' wasm_base64 /scripts/templates/governance/store/draft_proposal.json > temp_store_proposal
mv temp_store_proposal /scripts/templates/governance/store/draft_proposal.json
fi

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit a028141

Please sign in to comment.