From e88abe433cdc213bc479cae44a7d8d62b31ae629 Mon Sep 17 00:00:00 2001 From: Greg Hurrell Date: Fri, 4 Aug 2023 21:06:44 +0200 Subject: [PATCH] feat: set up GitHub actions Just for `next` branch for now. --- .github/workflows/ci.yml | 107 +++++++++++++++++++++++++++++++++++++++ package.json | 4 +- 2 files changed, 109 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..217502082 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,107 @@ +name: ci + +on: + push: + branches: [next] + pull_request: + branches: [next] + +env: + yarn-cache-name: yarn-cache + yarn-cache-path: .yarn + +jobs: + check-lockfile: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Use or update Yarn cache + uses: actions/cache@v3 + with: + path: ${{ env.yarn-cache-path }} + key: ${{ matrix.node-version }}-${{ env.yarn-cache-name }}-${{ hashFiles('**/yarn.lock') }} + - run: yarn --cache-folder=${{ env.yarn-cache-path }} + - run: git diff --quiet -- yarn.lock + + format-check: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14.x] + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Use or update Yarn cache + uses: actions/cache@v3 + with: + path: ${{ env.yarn-cache-path }} + key: ${{ matrix.node-version }}-${{ env.yarn-cache-name }}-${{ hashFiles('**/yarn.lock') }} + - run: yarn --cache-folder=${{ env.yarn-cache-path }} --frozen-lockfile + - run: yarn --cache-folder=${{ env.yarn-cache-path }} format:check + + lint: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [14.x] + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Use or update Yarn cache + uses: actions/cache@v3 + with: + path: ${{ env.yarn-cache-path }} + key: ${{ matrix.node-version }}-${{ env.yarn-cache-name }}-${{ hashFiles('**/yarn.lock') }} + - run: yarn --cache-folder=${{ env.yarn-cache-path }} --frozen-lockfile + - run: yarn --cache-folder=${{ env.yarn-cache-path }} lint + + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Use or update Yarn cache + uses: actions/cache@v3 + with: + path: ${{ env.yarn-cache-path }} + key: ${{ matrix.node-version }}-${{ env.yarn-cache-name }}-${{ hashFiles('**/yarn.lock') }} + - run: yarn --cache-folder=${{ env.yarn-cache-path }} --frozen-lockfile + - run: yarn --cache-folder=${{ env.yarn-cache-path }} build + + test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [18.x] + steps: + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - name: Use or update Yarn cache + uses: actions/cache@v3 + with: + path: ${{ env.yarn-cache-path }} + key: ${{ matrix.node-version }}-${{ env.yarn-cache-name }}-${{ hashFiles('**/yarn.lock') }} + - run: yarn --cache-folder=${{ env.yarn-cache-path }} --frozen-lockfile + - run: yarn --cache-folder=${{ env.yarn-cache-path }} test diff --git a/package.json b/package.json index 725b4ea77..355938915 100644 --- a/package.json +++ b/package.json @@ -24,8 +24,8 @@ "build:dry": "tsc --build --dry", "build:force": "tsc --build --force", "build:watch": "tsc --build --watch", - "format": "prettier --loglevel warn --write '**/*.{graphql,js,json,md,ts}'", - "format:check": "prettier --loglevel warn --check '**/*.{graphql,js,json,md,ts}'", + "format": "prettier --loglevel warn --write '**/*.{graphql,js,json,md,ts,yml}'", + "format:check": "prettier --loglevel warn --check '**/*.{graphql,js,json,md,ts,yml}'", "lint": "support/lint.sh", "test": "jest" }