From a1b46673f803669a7d07b38a8f9de0f61545a4df Mon Sep 17 00:00:00 2001 From: mac Date: Tue, 29 Apr 2025 11:30:48 +0100 Subject: [PATCH 1/2] added ci-pipeline workflow --- .github/workflows/ci.yml | 43 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7fd1142 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +name: Cairo-Dojo CI + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + build-and-test: + name: Build and Test + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install Dojo + run: curl -L https://install.dojoengine.org | bash + + - name: Setup Dojo + run: /home/runner/.config/.dojo/bin/dojoup -v nightly + + - name: Install Scarb + run: curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | bash + + - name: Add Scarb to PATH + run: echo "${HOME}/.local/bin" >> $GITHUB_PATH + + - name: Build + run: | + /home/runner/.config/.dojo/bin/sozo build + if [[ `git status --porcelain` ]]; then + echo "The git repo is dirty" + echo "Make sure to run 'sozo build' after changing Scarb.toml" + exit 1 + fi + + - name: Run tests + run: /home/runner/.config/.dojo/bin/sozo test + + - name: Check formatting + run: scarb fmt --check \ No newline at end of file From 1f881bd5d5adc9ed610d84734203c6d1a2e35286 Mon Sep 17 00:00:00 2001 From: mac Date: Sat, 3 May 2025 12:20:36 +0100 Subject: [PATCH 2/2] fixed-ci --- .github/workflows/ci.yml | 53 ++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fd1142..0312455 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,30 +14,45 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 - - - name: Install Dojo - run: curl -L https://install.dojoengine.org | bash - - - name: Setup Dojo - run: /home/runner/.config/.dojo/bin/dojoup -v nightly - - - name: Install Scarb - run: curl --proto '=https' --tlsv1.2 -sSf https://docs.swmansion.com/scarb/install.sh | bash - - - name: Add Scarb to PATH - run: echo "${HOME}/.local/bin" >> $GITHUB_PATH - - - name: Build + + - name: Install asdf + uses: asdf-vm/actions/setup@v2 + + - name: Verify asdf installation + run: asdf --version + + - name: Install Dojo plugin + run: | + asdf plugin add dojo https://github.com/dojoengine/asdf-dojo + asdf install dojo 1.1.1 + asdf global dojo 1.1.1 + asdf list dojo + which sozo || echo "sozo not found" + ls -la /home/runner/.config/.dojo/bin/ || echo "Directory not found" + + - name: Update PATH + run: echo "$HOME/.asdf/shims" >> $GITHUB_PATH + + - name: Install Scarb plugin + run: | + asdf plugin add scarb + asdf install scarb 2.9.2 + asdf global scarb 2.9.2 + + - name: Build contracts + working-directory: backend/dojo_examples/combat_game run: | - /home/runner/.config/.dojo/bin/sozo build + sozo build if [[ `git status --porcelain` ]]; then echo "The git repo is dirty" echo "Make sure to run 'sozo build' after changing Scarb.toml" exit 1 fi - + - name: Run tests - run: /home/runner/.config/.dojo/bin/sozo test - + working-directory: backend/dojo_examples/combat_game + run: sozo test + - name: Check formatting - run: scarb fmt --check \ No newline at end of file + working-directory: backend/dojo_examples/combat_game + run: scarb fmt --check