diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index 2e3e31c12fab8e566d51a65e02886b1132893321..3b0103b264451fb65fb571585faac72c88dfc33f 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -4,9 +4,6 @@ on: pull_request: env: - YARN_MODULES_CACHE_KEY: v1 - YARN_PACKAGE_CACHE_KEY: v1 - YARN_CACHE_FOLDER: .cache/yarn NODE_VERSION: 14 PYTHON_VERSION: 3.9 SKIP_JAVA_TESTS: true @@ -19,10 +16,15 @@ jobs: timeout-minutes: 30 steps: + - uses: actions/checkout@v2.3.4 + with: + fetch-depth: 2 + - name: Set up Node.js ${{ env.NODE_VERSION }} uses: actions/setup-node@v2.2.0 with: node-version: ${{ env.NODE_VERSION }} + cache: yarn - name: Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v2.2.2 @@ -41,24 +43,6 @@ jobs: python --version echo "Yarn $(yarn --version)" - - uses: actions/checkout@v2.3.4 - with: - fetch-depth: 2 - - - name: Cache Yarn packages - id: yarn_cache_packages - uses: actions/cache@v2.1.6 - with: - path: ${{ env.YARN_CACHE_FOLDER }} - key: ${{ env.YARN_PACKAGE_CACHE_KEY }}-${{ runner.os }}-yarn_cache-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ env.YARN_PACKAGE_CACHE_KEY }}-${{ runner.os }}-yarn_cache- - - # Clear caches on cache miss, otherwise they will grow indefinitely - - name: Clear yarn cache - if: steps.yarn_cache_packages.outputs.cache-hit != 'true' - run: yarn cache clean - - name: Installing dependencies run: yarn install --frozen-lockfile @@ -83,10 +67,15 @@ jobs: timeout-minutes: 15 steps: + - uses: actions/checkout@v2.3.4 + with: + fetch-depth: 2 + - name: Set up Node.js ${{ env.NODE_VERSION }} uses: actions/setup-node@v2.2.0 with: node-version: ${{ env.NODE_VERSION }} + cache: yarn - name: Init platform run: | @@ -98,22 +87,6 @@ jobs: echo "Node $(node --version)" echo "Yarn $(yarn --version)" - - uses: actions/checkout@v2.3.4 - - - name: Cache Yarn packages - id: yarn_cache_packages - uses: actions/cache@v2.1.6 - with: - path: ${{ env.YARN_CACHE_FOLDER }} - key: ${{ env.YARN_PACKAGE_CACHE_KEY }}-${{ runner.os }}-yarn_cache-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ env.YARN_PACKAGE_CACHE_KEY }}-${{ runner.os }}-yarn_cache- - - # Clear caches on cache miss, otherwise they will grow indefinitely - - name: Clear yarn cache - if: steps.yarn_cache_packages.outputs.cache-hit != 'true' - run: yarn cache clean - - name: Installing dependencies run: yarn install --frozen-lockfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b15e5a8566eecefb3575f9d707d4aebe466d6b9..dfe425e2af180b61bbd9c390a0f871867d25131f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,13 +11,11 @@ on: dryRun: description: 'Dry-Run' default: 'true' + required: false env: # Currently no way to detect automatically (#8153) DEFAULT_BRANCH: main - YARN_MODULES_CACHE_KEY: v1 - YARN_PACKAGE_CACHE_KEY: v1 - YARN_CACHE_FOLDER: .cache/yarn NODE_VERSION: 14 DRY_RUN: true @@ -42,10 +40,15 @@ jobs: JAVA_VERSION: ${{ matrix.java-version }} steps: + - uses: actions/checkout@v2.3.4 + with: + fetch-depth: 2 + - name: Set up Node.js ${{ env.NODE_VERSION }} uses: actions/setup-node@v2.2.0 with: node-version: ${{ env.NODE_VERSION }} + cache: yarn - name: Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v2.2.2 @@ -77,24 +80,6 @@ jobs: python --version echo "Yarn $(yarn --version)" - - uses: actions/checkout@v2.3.4 - with: - fetch-depth: 2 - - - name: Cache Yarn packages - id: yarn_cache_packages - uses: actions/cache@v2.1.6 - with: - path: ${{ env.YARN_CACHE_FOLDER }} - key: ${{ env.YARN_PACKAGE_CACHE_KEY }}-${{ runner.os }}-yarn_cache-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ env.YARN_PACKAGE_CACHE_KEY }}-${{ runner.os }}-yarn_cache- - - # Clear caches on cache miss, otherwise they will grow indefinitely - - name: Clear yarn cache - if: steps.yarn_cache_packages.outputs.cache-hit != 'true' - run: yarn cache clean - - name: Installing dependencies run: yarn install --frozen-lockfile @@ -120,10 +105,15 @@ jobs: timeout-minutes: 15 steps: + - uses: actions/checkout@v2.3.4 + with: + fetch-depth: 2 + - name: Set up Node.js ${{ env.NODE_VERSION }} uses: actions/setup-node@v2.2.0 with: node-version: ${{ env.NODE_VERSION }} + cache: yarn - name: Init platform run: | @@ -135,22 +125,6 @@ jobs: echo "Node $(node --version)" echo "Yarn $(yarn --version)" - - uses: actions/checkout@v2.3.4 - - - name: Cache Yarn packages - id: yarn_cache_packages - uses: actions/cache@v2.1.6 - with: - path: ${{ env.YARN_CACHE_FOLDER }} - key: ${{ env.YARN_PACKAGE_CACHE_KEY }}-${{ runner.os }}-yarn_cache-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ env.YARN_PACKAGE_CACHE_KEY }}-${{ runner.os }}-yarn_cache- - - # Clear caches on cache miss, otherwise they will grow indefinitely - - name: Clear yarn cache - if: steps.yarn_cache_packages.outputs.cache-hit != 'true' - run: yarn cache clean - - name: Installing dependencies run: yarn install --frozen-lockfile @@ -174,10 +148,16 @@ jobs: timeout-minutes: 15 steps: + # full checkout for semantic-release + - uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 + - name: Set up Node.js ${{ env.NODE_VERSION }} uses: actions/setup-node@v2.2.0 with: node-version: ${{ env.NODE_VERSION }} + cache: yarn - name: Init platform run: | @@ -198,17 +178,6 @@ jobs: echo "DRY_RUN=false" >> $GITHUB_ENV fi - # full checkout for semantic-release - - uses: actions/checkout@v2.3.4 - with: - fetch-depth: 0 - - - name: Cache Yarn packages - uses: actions/cache@v2.1.6 - with: - path: ${{ env.YARN_CACHE_FOLDER }} - key: ${{ env.YARN_PACKAGE_CACHE_KEY }}-${{ runner.os }}-yarn_cache-${{ hashFiles('**/yarn.lock') }} - - name: Installing dependencies run: yarn install --frozen-lockfile diff --git a/.github/workflows/release-npm.yml b/.github/workflows/release-npm.yml index fc6f95ead5fc8ae450afb3d293741a772ea75ca6..400cfaa83994a2b0ac7ffdd5d65dd9ce72c23d31 100644 --- a/.github/workflows/release-npm.yml +++ b/.github/workflows/release-npm.yml @@ -15,11 +15,9 @@ on: tag: description: 'Npm dist-tag' default: 'latest' + required: false env: - YARN_MODULES_CACHE_KEY: v1 - YARN_PACKAGE_CACHE_KEY: v1 - YARN_CACHE_FOLDER: .cache/yarn NODE_VERSION: 14 GIT_SHA: ${{ github.event.client_payload.sha }} NPM_VERSION: ${{ github.event.client_payload.version }} @@ -29,20 +27,6 @@ jobs: release-npm: runs-on: ubuntu-latest steps: - - name: Set up Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v2.2.0 - with: - node-version: ${{ env.NODE_VERSION }} - - - name: Init platform - run: | - git config --global core.autocrlf false - git config --global core.symlinks true - git config --global user.email 'renovate@whitesourcesoftware.com' - git config --global user.name 'Renovate Bot' - yarn config set version-git-tag false - npm config set scripts-prepend-node-path true - - name: Prepare env run: | if [[ "${{github.event_name}}" == "workflow_dispatch" ]]; then @@ -55,12 +39,20 @@ jobs: with: ref: ${{ env.GIT_SHA }} - - name: Cache Yarn packages - id: yarn_cache_packages - uses: actions/cache@v2.1.6 + - name: Set up Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v2.2.0 with: - path: ${{ env.YARN_CACHE_FOLDER }} - key: ${{ env.YARN_PACKAGE_CACHE_KEY }}-${{ runner.os }}-yarn_cache-${{ hashFiles('**/yarn.lock') }} + node-version: ${{ env.NODE_VERSION }} + cache: yarn + + - name: Init platform + run: | + git config --global core.autocrlf false + git config --global core.symlinks true + git config --global user.email 'renovate@whitesourcesoftware.com' + git config --global user.name 'Renovate Bot' + yarn config set version-git-tag false + npm config set scripts-prepend-node-path true - name: Installing dependencies run: yarn install --frozen-lockfile