Skip to content

Commit

Permalink
wip: test
Browse files Browse the repository at this point in the history
  • Loading branch information
wooglie committed Jan 17, 2024
1 parent 8cb9739 commit 1249914
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 58 deletions.
17 changes: 17 additions & 0 deletions .github/actions/repl/action.yml
Original file line number Diff line number Diff line change
@@ -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
27 changes: 27 additions & 0 deletions .github/actions/setup-pact/action.yml
Original file line number Diff line number Diff line change
@@ -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"
82 changes: 24 additions & 58 deletions .github/workflows/pact.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 1249914

Please sign in to comment.