diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..64530fe --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,36 @@ +name: Unit tests workflow +on: push + +jobs: + build-test: + name: "Build and Test" + runs-on: ubuntu-latest + environment: testnet #change to mainnet before production + + strategy: + matrix: + node-version: ['20.x'] + + env: + RPC_URL: ${{ secrets.RPC_URL }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install Yarn + run: npm install --global yarn + + - name: Install Dependencies + run: yarn install + + - name: Compile + run: yarn run compile + + - name: Run Tests + run: yarn run test diff --git a/.github/workflows/ci.yml b/.github/workflows/push_main.yml similarity index 71% rename from .github/workflows/ci.yml rename to .github/workflows/push_main.yml index eb2f6f3..916e71b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/push_main.yml @@ -1,12 +1,12 @@ -name: CI - +name: Export ABI workflow on: - push: - branches: - - main + push: + branches: + - main jobs: - build-test-deploy: + exports-abi: + name: "Export ABI's" runs-on: ubuntu-latest environment: testnet #change to mainnet before production @@ -17,6 +17,7 @@ jobs: env: RPC_URL: ${{ secrets.RPC_URL }} PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + steps: - uses: actions/checkout@v4 @@ -34,15 +35,12 @@ jobs: - name: Compile run: yarn run compile - - - name: Run Tests - run: yarn run test - + - name: Extract and publish ABIs run: | - mkdir -p data/abis - find ./artifacts/contracts -type f -name "*.json" ! -name "*.dbg.json" -exec cp {} data/abis/ \; - + mkdir -p data/abis + find ./artifacts/contracts -type f -name "*.json" ! -name "*.dbg.json" -exec cp {} data/abis/ \; + - name: Upload ABI uses: stefanzweifel/git-auto-commit-action@v5 with: @@ -50,5 +48,4 @@ jobs: push_options: '--force' file_pattern: './data/abis/*.json' - - name: Run Deploy - run: yarn run deploy --network testnet #change to mainnet before production + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..04c53df --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Release Workflow + +on: + release: + types: [released] + +jobs: + build-test-deploy: + runs-on: ubuntu-latest + environment: testnet #change to mainnet before production + + strategy: + matrix: + node-version: ['20.x'] + + env: + RPC_URL: ${{ secrets.RPC_URL }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + + steps: + - uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install Yarn + run: npm install --global yarn + + - name: Install Dependencies + run: yarn install + + - name: Compile + run: yarn run compile + + - name: Run Tests + run: yarn run test + + - name: Run Deploy + run: yarn run deploy --network testnet #change to mainnet before production