From 464bba423b86bc98c4cd35a955a6b4d1edd5ad73 Mon Sep 17 00:00:00 2001 From: Yuwen Zhang Date: Thu, 10 Oct 2024 19:38:16 -0700 Subject: [PATCH] add ci (#4) --- .github/workflows/pr.yml | 72 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/pr.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..acb5728 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,72 @@ +name: PR + +on: + push: + branches: [master] + pull_request: +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + + +jobs: + unit-test: + name: Unit Test + runs-on: [runs-on, runner=8cpu-linux-x64, "run-id=${{ github.run_id }}"] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Run tests + run: | + cd verifier + cargo test --package sp1-solana:0.1.0 --lib --features sp1-serialize + + solana-test: + name: Solana Test + runs-on: [runs-on, runner=8cpu-linux-x64, "run-id=${{ github.run_id }}"] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install Solana CLI tools + run: | + sh -c "$(curl -sSfL https://release.anza.xyz/edge/install)" + echo "/home/runner/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH + + - name: Setup pnpm + uses: pnpm/action-setup@v4.0.0 + with: + version: 9 + + - name: Install dependencies + run: | + cd example/solana + pnpm install + + - name: Run build-and-test script + run: | + cd example/solana + yarn build-and-test + + lock-files: + name: "Check lock files" + runs-on: ["runs-on", "runner=8cpu-linux-x64", "run-id=${{ github.run_id }}"] + env: + CARGO_NET_GIT_FETCH_WITH_CLI: "true" + steps: + - name: "Checkout sources" + uses: "actions/checkout@v4" + + - name: "Update lock files" + run: | + cargo tree + (cd ./example/solana/program && cargo tree) + (cd ./example/script && cargo tree) + + - name: "Assert no changes" + run: | + if [ -n "$(git status --porcelain)" ]; then + echo "Lock files not up to date" + exit 1 + fi \ No newline at end of file