name: ci

concurrency:
  group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}'
  cancel-in-progress: true

on:
  push:
    branches: [main]
  pull_request:

jobs:
  foundry:
    strategy:
      fail-fast: true

    name: Lens Protocol CI
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          submodules: recursive # This replaces `forge install` for dependencies
      - name: Install Foundry
        uses: foundry-rs/foundry-toolchain@v1
        with:
          version: nightly
      - name: Compile Project
        run: |
          forge --version
          FOUNDRY_PROFILE=cibuild forge build --deny-warnings --skip test script
      - name: Run Tests
        run: |
          cp .env.example .env
          source .env
          FOUNDRY_PROFILE=citest forge test -vvv
