Skip to content

Commit 5c2f66f

Browse files
authored
Merge pull request riscv#1918 from arichardson/pre-commit-ci
Add pre-commit hooks to CI
2 parents ee6fbb5 + 94f8697 commit 5c2f66f

File tree

230 files changed

+1200
-1255
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

230 files changed

+1200
-1255
lines changed

.github/workflows/check-ready-to-merge.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
name: 'Check Mergeable by Label'
1+
---
2+
name: Check Mergeable by Label
23

34
on:
45
pull_request:

.github/workflows/isa-build.yml

Lines changed: 98 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
1+
---
12
name: RISC-V ISA Build
23

34
on:
45
workflow_dispatch:
56
inputs:
67
create_release:
7-
description: 'Create a new RISC-V ISA release if set to true'
8+
description: Create a new RISC-V ISA release if set to true
89
required: false
910
default: 'false'
1011
target_branch:
11-
description: 'Target Branch'
12+
description: Target Branch
1213
required: true
13-
default: 'main'
14+
default: main
1415
release_notes:
15-
description: 'Release Notes'
16+
description: Release Notes
1617
required: false
1718
push:
1819
branches:
@@ -27,121 +28,121 @@ jobs:
2728

2829
steps:
2930
# Checkout the repository
30-
- name: Checkout repository
31-
uses: actions/checkout@v4
32-
with:
33-
submodules: recursive
34-
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
with:
34+
submodules: recursive
35+
3536
# Set the short SHA for use in artifact names
36-
- name: Set short SHA
37-
run: echo "SHORT_SHA=$(echo ${GITHUB_SHA::7})" >> $GITHUB_ENV
38-
37+
- name: Set short SHA
38+
run: echo "SHORT_SHA=$(echo ${GITHUB_SHA::7})" >> $GITHUB_ENV
39+
3940
# Get the current date
40-
- name: Get current date
41-
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
41+
- name: Get current date
42+
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
4243

4344
# Pull the latest RISC-V Docs container image
4445
# https://github.com/riscv/riscv-docs-base-container-image
4546
# https://hub.docker.com/r/riscvintl/riscv-docs-base-container-image
46-
- name: Pull Container
47-
id: pull_container_image
48-
run: docker pull riscvintl/riscv-docs-base-container-image:latest
47+
- name: Pull Container
48+
id: pull_container_image
49+
run: docker pull riscvintl/riscv-docs-base-container-image:latest
4950

5051
# Build PDF and HTML files using the container
51-
- name: Build Files
52-
id: build_files
53-
if: steps.pull_container_image.outcome == 'success'
54-
run: |
55-
docker run --rm -v ${{ github.workspace }}:/build riscvintl/riscv-docs-base-container-image:latest \
56-
/bin/sh -c "make -j$(nproc)"
52+
- name: Build Files
53+
id: build_files
54+
if: steps.pull_container_image.outcome == 'success'
55+
run: |
56+
docker run --rm -v ${{ github.workspace }}:/build riscvintl/riscv-docs-base-container-image:latest \
57+
/bin/sh -c "make -j$(nproc)"
5758
5859
# Upload the riscv-privileged PDF file
59-
- name: Upload riscv-privileged.pdf
60-
if: steps.build_files.outcome == 'success'
61-
uses: actions/upload-artifact@v4
62-
with:
63-
name: riscv-privileged-${{ env.SHORT_SHA }}.pdf
64-
path: ${{ github.workspace }}/build/riscv-privileged.pdf
65-
retention-days: 7
60+
- name: Upload riscv-privileged.pdf
61+
if: steps.build_files.outcome == 'success'
62+
uses: actions/upload-artifact@v4
63+
with:
64+
name: riscv-privileged-${{ env.SHORT_SHA }}.pdf
65+
path: ${{ github.workspace }}/build/riscv-privileged.pdf
66+
retention-days: 7
6667

6768
# Upload the riscv-privileged HTML file
68-
- name: Upload riscv-privileged.html
69-
if: steps.build_files.outcome == 'success'
70-
uses: actions/upload-artifact@v4
71-
with:
72-
name: riscv-privileged-${{ env.SHORT_SHA }}.html
73-
path: ${{ github.workspace }}/build/riscv-privileged.html
74-
retention-days: 7
69+
- name: Upload riscv-privileged.html
70+
if: steps.build_files.outcome == 'success'
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: riscv-privileged-${{ env.SHORT_SHA }}.html
74+
path: ${{ github.workspace }}/build/riscv-privileged.html
75+
retention-days: 7
7576

7677
# Upload the riscv-privileged EPUB file
77-
- name: Upload riscv-privileged.epub
78-
if: steps.build_files.outcome == 'success'
79-
uses: actions/upload-artifact@v4
80-
with:
81-
name: riscv-privileged-${{ env.SHORT_SHA }}.epub
82-
path: ${{ github.workspace }}/build/riscv-privileged.epub
83-
retention-days: 7
78+
- name: Upload riscv-privileged.epub
79+
if: steps.build_files.outcome == 'success'
80+
uses: actions/upload-artifact@v4
81+
with:
82+
name: riscv-privileged-${{ env.SHORT_SHA }}.epub
83+
path: ${{ github.workspace }}/build/riscv-privileged.epub
84+
retention-days: 7
8485

