From 3efb9c08aff5790241bbaf334c8fa5711a5e70ba Mon Sep 17 00:00:00 2001 From: nukeop <12746779+nukeop@users.noreply.github.com> Date: Thu, 10 Aug 2023 01:30:41 +0200 Subject: [PATCH 1/5] New combined CI action --- .github/workflows/CI.yml | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/CI.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml new file mode 100644 index 0000000000..490c51ab38 --- /dev/null +++ b/.github/workflows/CI.yml @@ -0,0 +1,60 @@ +name: CI job - new + +on: + push: + branches-ignore: + - crowdin + pull_request: + branches-ignore: + - crowdin + +jobs: + tests: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + timeout-minutes: 30 + + steps: + - uses: actions/checkout@master + - name: Use Node.js 18 + uses: actions/setup-node@master + with: + version: 18 + cache: npm + - name: add git binaries to PATH + if: runner.os == 'Windows' + run: | + echo "C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "C:\Program Files\Git\mingw64\libexec\git-core" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - run: npm ci + - run: npm test + + build: + runs-on: ${{ matrix.os }} + needs: tests + strategy: + matrix: + os: ["ubuntu-latest", "macos-latest", "windows-latest"] + cmd: ["build:linux", "build:macos", "build:windows"] + steps: + - uses: actions/checkout@master + - name: get-npm-version + id: package-version + uses: pchynoweth/action-get-npm-version@1.1.1 + - name: Use Node.js 18 + uses: actions/setup-node@master + with: + version: 18 + cache: npm + - name: add git binaries to PATH + if: runner.os == 'Windows' + run: | + echo "C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "C:\Program Files\Git\mingw64\libexec\git-core" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + - run: npm ci + - run: npm run ${{ matrix.cmd }} + shell: bash + env: + VERSION: ${{ steps.package-version.outputs.version}} From 44852a0be8710136510c905fad83c40dcbbe39fb Mon Sep 17 00:00:00 2001 From: nukeop <12746779+nukeop@users.noreply.github.com> Date: Thu, 10 Aug 2023 01:40:20 +0200 Subject: [PATCH 2/5] Add more caching --- .github/workflows/CI.yml | 42 ++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 490c51ab38..75df96c477 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -17,12 +17,27 @@ jobs: timeout-minutes: 30 steps: - - uses: actions/checkout@master + - name: Checkout code + uses: actions/checkout@v2 + - name: Cache npm packages + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - name: Use Node.js 18 - uses: actions/setup-node@master + uses: actions/setup-node@v2 with: version: 18 - cache: npm + cache: "npm" + - name: Cache Node modules + uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- - name: add git binaries to PATH if: runner.os == 'Windows' run: | @@ -39,15 +54,30 @@ jobs: os: ["ubuntu-latest", "macos-latest", "windows-latest"] cmd: ["build:linux", "build:macos", "build:windows"] steps: - - uses: actions/checkout@master + - name: Checkout code + uses: actions/checkout@v2 - name: get-npm-version id: package-version uses: pchynoweth/action-get-npm-version@1.1.1 + - name: Cache npm packages + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - name: Use Node.js 18 - uses: actions/setup-node@master + uses: actions/setup-node@v2 with: version: 18 - cache: npm + cache: "npm" + - name: Cache Node modules + uses: actions/cache@v2 + with: + path: node_modules + key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-npm- - name: add git binaries to PATH if: runner.os == 'Windows' run: | From 624c133cdfe3cbb394712f8d0fdcb2624991151e Mon Sep 17 00:00:00 2001 From: nukeop <12746779+nukeop@users.noreply.github.com> Date: Thu, 10 Aug 2023 01:44:16 +0200 Subject: [PATCH 3/5] Separate lint, test, and build scripts --- .github/workflows/CI.yml | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 75df96c477..0469a42c73 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -44,6 +44,7 @@ jobs: echo "C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append echo "C:\Program Files\Git\mingw64\libexec\git-core" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - run: npm ci + - run: npm run lint - run: npm test build: diff --git a/package.json b/package.json index 44e7c0ae13..9f4e6c061d 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "postinstall": "lerna bootstrap --hoist && electron-builder install-app-deps", "start": "lerna run start --stream", "build": "shx rm -rf dist && lerna run build && npm run pack", - "test": "lerna run lint && lerna run build && lerna run test", + "test": "lerna run test", "coverage": "lerna run coverage", "lint": "lerna run lint", "lint:fix": "lerna run lint:fix", From ef2f8e71f9459d85ba595bf877f5983574235200 Mon Sep 17 00:00:00 2001 From: nukeop <12746779+nukeop@users.noreply.github.com> Date: Thu, 10 Aug 2023 01:54:10 +0200 Subject: [PATCH 4/5] Ignore markdown changes --- .github/workflows/CI.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 0469a42c73..b5542b4f1e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -4,9 +4,13 @@ on: push: branches-ignore: - crowdin + paths-ignore: + - "**/*.md" pull_request: branches-ignore: - crowdin + paths-ignore: + - "**/*.md" jobs: tests: From b7da5e54a9ba9ff7ae0e71fb4397cda8c981d003 Mon Sep 17 00:00:00 2001 From: nukeop <12746779+nukeop@users.noreply.github.com> Date: Thu, 10 Aug 2023 02:03:09 +0200 Subject: [PATCH 5/5] Run each build command on its respective OS --- .github/workflows/CI.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b5542b4f1e..484077876a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -52,12 +52,16 @@ jobs: - run: npm test build: - runs-on: ${{ matrix.os }} + runs-on: ${{ matrix.platform.os }} needs: tests strategy: matrix: - os: ["ubuntu-latest", "macos-latest", "windows-latest"] - cmd: ["build:linux", "build:macos", "build:windows"] + platform: + [ + { os: "ubuntu-latest", cmd: "build:linux" }, + { os: "macos-11", cmd: "build:macos" }, + { os: "windows-latest", cmd: "build:windows" }, + ] steps: - name: Checkout code uses: actions/checkout@v2 @@ -89,7 +93,7 @@ jobs: echo "C:\Program Files\Git\usr\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append echo "C:\Program Files\Git\mingw64\libexec\git-core" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - run: npm ci - - run: npm run ${{ matrix.cmd }} + - run: npm run ${{ matrix.platform.cmd }} shell: bash env: VERSION: ${{ steps.package-version.outputs.version}}