From c0a0aa8105251cebc35ab807e6d701806f5b301d Mon Sep 17 00:00:00 2001 From: Vijay A Date: Wed, 30 Jun 2021 08:20:01 +0530 Subject: Split up the dependency updates into its own scheduled job and to be run on the 'develop' branch instead of 'nightly' branch --- .github/workflows/dependency-updates.yml | 63 ++++++++++++++++++++++++++++++++ .github/workflows/ferdi-builds.yml | 17 ++------- 2 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/dependency-updates.yml (limited to '.github') diff --git a/.github/workflows/dependency-updates.yml b/.github/workflows/dependency-updates.yml new file mode 100644 index 000000000..61e22c03a --- /dev/null +++ b/.github/workflows/dependency-updates.yml @@ -0,0 +1,63 @@ +# This workflow will do a clean install of ferdi dev-dependencies, update the dependencies, build the source code and run tests. It will only run on scheduled trigger. + +name: Ferdi Dependency updates + +on: + schedule: + - cron: '0 0 * * *' # every night at 12 am + +env: + USE_HARD_LINKS: false + +jobs: + dependency_updates: + runs-on: ubuntu-latest + steps: + - name: Set env vars + run: | + echo "NPM_CACHE=$HOME/.npm" >> $GITHUB_ENV + - name: Checkout code along with submodules + uses: actions/checkout@v2 + with: + submodules: recursive + fetch-depth: 0 + - name: Cache node modules + uses: actions/cache@v2 + env: + cache-name: cache-node-modules + with: + path: ${{ env.NPM_CACHE }} + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: Use Node.js 14.16.1 + uses: actions/setup-node@v2 + with: + node-version: 14.16.1 + - name: Uninstall locally and reinstall node-gyp globally + run: | + npm uninstall node-gyp + npm i -g node-gyp@8.0.0 && npm config set node_gyp "$(which node-gyp)" + - name: Install node dependencies recursively + run: npx lerna bootstrap + - name: Setup git configs + run: | + git config user.name github-actions + git config user.email github-actions@github.com + - name: Update submodules, dependencies and run tests + run: | + echo "Updating submodules" + git submodule update --remote -f + + echo "Updating browserslist db" + npx browserslist@latest --update-db + + echo "Running linter and tests" + npm run lint + npm run test + + echo "Committing and pushing submodules, dependency-updates and linter changes" + git commit -am "Update submodules, browserslist data updates and linter fixes [skip ci]" --no-verify || true + git push origin nightly --no-verify diff --git a/.github/workflows/ferdi-builds.yml b/.github/workflows/ferdi-builds.yml index 35182c222..e93e8b8f9 100644 --- a/.github/workflows/ferdi-builds.yml +++ b/.github/workflows/ferdi-builds.yml @@ -24,7 +24,7 @@ on: description: 'Message for build' required: true schedule: - - cron: '0 0 * * *' # every night at 12 am + - cron: '0 1 * * *' # every night at 1 am (to allow for dependency builds to complete) env: USE_HARD_LINKS: false @@ -103,25 +103,14 @@ jobs: if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }} continue-on-error: true run: git merge --no-ff --no-verify --commit -m "Merge remote-tracking branch 'origin/develop' into HEAD" origin/develop - - name: Update submodules (continue if errored) + - id: should_run + name: Check whether there are any commits since this run was last triggered and either push or set the output if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }} - continue-on-error: true run: | - echo "Updating submodules" - git submodule update --remote -f - git commit -am "Update submodules" --no-verify || true - echo "Running linter and tests" npm run lint && npm run test git commit -am "Apply linter fixes" --no-verify || true - echo "Updating browserslist db" - npx browserslist@latest --update-db - git commit -am "Apply browserslist data updates" --no-verify || true - - id: should_run - name: Check whether there are any commits since this run was last triggered and either push or set the output - if: ${{ github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && contains(github.event.inputs.message, 'nightly branch')) }} - run: | CHANGES_COUNT=$(git diff --shortstat origin/nightly | wc -l) MANUAL_REBUILD="${{ github.event_name == 'workflow_dispatch' }}" echo "Number of changes: $CHANGES_COUNT" -- cgit v1.2.3-54-g00ecf