name: build-and-test on: pull_request: branches: - master - develop env: PNPM_CACHE_FOLDER: .pnpm-store concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} cancel-in-progress: true jobs: build-and-test: runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest] node: [18] steps: - name: Checkout ๐Ÿ›Ž uses: actions/checkout@master - name: Setup node env ๐Ÿ— uses: actions/setup-node@v3 with: node-version: ${{ matrix.node }} check-latest: true - name: Install pnpm ๐ŸŽ’ uses: pnpm/action-setup@v2.2.2 with: version: 7 run_install: false - name: Setup pnpm config ๐Ÿ— run: pnpm config set store-dir $PNPM_CACHE_FOLDER - name: Get pnpm store directory ๐Ÿฌ id: pnpm-cache shell: bash run: | echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT - name: Setup pnpm cache ๐Ÿงƒ uses: actions/cache@v3 with: path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - name: Install dependencies ๐Ÿ‘จ๐Ÿปโ€๐Ÿ’ป run: pnpm install - name: Setup Turbo cache ๐ŸŽ๏ธ id: turbo-cache uses: actions/cache@v2 with: path: .turbo key: turbo-${{ runner.os }}-${{ github.sha }} restore-keys: | turbo-${{ runner.os }}- - name: Run linter ๐Ÿงน run: pnpm run lint --cache-dir=.turbo - name: Build Library ๐Ÿ‘ท run: pnpm run build --cache-dir=.turbo - name: Run tests ๐Ÿงช run: pnpm run test --cache-dir=.turbo