Skip to content

Commit

Permalink
Merge pull request #10 from riscv/dev/kbroch/pre-commit-initial
Browse files Browse the repository at this point in the history
Add initial pre-commit and fix up and issues
  • Loading branch information
kbroch-rivosinc authored Apr 24, 2024
2 parents 4db01b0 + 6008177 commit d512b61
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 8 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [main]
paths:
- 'Dockerfiles/ubuntu2204'
- "Dockerfiles/ubuntu2204"

jobs:
build-and-push-docker-image:
Expand All @@ -29,7 +29,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Get Current Date
run: echo "NOW=$(date +'%m%d%Y')" >> $GITHUB_ENV
run: echo "NOW=$(date +'%m%d%Y')" >> "$GITHUB_ENV"

- name: Build image and push to Docker Hub
uses: docker/build-push-action@v3
Expand All @@ -40,4 +40,4 @@ jobs:
tags: |
riscvintl/riscv-docs-base-container-image:${{ github.sha }}
riscvintl/riscv-docs-base-container-image:latest
push: ${{ github.event_name != 'pull_request' }}
push: ${{ github.event_name != 'pull_request' }}
4 changes: 2 additions & 2 deletions .github/workflows/on_pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
types: [opened, reopened, edited]
branches: [main]
paths:
- 'Dockerfiles/ubuntu2204'
- "Dockerfiles/ubuntu2204"

jobs:
build-and-run-image:
Expand All @@ -27,4 +27,4 @@ jobs:
with:
context: .
file: ./Dockerfiles/ubuntu2204
platforms: linux/amd64,linux/arm64
platforms: linux/amd64,linux/arm64
15 changes: 15 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/action@v3.0.0
4 changes: 2 additions & 2 deletions .github/workflows/weekly_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Weekly Build and Release
on:
schedule:
# This will run every week at 00:00 UTC on Monday
- cron: '0 0 * * 1'
- cron: "0 0 * * 1"
workflow_dispatch:

jobs:
Expand All @@ -30,7 +30,7 @@ jobs:

- name: Get the current date
id: current_date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
run: echo "name=$(date +'%Y-%m-%d')" >> "$GITHUB_OUTPUT"

- name: Build image and push to Docker Hub
uses: docker/build-push-action@v3
Expand Down
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-symlinks
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/rbubley/mirrors-prettier
rev: v3.2.5
hooks:
- id: prettier

- repo: https://github.com/rhysd/actionlint
rev: v1.6.27
hooks:
- id: actionlint
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ docker run -it -v $(pwd)/riscv-isa-manual:/build riscvintl/riscv-docs-base-conta
The build artifacts will be located within the `riscv-isa-manual` in the `build` directory, for instance:

```
$ ls ./riscv-isa-manual/build/
$ ls ./riscv-isa-manual/build/
.
|-- Makefile
|-- riscv-privileged.aux
Expand Down Expand Up @@ -121,4 +121,5 @@ docker run -it -v $(pwd)/riscv-isa-manual:/build riscvintl/riscv-docs-base-conta
cd ./build
make
```

Once done, you can exit from the container with `exit` or leave it running and get back to the host with `ctrl p + ctrl q`. The build artifacts will be located within the `riscv-isa-manual`, in the `build` directory as shown in the previous step.

0 comments on commit d512b61

Please sign in to comment.