Skip to content

Commit fa66bc1

Browse files
committed
Fix jarl complaints and adding pre-commit to GitHub Actions
Fixes #72
1 parent 7ed4f32 commit fa66bc1

2 files changed

Lines changed: 71 additions & 5 deletions

File tree

.github/workflows/pre-commit.yaml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
on:
2+
push:
3+
branches: [main, devel]
4+
pull_request:
5+
6+
name: pre-commit.yaml
7+
8+
permissions: read-all
9+
10+
jobs:
11+
pre-commit:
12+
runs-on: ubuntu-latest
13+
env:
14+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-python@v5
19+
with:
20+
python-version: "3.12"
21+
22+
- uses: r-lib/actions/setup-r@v2
23+
with:
24+
use-public-rspm: true
25+
26+
- name: Install Rcpp
27+
run: Rscript -e 'install.packages("Rcpp")'
28+
29+
- name: Install system dependencies
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install --yes clang-format clang-tidy
33+
34+
- name: Install Air
35+
uses: posit-dev/setup-air@v1
36+
37+
- name: Install Jarl
38+
run: |
39+
curl --proto '=https' --tlsv1.2 -LsSf \
40+
https://github.com/etiennebacher/jarl/releases/latest/download/jarl-installer.sh | sh
41+
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
42+
43+
- name: Install pre-commit
44+
run: python -m pip install --upgrade pre-commit
45+
46+
- name: Run pre-commit (pull request)
47+
if: github.event_name == 'pull_request'
48+
run: |
49+
pre-commit run \
50+
--from-ref "${{ github.event.pull_request.base.sha }}" \
51+
--to-ref "${{ github.event.pull_request.head.sha }}" \
52+
--show-diff-on-failure
53+
54+
- name: Run pre-commit (push)
55+
if: github.event_name == 'push' && github.event.before != '0000000000000000000000000000000000000000'
56+
run: |
57+
pre-commit run \
58+
--from-ref "${{ github.event.before }}" \
59+
--to-ref "${{ github.sha }}" \
60+
--show-diff-on-failure
61+
62+
- name: Run pre-commit (bootstrap)
63+
if: github.event_name == 'push' && github.event.before == '0000000000000000000000000000000000000000'
64+
run: pre-commit run --all-files --show-diff-on-failure

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,11 +197,13 @@ on each push and pull request.
197197
Specifically, we run:
198198
* [R CMD check](.github/workflows/R-CMD-check.yaml) on multiple platforms
199199
(see curent status [here](https://github.com/HighlanderLab/RcppTskit/actions/workflows/R-CMD-check.yaml)),
200-
* [covr test coverage](.github/workflows/covr.yaml)
201-
(see current status [here](https://github.com/HighlanderLab/RcppTskit/actions/workflows/test-coverage.yaml)), and
202-
* [Roxygen documentation generation](.github/workflows/document.yaml)
203-
(see current status [here](https://github.com/HighlanderLab/RcppTskit/actions/workflows/document.yaml)).
200+
* [documentation generation](.github/workflows/document.yaml)
201+
(see current status [here](https://github.com/HighlanderLab/RcppTskit/actions/workflows/document.yaml)),
202+
* [pre-commit hooks](.github/workflows/pre-commit.yaml)
203+
(see current status [here](https://github.com/HighlanderLab/RcppTskit/actions/workflows/pre-commit.yaml)), and
204+
* [test coverage](.github/workflows/test-coverage.yaml)
205+
(see current status [here](https://github.com/HighlanderLab/RcppTskit/actions/workflows/test-coverage.yaml)).
204206

205207
[R universe for RcppTskit](https://highlanderlab.r-universe.dev/RcppTskit)
206208
also provides another set of checks - see [here](https://highlanderlab.r-universe.dev/RcppTskit#checktable).
207-
These are provided once the code is merged into this repository.
209+
These are provided after new code is pushed or merged into this repository.

0 commit comments

Comments
 (0)