Skip to content

Commit

Permalink
Fix bundle-install failed on gh-actions.
Browse files Browse the repository at this point in the history
`--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>
  • Loading branch information
cotes2020 committed Nov 22, 2020
1 parent f43bb6c commit b874af2
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 41 deletions.
36 changes: 16 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
35 changes: 14 additions & 21 deletions .github/workflows/pages-deploy.yml.hook
Original file line number Diff line number Diff line change
Expand Up @@ -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
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 config path ${{ env.GEMS_PATH }}
bundle install --jobs 4 --retry 3

- name: Check baseurl
run: |
Expand All @@ -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
Expand Down

0 comments on commit b874af2

Please sign in to comment.