From 40492c77790dca0a269982a631af5aad15161149 Mon Sep 17 00:00:00 2001 From: yoshoku Date: Sun, 28 Jan 2024 10:20:47 +0900 Subject: [PATCH] ci: change to run devDependencies only node-lts --- .github/workflows/build.yml | 4 +- .github/workflows/pull_request.yml | 80 ++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/pull_request.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7deff56..d9e8796 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,9 +4,7 @@ on: push: branches: - main - - develop - pull_request: - types: [opened, reopened, synchronize] + - dev* jobs: build: diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml new file mode 100644 index 0000000..89c55b5 --- /dev/null +++ b/.github/workflows/pull_request.yml @@ -0,0 +1,80 @@ +name: build + +on: pull_request + +jobs: + check_commit: + runs-on: ubuntu-latest + outputs: + skip_ci: ${{ steps.check_commit.outputs.deps_dev }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref }} + - name: Check for devDependencies bump pull request + run: | + echo $(git log --format=%B -n 1 ${{ github.event.pull_request.head.sha }}) | grep -q -F "chore(deps-dev):" + if [ $? -eq 0 ]; then + echo "deps_dev=true" >> $GITHUB_OUTPUT + else + echo "deps_dev=false" >> $GITHUB_OUTPUT + fi + build: + runs-on: ubuntu-latest + strategy: + matrix: + node: ['16', '18', '20'] + needs: check_commit + if: ${{ needs.check_commit.outputs.deps_dev == 'false' }} + steps: + - uses: actions/checkout@v4 + - name: Setup node ${{ matrix.node }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + - name: Install + run: yarn install + - name: Build and test + run: yarn node-gyp rebuild && yarn jest + build-deps-dev: + runs-on: ubuntu-latest + needs: check_commit + if: ${{ needs.check_commit.outputs.deps_dev == 'true' }} + steps: + - uses: actions/checkout@v4 + - name: Setup node lts + uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Install + run: yarn install + - name: Build and test + run: yarn node-gyp rebuild && yarn jest + build-win: + runs-on: windows-latest + needs: check_commit + if: ${{ needs.check_commit.outputs.deps_dev == 'false' }} + steps: + - uses: actions/checkout@v4 + - name: Setup node lts + uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Install + run: yarn install + - name: Build and test + run: yarn node-gyp rebuild && yarn jest + build-mac: + runs-on: macos-latest + needs: check_commit + if: ${{ needs.check_commit.outputs.deps_dev == 'false' }} + steps: + - uses: actions/checkout@v4 + - name: Setup node lts + uses: actions/setup-node@v4 + with: + node-version: lts/* + - name: Install + run: yarn install + - name: Build and test + run: yarn node-gyp rebuild && yarn jest