diff --git a/.github/workflows/contracts.yml b/.github/workflows/contracts.yml new file mode 100644 index 0000000..74094f2 --- /dev/null +++ b/.github/workflows/contracts.yml @@ -0,0 +1,51 @@ +on: [push] + +name: test + +jobs: + check: + name: Foundry project + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install Foundry + uses: foundry-rs/foundry-toolchain@v1 + + - name: Install Node.js 18 + uses: actions/setup-node@v2 + with: + node-version: '18' + + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Cache yarn dependencies + uses: actions/cache@v2 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('contracts/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Cache node_modules + id: npm_cache + uses: actions/cache@v2 + with: + path: node_modules + key: node_modules-${{ hashFiles('contracts/yarn.lock') }} + + - name: yarn install + # if: steps.npm_cache.outputs.cache-hit != 'true' + run: yarn install + + - name: Compile with foundry + run: forge build + + - name: Run foundry tests + run: forge test -vvv +