diff --git a/.github/workflows/build-pdf.yml b/.github/workflows/build-pdf.yml index 39859365..d325c130 100644 --- a/.github/workflows/build-pdf.yml +++ b/.github/workflows/build-pdf.yml @@ -1,3 +1,4 @@ +--- name: Create Specification Document # The workflow is triggered by pull request, push to main, and manual dispatch. @@ -9,22 +10,22 @@ on: required: true type: string revision_mark: - description: 'Set revision mark as Draft, Release or Stable:' - required: true - type: string - default: 'Draft' + description: 'Set revision mark as Draft, Release or Stable:' + required: true + type: string + default: Draft prerelease: - description: 'Tag as a pre-release?' + description: Tag as a pre-release? required: false type: boolean default: true draft: - description: 'Create release as a draft?' + description: Create release as a draft? required: false type: boolean default: false pages: - description: 'Deploy HTML to Github pages?' + description: Deploy HTML to Github pages? required: false type: boolean default: false @@ -39,57 +40,57 @@ jobs: steps: # Checkout the repository - - name: Checkout repository - uses: actions/checkout@v3 - with: - submodules: 'recursive' + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: recursive # Pull the latest RISC-V Docs container image - - name: Pull Container - run: docker pull riscvintl/riscv-docs-base-container-image:latest + - name: Pull Container + run: docker pull riscvintl/riscv-docs-base-container-image:latest # Build PDF and HTML. - - name: Build Files - run: make all - env: - VERSION: v${{ github.event.inputs.version }} - REVMARK: ${{ github.event.inputs.revision_mark }} + - name: Build Files + run: make all + env: + VERSION: v${{ github.event.inputs.version }} + REVMARK: ${{ github.event.inputs.revision_mark }} # Upload the built PDF and HTML files as a single artifact - - name: Upload Build Artifacts - uses: actions/upload-artifact@v3 - with: - name: Build Artifacts - path: | - build/*.pdf - build/*.html - retention-days: 30 + - name: Upload Build Artifacts + uses: actions/upload-artifact@v3 + with: + name: Build Artifacts + path: | + build/*.pdf + build/*.html + retention-days: 30 # Upload gitlab pages artefact. - - name: Make gitlab pages directory - run: mkdir dist && cp build/*.html dist/index.html - if: github.event_name == 'workflow_dispatch' + - name: Make gitlab pages directory + run: mkdir dist && cp build/*.html dist/index.html + if: github.event_name == 'workflow_dispatch' - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - with: - path: dist - if: github.event_name == 'workflow_dispatch' + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: dist + if: github.event_name == 'workflow_dispatch' # Create Release - - name: Create Release - uses: softprops/action-gh-release@v1 - with: - files: | - build/*.pdf - build/*.html - tag_name: v${{ github.event.inputs.version }} - name: Release ${{ github.event.inputs.version }} - draft: ${{ github.event.inputs.draft }} - prerelease: ${{ github.event.inputs.prerelease }} - env: - GITHUB_TOKEN: ${{ secrets.GHTOKEN }} - if: github.event_name == 'workflow_dispatch' + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: | + build/*.pdf + build/*.html + tag_name: v${{ github.event.inputs.version }} + name: Release ${{ github.event.inputs.version }} + draft: ${{ github.event.inputs.draft }} + prerelease: ${{ github.event.inputs.prerelease }} + env: + GITHUB_TOKEN: ${{ secrets.GHTOKEN }} + if: github.event_name == 'workflow_dispatch' # This condition ensures this step only runs for workflow_dispatch events. # Deploy HTML to Github pages. diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000..2126ca60 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,15 @@ +--- +name: pre-commit + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + - uses: pre-commit/action@v3.0.0 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..63fae1b6 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,26 @@ +--- +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: check-json + - id: check-symlinks + - id: check-yaml + - id: end-of-file-fixer + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + + - repo: local + hooks: + - id: forbidden-file-extensions + name: forbidden-file-extensions + entry: disallow these file extensions + language: fail + # Disallow other asciidoc extensions except .adoc + files: .*\.(asciidoc|asc)$ + + - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt + rev: 0.2.3 + hooks: + - id: yamlfmt + args: [--mapping, '2', --sequence, '4', --offset, '2'] diff --git a/readme.adoc b/readme.adoc index 2dc1c3a6..b0ce9905 100644 --- a/readme.adoc +++ b/readme.adoc @@ -8,7 +8,7 @@ This work is licensed under a Creative Commons Attribution 4.0 International Lic == Contributors -The list of contributors to this specification is maintained in the link:contributors.adoc[contributors] file. +The list of contributors to this specification is maintained in the link:src/contributors.adoc[contributors] file. For guidelines on how to contribute, refer to the link:CONTRIBUTING.md[CONTRIBUTING] file. @@ -25,13 +25,15 @@ To build the document, you'll need the following tools installed on your system: === Cloning the Repository -`git clone --recurse-submodules https://github.com/riscv/riscv-cheri.git` +```shell +git clone --recurse-submodules https://github.com/riscv/riscv-cheri.git +``` === Building the Documentation To start the build process, run `cd ./riscv-cheri && make all`. -The Makefile script will check the availability of Docker on your system: +The link:Makefile[] script will check the availability of Docker on your system: * If Docker is available, the documentation will be built inside a Docker container using the image riscvintl/riscv-docs-base-container-image:latest. This ensures a consistent build environment across different systems. * If Docker is not available, the documentation will be built directly on your system using the installed tools.