Merge pull request #2847 from hanazuki/patch-1 #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
jobs: | |
ruby-versions: | |
runs-on: ubuntu-latest | |
outputs: | |
versions: ${{ steps.versions.outputs.value }} | |
steps: | |
- id: versions | |
run: | | |
versions=$(curl -s 'https://cache.ruby-lang.org/pub/misc/ci_versions/cruby.json' | jq -c '. + []') | |
echo "value=${versions}" >> $GITHUB_OUTPUT | |
rake: | |
needs: ruby-versions | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }} | |
exclude: | |
- os: macos-latest | |
- os: windows-latest | |
include: | |
- os: macos-latest | |
ruby: head | |
- os: windows-latest | |
ruby: head | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
- name: Install dependencies | |
run: bundle install | |
- name: Run rake | |
run: bundle exec rake | |
- name: Create tarballs | |
if: ${{ runner.os != 'Windows' }} | |
run: | | |
set -ex | |
mkdir /tmp/artifact | |
cd /tmp/html | |
for d in *.*; do | |
tar acf ../artifact/$d.tar.xz $d | |
done | |
- name: Create tarballs | |
if: ${{ runner.os == 'Windows' }} | |
run: | | |
mkdir /tmp/artifact | |
cd /tmp/html | |
ls -Name "*.*" | foreach { | |
tar acf "../artifact/${_}.tar.xz" $_ | |
} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: statichtml-${{ matrix.os }}-${{ matrix.ruby }} | |
path: /tmp/artifact/*.*.tar.xz | |
- name: Rename generated html | |
run: | | |
cd /tmp | |
mv -v html html.pr | |
- name: Checkout base | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.base.sha }} | |
- name: Install dependencies (base) | |
run: bundle install | |
- name: Run rake (base) | |
run: bundle exec rake | |
id: generate_base | |
continue-on-error: true | |
- name: Rename generated html and generate diff | |
run: | | |
cd /tmp | |
mv -v html html.base | |
git diff --no-index html.base html.pr --stat || true | |
git diff --no-index html.base html.pr --output artifact/html.diff || true | |
if: ${{ steps.generate_base.outcome == 'success' }} | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: diff-${{ matrix.os }}-${{ matrix.ruby }} | |
path: /tmp/artifact/html.diff | |
if: ${{ steps.generate_base.outcome == 'success' }} | |
misspell: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install misspell | |
run: 'curl -L https://git.io/misspell | bash' | |
- name: Run misspell | |
run: | | |
git ls-files -z | xargs -0 ./bin/misspell -error -i addopt |