Skip to content

Commit

Permalink
consolidate CI files, updates Ruby and Node versions (#820)
Browse files Browse the repository at this point in the history
This is a PR with three key changes:

1. Consolidate two identical CI files, `ci.yml` and `ci-master.yml` into one file
2. Consolidate two almost-identical jobs (`jekyll-build-*`) into one job with a strategy matrix
3. Update various dependencies/platforms
    * Node: `12.x` -> `16.x` (only in CI); `12.x` has been EOL for a while
    * Ruby: `2.6` -> `2.7`; `2.6` just reached EOL
    * `actions/checkout` -> `v2` -> `v3`
    * switches `jekyll/builder` to `jekyll/jekyll`, since we don't actually use any of the features in `jekyll/builder`

## on our CI philosophy

In working on this, I have a couple of questions:

1. We don't actually use our `Dockerfile` that we provide. Does this make sense? Should we be running CI with this instead?
2. Is there a specific reason that we're using `jekyll/jekyll`? Notably, this isn't an official package, but a community-driven one. Does it match what's used by GitHub Pages?
3. Do we have to use any docker image at all? For example, what if we just rely on the `setup-ruby` action?
    * one advantage of this is that it's much easier for us to test across multiple OS versions; we just need to have a strategy matrix for OS and do windows, macos, ubuntu, etc.
    * another advantage is that we can easily test different ruby versions in conjunction with different jekyll versions

Eventually, I would like to see us test across:

* different Jekyll versions
* different OSes
* different Ruby versions

but perhaps that might be too aggressive. Happy for any feedback on this PR or those questions!
  • Loading branch information
mattxwang authored Jul 23, 2022
1 parent ba472b9 commit 2049ebc
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 70 deletions.
42 changes: 0 additions & 42 deletions .github/workflows/ci-master.yml

This file was deleted.

48 changes: 23 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,42 @@
on: [pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main
- 'v**'

name: CI

jobs:

jekyll-latest:
name: Build Jekyll site (latest)
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v2

- name: Build the site in the jekyll/builder container
run: |
docker run --rm \
--volume="${{ github.workspace }}:/srv/jekyll" \
jekyll/builder:latest /bin/bash -c "gem install bundler && chmod -R 777 /srv/jekyll && bundle install && bundle exec jekyll build && bundle exec rake search:init"
jekyll-3-8-5:
name: Build Jekyll site (v3.8.5)
jekyll-build:
name: Build Jekyll site
runs-on: ubuntu-latest
strategy:
matrix:
jekyll-version: [3.8.5, latest]
steps:

- uses: actions/checkout@v2

- name: Build the site in the jekyll/builder container
- uses: actions/checkout@v3
- name: Build the site in the jekyll/jekyll container
run: |
docker run --rm \
--volume="${{ github.workspace }}:/srv/jekyll" \
jekyll/builder:3.8.5 /bin/bash -c "gem install bundler && chmod -R 777 /srv/jekyll && bundle install && bundle exec jekyll build && bundle exec rake search:init"
jekyll/jekyll:${{ matrix.jekyll-version }} /bin/bash -c "gem install bundler && chmod -R 777 /srv/jekyll && bundle install && bundle exec jekyll build && bundle exec rake search:init"
assets:
name: Test CSS and JS
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: '12.x'
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.6
FROM ruby:2.7

ENV LC_ALL C.UTF-8
ENV LANG en_US.UTF-8
Expand All @@ -10,4 +10,3 @@ COPY Gemfile just-the-docs.gemspec ./
RUN gem install bundler && bundle install

EXPOSE 4000

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<p align="right">
<a href="https://badge.fury.io/rb/just-the-docs"><img src="https://badge.fury.io/rb/just-the-docs.svg" alt="Gem version"></a> <a href="https://github.com/just-the-docs/just-the-docs/actions?query=workflow%3A%22main+branch+CI%22"><img src="https://github.com/just-the-docs/just-the-docs/workflows/main%20branch%20CI/badge.svg" alt="Build status"></a> <a href="https://app.netlify.com/sites/just-the-docs/deploys"><img src="https://api.netlify.com/api/v1/badges/9dc0386d-c2a4-4077-ad83-f02c33a6c0ca/deploy-status" alt="Netlify Status"></a>
<a href="https://badge.fury.io/rb/just-the-docs"><img src="https://badge.fury.io/rb/just-the-docs.svg" alt="Gem version"></a> <a href="https://github.com/just-the-docs/just-the-docs/actions/workflows/ci.yml"><img src="https://github.com/just-the-docs/just-the-docs/actions/workflows/ci.yml/badge.svg" alt="CI Build status"></a> <a href="https://app.netlify.com/sites/just-the-docs/deploys"><img src="https://api.netlify.com/api/v1/badges/9dc0386d-c2a4-4077-ad83-f02c33a6c0ca/deploy-status" alt="Netlify Status"></a>
</p>
<br><br>
<p align="center">
Expand Down

0 comments on commit 2049ebc

Please sign in to comment.