Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 82 additions & 36 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- '**.gitignore'
- '.images/**'
- '**README.md'
- 'LICENSE'

pull_request:
branches:
Expand All @@ -18,50 +19,95 @@ on:
- '**.gitignore'
- '.images/**'
- '**README.md'
- 'LICENSE'


jobs:
prepare_matrix:
name:
runs-on: ubuntu-latest
env:
# constant values for matrix
platform: '[\"ubuntu-latest\", \"macos-latest\"]'
toolchain: '[\"stable\"]'
outputs:
MATRIX: ${{ steps.build_matrix.outputs.MATRIX }}
SKIP_CHECKS: ${{ steps.build_matrix.outputs.SKIP_CHECKS }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive

- name: Look for changes in standalone contracts
id: CHANGED_CONTRACTS
uses: tj-actions/changed-files@v39
with:
dir_names: "true"
dir_names_exclude_current_dir: "true"
dir_names_max_depth: 1
files_ignore: |
.github/**
**/.gitignore
**/*.md
multi-contract-caller/**
upgradeable-contracts/**
json: true

- name: Look for changes in multi and upgradable contracts
id: CHANGED_MULTI_AND_UPGRADEABLE_CONTRACTS
uses: tj-actions/changed-files@v39
with:
dir_names: "true"
dir_names_exclude_current_dir: "true"
dir_names_max_depth: 2
files: |
multi-contract-caller/**
upgradeable-contracts/**
files_ignore: |
**/.gitignore
**/*.md
json: true

- name: Build matrix
id: build_matrix
run: |
ALL_CHANGED_CONTRACTS=$(jq -s 'add' \
<(echo "${{ steps.CHANGED_CONTRACTS.outputs.all_changed_files }}") \
<(echo "${{ steps.CHANGED_MULTI_AND_UPGRADEABLE_CONTRACTS.outputs.all_changed_files }}"))

if [ $ALL_CHANGED_CONTRACTS = "[]" ]
then
echo "Nothing important changed. Checks job will be skipped."
echo "SKIP_CHECKS=true" >> $GITHUB_OUTPUT
else
echo "There are changes in following contracts: $ALL_CHANGED_CONTRACTS"
echo "SKIP_CHECKS=false" >> $GITHUB_OUTPUT
fi

echo "MATRIX={\"platform\":${{env.platform}},\
\"toolchain\":${{env.toolchain}},\
\"contract\":"$ALL_CHANGED_CONTRACTS"}"\
>> $GITHUB_OUTPUT

- name: Show resulting matrix
run: |
echo "Following matrix will be used to generate test jobs."
echo ${{ toJson(steps.build_matrix.outputs.MATRIX) }} | jq

check:
name: examples
needs: prepare_matrix
if: ${{ needs.prepare_matrix.outputs.SKIP_CHECKS == 'false' }}
env:
RUST_BACKTRACE: full

strategy:
matrix:
platform:
- ubuntu-latest
- macos-latest
toolchain:
- stable
contract:
- basic-contract-caller
- call-runtime
- conditional-compilation
- contract-terminate
- custom-allocator
- custom-environment
- dns
- e2e-call-runtime
- erc20
- erc721
- erc1155
- flipper
- incrementer
- multi-contract-caller
- multi-contract-caller/accumulator
- multi-contract-caller/adder
- multi-contract-caller/subber
- multisig
- payment-channel
- psp22-extension
- rand-extension
- trait-dyn-cross-contract-calls
- trait-erc20
- trait-flipper
- trait-incrementer
- upgradeable-contracts/delegator
- upgradeable-contracts/set-code-hash
- vesting
${{ fromJson(needs.prepare_matrix.outputs.MATRIX) }}

runs-on: ${{ matrix.platform }}
env:
RUST_BACKTRACE: full
steps:
- name: Checkout sources & submodules
uses: actions/checkout@v4
Expand Down