From 12499142851625c6ecafdd88df9c162782420318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Maga=C5=A1?= Date: Wed, 17 Jan 2024 13:50:33 +0100 Subject: [PATCH] wip: test --- .github/actions/repl/action.yml | 17 ++++++ .github/actions/setup-pact/action.yml | 27 +++++++++ .github/workflows/pact.yml | 82 ++++++++------------------- 3 files changed, 68 insertions(+), 58 deletions(-) create mode 100644 .github/actions/repl/action.yml create mode 100644 .github/actions/setup-pact/action.yml diff --git a/.github/actions/repl/action.yml b/.github/actions/repl/action.yml new file mode 100644 index 00000000..39253e2b --- /dev/null +++ b/.github/actions/repl/action.yml @@ -0,0 +1,17 @@ +name: REPL +description: Run a REPL test + +inputs: + target: + description: 'The target file to run' + required: true + +runs: + using: composite + steps: + - name: "Test ${{ inputs.target }}" + run: | + bin/pact -t ${{ inputs.target }} > out.log 2>&1 + cat out.log + r=`tail -1 out.log | grep "Load successful"` + if [ -n "$r" ]; then exit 0; else echo "Pact run failed."; exit 1; fi diff --git a/.github/actions/setup-pact/action.yml b/.github/actions/setup-pact/action.yml new file mode 100644 index 00000000..db461039 --- /dev/null +++ b/.github/actions/setup-pact/action.yml @@ -0,0 +1,27 @@ +name: Setup Pact +description: Setup pact environment for running tests + +inputs: + version: + description: 'Target Pact version to install' + required: false + default: "4.10.0" + +runs: + using: composite + steps: + - name: Get pact binary + run: | + mkdir bin + cd bin + wget https://github.com/kadena-io/pact/releases/download/v${{ inputs.version }}/pact-${{ inputs.version }}-linux-20.04.zip + unzip "pact*.zip" + chmod +x pact + cd .. + + - name: Install z3 (ubuntu-18.04) + uses: pavpanchekha/setup-z3@0.2.0 + with: + version: "4.8.10" + architecture: "x64" + distribution: "ubuntu-18.04" \ No newline at end of file diff --git a/.github/workflows/pact.yml b/.github/workflows/pact.yml index b7456d88..b95dbbac 100644 --- a/.github/workflows/pact.yml +++ b/.github/workflows/pact.yml @@ -1,89 +1,55 @@ -# This is a basic workflow to help you get started with Actions - name: CI -# Controls when the action will run. on: push: - branches: - - main pull_request: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" test-pact: - # The type of runner that the job will run on runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v2 - - name: Get pact binary - run: | - mkdir bin - cd bin - wget https://github.com/kadena-io/pact/releases/download/v4.10.0/pact-4.10.0-linux-20.04.zip - unzip "pact*.zip" - chmod +x pact - cd .. - - name: Install z3 (ubuntu-18.04) - uses: pavpanchekha/setup-z3@0.2.0 + - name: Setup Pact + uses: ./.github/actions/setup-pact with: - version: "4.8.10" - architecture: "x64" - distribution: "ubuntu-18.04" + version: "4.10.0" - name: Test pact/marmalade.repl - run: | - bin/pact -t pact/marmalade.repl > out.log 2>&1 - cat out.log - r=`tail -1 out.log | grep "Load successful"` - if [ -n "$r" ]; then exit 0; else echo "Pact run failed."; exit 1; fi + uses: ./.github/actions/repl + with: + target: pact/marmalade.repl - name: Test pact/policy-manager/policy-manager.repl - run: | - bin/pact -t pact/policy-manager/policy-manager.repl > out.log 2>&1 - cat out.log - r=`tail -1 out.log | grep "Load successful"` - if [ -n "$r" ]; then exit 0; else echo "Pact run failed."; exit 1; fi + uses: ./.github/actions/repl + with: + target: pact/policy-manager/policy-manager.repl - name: Test concrete collection-policy - run: | - bin/pact -t pact/concrete-policies/collection-policy/collection-policy-v1.repl > out.log 2>&1 - cat out.log - r=`tail -1 out.log | grep "Load successful"` - if [ -n "$r" ]; then exit 0; else echo "Pact run failed."; exit 1; fi + uses: ./.github/actions/repl + with: + target: pact/concrete-policies/collection-policy/collection-policy-v1.repl - name: Test concrete non-fungible-policy - run: | - bin/pact -t pact/concrete-policies/non-fungible-policy/non-fungible-policy-v1.repl > out.log 2>&1 - cat out.log - r=`tail -1 out.log | grep "Load successful"` - if [ -n "$r" ]; then exit 0; else echo "Pact run failed."; exit 1; fi + uses: ./.github/actions/repl + with: + target: pact/concrete-policies/non-fungible-policy/non-fungible-policy-v1.repl - name: Test concrete royalty-policy - run: | - bin/pact -t pact/concrete-policies/royalty-policy/royalty-policy-v1.repl > out.log 2>&1 - cat out.log - r=`tail -1 out.log | grep "Load successful"` - if [ -n "$r" ]; then exit 0; else echo "Pact run failed."; exit 1; fi + uses: ./.github/actions/repl + with: + target: pact/concrete-policies/royalty-policy/royalty-policy-v1.repl - name: Test concrete guard-policy - run: | - bin/pact -t pact/concrete-policies/guard-policy/guard-policy-v1.repl > out.log 2>&1 - cat out.log - r=`tail -1 out.log | grep "Load successful"` - if [ -n "$r" ]; then exit 0; else echo "Pact run failed."; exit 1; fi + uses: ./.github/actions/repl + with: + target: pact/concrete-policies/guard-policy/guard-policy-v1.repl - name: Test conventional auction sale contract - run: | - bin/pact -t pact/sale-contracts/conventional-auction/conventional-auction.repl > out.log 2>&1 - cat out.log - r=`tail -1 out.log | grep "Load successful"` - if [ -n "$r" ]; then exit 0; else echo "Pact run failed."; exit 1; fi + uses: ./.github/actions/repl + with: + target: pact/sale-contracts/conventional-auction/conventional-auction.repl