Merge pull request #182 from znz/add-devcontainer #160
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: test | |
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 | |
build: | |
needs: ruby-versions | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
- name: Install dependencies | |
run: bundle install | |
- name: Run test | |
run: bundle exec rake | |
rurema: | |
needs: ruby-versions | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# NOTE: rurema/doctreeは2.5+しかサポートしていない | |
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: 'bitclust' | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'rurema/doctree' | |
path: 'doctree' | |
ref: 'master' | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
- name: Install dependencies | |
run: bundle install | |
working-directory: ./doctree | |
- name: Run rake | |
run: bundle exec rake | |
working-directory: ./doctree | |
- name: Create tarballs | |
run: | | |
set -ex | |
mkdir /tmp/artifact | |
cd /tmp/html | |
for d in *.*; do | |
tar acf ../artifact/$d.tar.xz $d | |
done | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: statichtml-ubuntu-latest-${{ matrix.ruby }} | |
path: /tmp/artifact/*.tar.xz | |
- name: Rename generated html | |
run: | | |
cd /tmp | |
mv -v html html.pr | |
- uses: actions/checkout@v4 | |
with: | |
path: 'bitclust' | |
ref: ${{ github.event.pull_request.base.sha }} | |
- name: Install dependencies | |
run: bundle install | |
working-directory: ./doctree | |
- name: Run rake | |
run: bundle exec rake | |
working-directory: ./doctree | |
- 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 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: diff-ubuntu-latest-${{ matrix.ruby }} | |
path: /tmp/artifact/html.diff |