From cae69c1740b0b748fca17e4b1f589b323cff33a3 Mon Sep 17 00:00:00 2001 From: zackad Date: Wed, 21 Feb 2024 06:35:54 +0700 Subject: [PATCH] ci: optimize ci configuration Changes: - install compatible version of eslint plugin for prettier - remove lowest version of prettier - allow latest version of prettier 3 to be installed - enable experimental feature of esm for nodejs, required for prettier 3 --- .github/workflows/ci.yaml | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2749cf17..d37050ff 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -6,6 +6,9 @@ on: - master pull_request: +env: + NODE_OPTIONS: --experimental-vm-modules + jobs: test: name: Test @@ -13,20 +16,29 @@ jobs: strategy: fail-fast: false matrix: - node_version: [18, 20] - prettier_version: ["2.3.0", "^2.3.0", "3.0.0"] + node_version: [ 18, 20 ] + prettier_version: [ "^2.3.0", "^3.0.0" ] + eslint_plugin_prettier_version: [ "^4.0.0", "^5.0.0" ] + exclude: + - prettier_version: ^2.3.0 + eslint_plugin_prettier_version: ^5.0.0 + - prettier_version: ^3.0.0 + eslint_plugin_prettier_version: ^4.0.0 steps: - - name: Checkout - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node_version }} + cache: "yarn" - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node_version }} - cache: "yarn" + - name: Install Prettier + run: yarn add prettier@${{ matrix.prettier_version }} - - name: Install Dependencies - run: yarn add prettier@${{ matrix.prettier_version }} + - name: Install Eslint plugin for prettier + run: yarn add --dev eslint-plugin-prettier@${{ matrix.eslint_plugin_prettier_version }} - - name: Run Test - run: yarn test + - name: Run Test + run: yarn test