8586
# Upload the riscv-unprivileged PDF file
86-
- name: Upload riscv-unprivileged.pdf
87-
if: steps.build_files.outcome == 'success'
88-
uses: actions/upload-artifact@v4
89-
with:
90-
name: riscv-unprivileged-${{ env.SHORT_SHA }}.pdf
91-
path: ${{ github.workspace }}/build/riscv-unprivileged.pdf
92-
retention-days: 7
87+
- name: Upload riscv-unprivileged.pdf
88+
if: steps.build_files.outcome == 'success'
89+
uses: actions/upload-artifact@v4
90+
with:
91+
name: riscv-unprivileged-${{ env.SHORT_SHA }}.pdf
92+
path: ${{ github.workspace }}/build/riscv-unprivileged.pdf
93+
retention-days: 7
9394

9495
# Upload the riscv-unprivileged HTML file
95-
- name: Upload riscv-unprivileged.html
96-
if: steps.build_files.outcome == 'success'
97-
uses: actions/upload-artifact@v4
98-
with:
99-
name: riscv-unprivileged-${{ env.SHORT_SHA }}.html
100-
path: ${{ github.workspace }}/build/riscv-unprivileged.html
101-
retention-days: 7
96+
- name: Upload riscv-unprivileged.html
97+
if: steps.build_files.outcome == 'success'
98+
uses: actions/upload-artifact@v4
99+
with:
100+
name: riscv-unprivileged-${{ env.SHORT_SHA }}.html
101+
path: ${{ github.workspace }}/build/riscv-unprivileged.html
102+
retention-days: 7
102103

103104
# Upload the riscv-unprivileged EPUB file
104-
- name: Upload riscv-unprivileged.epub
105-
if: steps.build_files.outcome == 'success'
106-
uses: actions/upload-artifact@v4
107-
with:
108-
name: riscv-unprivileged-${{ env.SHORT_SHA }}.epub
109-
path: ${{ github.workspace }}/build/riscv-unprivileged.epub
110-
retention-days: 7
111-
112-
- name: Create Release
113-
if: steps.build_files.outcome == 'success' && github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true'
114-
uses: softprops/action-gh-release@v2
115-
with:
116-
draft: false
117-
tag_name: riscv-isa-release-${{ env.SHORT_SHA }}-${{ env.CURRENT_DATE }}
118-
name: ${{ env.CURRENT_DATE }}
119-
body: |
120-
This release was created by: ${{ github.event.sender.login }}
121-
Release Notes: ${{ github.event.inputs.release_notes }}
122-
files: |
123-
${{ github.workspace }}/build/riscv-privileged.pdf
124-
${{ github.workspace }}/build/riscv-privileged.html
125-
${{ github.workspace }}/build/riscv-privileged.epub
126-
${{ github.workspace }}/build/riscv-unprivileged.pdf
127-
${{ github.workspace }}/build/riscv-unprivileged.html
128-
${{ github.workspace }}/build/riscv-unprivileged.epub
129-
env:
130-
GITHUB_TOKEN: ${{ secrets.GHTOKEN }}
105+
- name: Upload riscv-unprivileged.epub
106+
if: steps.build_files.outcome == 'success'
107+
uses: actions/upload-artifact@v4
108+
with:
109+
name: riscv-unprivileged-${{ env.SHORT_SHA }}.epub
110+
path: ${{ github.workspace }}/build/riscv-unprivileged.epub
111+
retention-days: 7
112+
113+
- name: Create Release
114+
if: steps.build_files.outcome == 'success' && github.event_name == 'workflow_dispatch' && github.event.inputs.create_release == 'true'
115+
uses: softprops/action-gh-release@v2
116+
with:
117+
draft: false
118+
tag_name: riscv-isa-release-${{ env.SHORT_SHA }}-${{ env.CURRENT_DATE }}
119+
name: ${{ env.CURRENT_DATE }}
120+
body: |
121+
This release was created by: ${{ github.event.sender.login }}
122+
Release Notes: ${{ github.event.inputs.release_notes }}
123+
files: |
124+
${{ github.workspace }}/build/riscv-privileged.pdf
125+
${{ github.workspace }}/build/riscv-privileged.html
126+
${{ github.workspace }}/build/riscv-privileged.epub
127+
${{ github.workspace }}/build/riscv-unprivileged.pdf
128+
${{ github.workspace }}/build/riscv-unprivileged.html
129+
${{ github.workspace }}/build/riscv-unprivileged.epub
130+
env:
131+
GITHUB_TOKEN: ${{ secrets.GHTOKEN }}
131132

132133
# Create directory structure pages sites for privileged and unprivileged specs.
133-
- name: Make GitHub pages directory
134-
run: |
135-
mkdir -p dist/snapshot/unprivileged dist/snapshot/privileged
136-
cp build/riscv-unprivileged.html dist/snapshot/unprivileged/index.html
137-
cp build/riscv-privileged.html dist/snapshot/privileged/index.html
138-
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
139-
140-
- name: Upload pages artifact
141-
uses: actions/upload-pages-artifact@v3
142-
with:
143-
path: dist
144-
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
134+
- name: Make GitHub pages directory
135+
run: |
136+
mkdir -p dist/snapshot/unprivileged dist/snapshot/privileged
137+
cp build/riscv-unprivileged.html dist/snapshot/unprivileged/index.html
138+
cp build/riscv-privileged.html dist/snapshot/privileged/index.html
139+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
140+
141+
- name: Upload pages artifact
142+
uses: actions/upload-pages-artifact@v3
143+
with:
144+
path: dist
145+
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && github.ref == 'refs/heads/main')
145146

146147
# Deploy HTML to Github pages.
147148
deploy:

0 commit comments

Comments
 (0)