feat: Implement compare_word functionality #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Smart Contract CI | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- 'onchain/**' | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- 'onchain/**' | |
jobs: | |
smart-contract-ci: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./onchain | |
env: | |
PATH: "/root/.local/bin:$PATH" | |
SCARB_HOME: "/root/.local/share/scarb-install/latest" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: | | |
apt-get update | |
apt-get install -y curl bash | |
- name: Set up Scarb | |
shell: bash | |
run: | | |
mkdir -p /root/.local/bin | |
curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | bash | |
echo "${SCARB_HOME}/bin" >> $GITHUB_PATH | |
ls -la /root/.local/bin | |
which scarb || echo "scarb not in PATH" | |
/root/.local/bin/scarb --version | |
- name: Cache Scarb dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.scarb | |
target/ | |
key: ${{ runner.os }}-scarb-${{ hashFiles('**/Scarb.toml') }} | |
restore-keys: | | |
${{ runner.os }}-scarb- | |
- name: Check Cairo formatting | |
shell: bash | |
run: /root/.local/bin/scarb fmt --check | |
- name: Build smart contracts | |
shell: bash | |
run: /root/.local/bin/scarb build | |
- name: Run tests | |
shell: bash | |
run: /root/.local/bin/scarb test | |
- name: Run security checks | |
run: | | |
echo "Running security checks..." | |
! find . -type f -name "*.cairo" -exec grep -l "assert_not_zero" {} \; | |
! find . -type f -name "*.cairo" -exec grep -l "unsafe_" {} \; | |
- name: Upload compilation artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: compiled-contracts | |
path: target/ | |
retention-days: 7 | |
- name: Report Status | |
if: always() | |
run: | | |
echo "CI Process Complete" | |
echo "Compilation Status: ${{ job.status }}" |