diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 00000000..03f558d8 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,90 @@ +name: CI +on: + pull_request: + push: + branches: + - master + - main + +jobs: + Test: + if: "!contains(github.event.head_commit.message, '[skip ci]')" + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - windows-2019 + - ubuntu-20.04 + - macos-10.15 + node: + - 14 # installed on the images + pnpm: + - 6 + steps: + - uses: actions/checkout@v2 + + - name: Cache + uses: actions/cache@v2 + with: + path: | + ~/.pnpm-store + D:\.pnpm-store + key: "setupcpp-cache-OS:${{ matrix.os }}-node:${{ matrix.node }}-pnpm:${{ matrix.pnpm }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}" + restore-keys: | + "setupcpp-cache-OS:${{ matrix.os }}" + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + + - name: Setup Pnpm + uses: pnpm/action-setup@v2 + with: + version: ${{ matrix.pnpm }} + + - name: Install and build + run: | + pnpm install + + Lint: + if: "!contains(github.event.head_commit.message, '[skip ci]')" + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Commit lint ✨ + uses: wagoid/commitlint-github-action@v2 + + - name: Cache + uses: actions/cache@v2 + with: + path: | + ~/.pnpm-store + D:\.pnpm-store + key: "setupcpp-cache-OS:${{ matrix.os }}-node:${{ matrix.node }}-pnpm:${{ matrix.pnpm }}-${{ hashFiles('./.npmrc') }}-deps:${{ hashFiles('./package.json') }}" + restore-keys: | + "setupcpp-cache-OS:${{ matrix.os }}" + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + + - name: Setup Pnpm + uses: pnpm/action-setup@v2 + with: + version: ${{ matrix.pnpm }} + + - name: Install dependencies + run: pnpm install + + - name: Format ✨ + run: pnpm run test.format + + - name: Lint ✨ + run: pnpm run test.lint \ No newline at end of file