From 255fe55298b2bd5b4e6db404a27287670a5bb3df Mon Sep 17 00:00:00 2001 From: Pavlo Buidenkov Date: Wed, 20 Jan 2021 19:33:47 +0200 Subject: [PATCH] =?UTF-8?q?build=20and=20cache=20fixed!=20=F0=9F=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{test.yml => build-and-test.yml} | 51 ++++++++++++------- .github/workflows/codecov.yml | 45 +++++++++++----- .github/workflows/release.yml | 39 +++++++++----- package.json | 2 +- 4 files changed, 92 insertions(+), 45 deletions(-) rename .github/workflows/{test.yml => build-and-test.yml} (52%) diff --git a/.github/workflows/test.yml b/.github/workflows/build-and-test.yml similarity index 52% rename from .github/workflows/test.yml rename to .github/workflows/build-and-test.yml index 70525db..5cb4480 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/build-and-test.yml @@ -2,34 +2,52 @@ name: build and test on: [pull_request] -# NPMRC_ADMIN_USER_AUTH_TOKEN - jobs: build-and-test: runs-on: ${{ matrix.os }} strategy: matrix: - os: [macos-10.15, windows-2019, ubuntu-18.04] + os: [macos-10.15, windows-2019, ubuntu-18.04] # IMPORTANT!!! here ubuntu-18.04 should be same as in codecov and release workflows, this is for making shure cahes used in most efficient way steps: - name: Check out Git repository - uses: actions/checkout@v2.3.1 + uses: actions/checkout@v2.3.4 - - name: install yarn dependencies in app/client using cache - uses: bahmutov/npm-install@v1.6.0 + - name: Setup Node.js environment + uses: actions/setup-node@v2.1.4 with: - working-directory: ./app/client + node-version: '12' - - name: install yarn dependencies in ./ using cache - uses: bahmutov/npm-install@v1.6.0 - with: - working-directory: ./ + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" - - name: install yarn dependencies in ./app using cache - uses: bahmutov/npm-install@v1.6.0 + - uses: actions/cache@v2.1.3 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: - working-directory: ./app + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ matrix.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ matrix.os }}-yarn- + + - name: yarn install in ./app/client + run: | + cd ./app/client + yarn install + + - name: yarn install in ./ + run: yarn install + + - name: yarn install in ./app + run: | + cd ./app + yarn install + + - name: yarn build + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: yarn build # following step does code signing when `electron-builder --publish always` (look in package.json) - name: yarn package-ci @@ -37,11 +55,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: yarn package-ci - - name: yarn build - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: yarn build - - name: yarn lint env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index b6d1a9b..13ff77f 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -1,29 +1,48 @@ -name: codecov generate +name: codecov + on: [pull_request] + jobs: run: - runs-on: ubuntu-18.04 + runs-on: ubuntu-18.04 # IMPORTANT!!! this LINUX os should be the same as in build-and-test and release workflows! this is for making shure cahes used in most efficient way steps: - name: Check out Git repository - uses: actions/checkout@v2.3.1 + uses: actions/checkout@v2.3.4 - - name: install yarn dependencies in app/client using cache - uses: bahmutov/npm-install@v1.6.0 + - name: Setup Node.js environment + uses: actions/setup-node@v2.1.4 with: - working-directory: ./app/client + node-version: '12' - - name: install yarn dependencies in ./ using cache - uses: bahmutov/npm-install@v1.6.0 - with: - working-directory: ./ + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" - - name: install yarn dependencies in ./app using cache - uses: bahmutov/npm-install@v1.6.0 + - uses: actions/cache@v2.1.3 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: - working-directory: ./app + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ubuntu-18.04-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ubuntu-18.04-yarn- + + - name: yarn install in ./app/client + run: | + cd ./app/client + yarn install + + - name: yarn install in ./ + run: yarn install + + - name: yarn install in ./app + run: | + cd ./app + yarn install - name: yarn build + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: yarn build - name: yarn test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4a10ff9..55e0f12 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,7 +30,7 @@ jobs: strategy: matrix: include: - - os: ubuntu-18.04 + - os: ubuntu-18.04 # IMPORTANT!!! this LINUX os should be the same as in build-and-test and covecov workflows! this is for making shure cahes used in most efficient way artifact_name: 'release/{*.AppImage,*.rpm,*.deb,*.yml}' - os: windows-2019 artifact_name: 'release/{*.msi,*.exe,*.blockmap,*.yml}' @@ -39,22 +39,37 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2.3.1 + uses: actions/checkout@v2.3.4 - - name: install yarn dependencies in app/client using cache - uses: bahmutov/npm-install@v1.6.0 + - name: Setup Node.js environment + uses: actions/setup-node@v2.1.4 with: - working-directory: ./app/client + node-version: '12' - - name: install yarn dependencies in ./ using cache - uses: bahmutov/npm-install@v1.6.0 - with: - working-directory: ./ + - name: Get yarn cache directory path + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" - - name: install yarn dependencies in ./app using cache - uses: bahmutov/npm-install@v1.6.0 + - uses: actions/cache@v2.1.3 + id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) with: - working-directory: ./app + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ matrix.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ matrix.os }}-yarn- + + - name: yarn install in ./app/client + run: | + cd ./app/client + yarn install + + - name: yarn install in ./ + run: yarn install + + - name: yarn install in ./app + run: | + cd ./app + yarn install - name: yarn build env: diff --git a/package.json b/package.json index f6ee223..ef14184 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "version": "1.0.0", "description": "Deskreen makes any device a second screen for your computer", "scripts": { - "build": "yarn build-main && yarn build-renderer && yarn build-client", + "build": "yarn build-client && yarn build-main && yarn build-renderer", "build-test": "yarn build-main-test && yarn build-renderer-test && yarn build-client", "build-dll": "cross-env NODE_ENV=development webpack --config ./configs/webpack.config.renderer.dev.dll.babel.js --colors", "build-e2e": "cross-env E2E_BUILD=true yarn build",