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: <https://bundler.io/v2.1/man/bundle-install.1.html>
This commit is contained in:
Cotes Chung 2020-11-23 01:26:29 +08:00
parent a5b002b2d8
commit b985965bc9
2 changed files with 30 additions and 41 deletions

View File

@ -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: |

View File

@ -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