From b985965bc9d59a92d11610f3bb7a14c714d98650 Mon Sep 17 00:00:00 2001 From: Cotes Chung <11371340+cotes2020@users.noreply.github.com> Date: Mon, 23 Nov 2020 01:26:29 +0800 Subject: [PATCH] Fix bundle-install failed on gh-actions. `--local` option of bundle-install: if an appropriate platform-specific gem exists on rubygems.org it will not be found. see: --- .github/workflows/ci.yml | 36 +++++++++++-------------- .github/workflows/pages-deploy.yml.hook | 35 ++++++++++-------------- 2 files changed, 30 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 39d7623..5ef3fe8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,42 +24,38 @@ jobs: matrix: os: [ubuntu-latest, macos-latest] - steps: - - uses: actions/setup-ruby@v1 - with: - ruby-version: '2.6.x' + env: + GEMS_PATH: ~/vendor/bundle + steps: - name: Checkout uses: actions/checkout@v2 with: - fetch-depth: 0 + fetch-depth: 0 # for posts's lastmod + + - name: Setup Ruby + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.6.x - name: Bundle Caching - id: bundle-cache - uses: actions/cache@v1 + uses: actions/cache@v2 with: - path: vendor/bundle + path: ${{ env.GEMS_PATH }} key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }} restore-keys: | ${{ runner.os }}-gems- - - name: Bundle config - run: | - bundle config path vendor/bundle - - name: Bundle Install - if: steps.bundle-cache.outputs.cache-hit != 'true' run: | - bundle install - - - name: Bundle Install locally - if: steps.bundle-cache.outputs.cache-hit == 'true' - run: | - bundle install --local + bundle config path ${{ env.GEMS_PATH }} + bundle install --jobs 4 --retry 3 - name: Build Site + env: + JEKYLL_ENV: production run: | - JEKYLL_ENV=production bundle exec jekyll b + bundle exec jekyll b - name: Test Site run: | diff --git a/.github/workflows/pages-deploy.yml.hook b/.github/workflows/pages-deploy.yml.hook index dbbe3a0..77aa297 100644 --- a/.github/workflows/pages-deploy.yml.hook +++ b/.github/workflows/pages-deploy.yml.hook @@ -14,40 +14,31 @@ jobs: runs-on: ubuntu-latest env: - GEMS_PATH: /tmp/bundle + GEMS_PATH: ~/vendor/bundle steps: - - uses: actions/setup-ruby@v1 - with: - ruby-version: 2.6.x - - name: Checkout uses: actions/checkout@v2 with: - fetch-depth: 0 + fetch-depth: 0 # for posts's lastmod + + - name: Setup Ruby + uses: actions/setup-ruby@v1 + with: + ruby-version: 2.6.x - name: Bundle Caching - id: bundle-cache - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: ${{ env.GEMS_PATH }} key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile') }} restore-keys: | ${{ runner.os }}-gems- - - name: Bundle config + - name: Bundle Install run: | bundle config path ${{ env.GEMS_PATH }} - - - name: Bundle Install - if: steps.bundle-cache.outputs.cache-hit != 'true' - run: | - bundle install - - - name: Bundle Install locally - if: steps.bundle-cache.outputs.cache-hit == 'true' - run: | - bundle install --local + bundle install --jobs 4 --retry 3 - name: Check baseurl run: | @@ -57,12 +48,14 @@ jobs: fi - name: Build Site + env: + JEKYLL_ENV: production run: | - JEKYLL_ENV=production bundle exec jekyll b + bundle exec jekyll b if [[ -n $SPEC_TEST ]]; then # Bypass the defects of htmlproofer - JEKYLL_ENV=production bundle exec jekyll b -b "" -d "$SPEC_TEST" + bundle exec jekyll b -b "" -d "$SPEC_TEST" fi - name: Test Site