Skip to content

Commit

Permalink
ci: settings for mega-linter (#910)
Browse files Browse the repository at this point in the history
  • Loading branch information
eitsupi authored Mar 11, 2024
1 parent 2b3a001 commit 49e2056
Show file tree
Hide file tree
Showing 22 changed files with 743 additions and 684 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@
^rustfmt\.toml$
^\.lintr\.R$
^\.mega-linter\.yml$
^\.lycheeignore$
^\.yamllint\.yml$
^\.ecrc$
21 changes: 21 additions & 0 deletions .ecrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"Verbose": false,
"Debug": false,
"IgnoreDefaults": false,
"SpacesAftertabs": false,
"NoColor": false,
"Exclude": [
"LICENSE\\.note$",
"tests/testthat/_snaps/"
],
"AllowedContentTypes": [],
"PassedFiles": [],
"Disable": {
"EndOfLine": false,
"Indentation": false,
"IndentSize": false,
"InsertFinalNewline": false,
"TrimTrailingWhitespace": false,
"MaxLineLength": false
}
}
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@ trim_trailing_whitespace = true
[*.md]
indent_style = space
indent_size = 2

[NEWS.md]
indent_size = 4
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
description: Set up Rust nightly toolchain?
required: false
target:
description: Rust target triple to use
description: Rust target triple to use. If empty, the default target is used.
required: true
token:
description: GitHub token
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ defaults:
run:
shell: bash

permissions: read-all

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
Expand Down Expand Up @@ -72,16 +74,16 @@ jobs:
id: rust-target
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
echo "TARGET=x86_64-pc-windows-gnu" >>$GITHUB_OUTPUT
echo "TARGET=x86_64-pc-windows-gnu" >>"$GITHUB_OUTPUT"
else
echo "TARGET=$(rustc -vV | grep host | cut -d' ' -f2)" >>$GITHUB_OUTPUT
echo "TARGET=$(rustc -vV | grep host | cut -d' ' -f2)" >>"$GITHUB_OUTPUT"
fi
- name: Set env vars for build option
if: matrix.config.full-features
run: |
echo "LIBR_POLARS_FEATURES=full_features" >>$GITHUB_ENV
echo "LIBR_POLARS_PROFILE=release" >>$GITHUB_ENV
echo "LIBR_POLARS_FEATURES=full_features" >>"$GITHUB_ENV"
echo "LIBR_POLARS_PROFILE=release" >>"$GITHUB_ENV"
- uses: ./.github/actions/setup
with:
Expand Down Expand Up @@ -109,7 +111,7 @@ jobs:
NOT_CRAN: "true"
run: |
Rscript -e 'pkgbuild::compile_dll()'
echo "LIBR_POLARS_PATH=$(pwd)/src/rust/target/${{ steps.rust-target.outputs.TARGET }}/release/libr_polars.a" >>$GITHUB_ENV
echo "LIBR_POLARS_PATH=$(pwd)/src/rust/target/${{ steps.rust-target.outputs.TARGET }}/release/libr_polars.a" >>"$GITHUB_ENV"
- uses: r-lib/actions/check-r-package@v2
env:
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ env:
LIBR_POLARS_BUILD: "true"
LIBR_POLARS_PROFILE: release

permissions: read-all

jobs:
documentation:
runs-on: ubuntu-latest
Expand All @@ -63,9 +65,9 @@ jobs:
id: rust-target
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
echo "TARGET=x86_64-pc-windows-gnu" >>$GITHUB_OUTPUT
echo "TARGET=x86_64-pc-windows-gnu" >>"$GITHUB_OUTPUT"
else
echo "TARGET=$(rustc -vV | grep host | cut -d' ' -f2)" >>$GITHUB_OUTPUT
echo "TARGET=$(rustc -vV | grep host | cut -d' ' -f2)" >>"$GITHUB_OUTPUT"
fi
- uses: ./.github/actions/setup
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/mega-linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ on:
pull_request:
branches:
- main
push:
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

permissions: read-all

jobs:
megalinter:
name: MegaLinter
Expand All @@ -30,11 +35,11 @@ jobs:
id: ml
# You can override MegaLinter flavor used to have faster performances
# More info at https://megalinter.io/flavors/
uses: oxsecurity/megalinter/flavors/cupcake@v7.9.0
uses: oxsecurity/megalinter/flavors/cupcake@v7.10.0
env:
# All available variables are described in documentation
# https://megalinter.io/configuration/
VALIDATE_ALL_CODEBASE: true
VALIDATE_ALL_CODEBASE: ${{ github.event_name != 'pull_request' }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ADD YOUR CUSTOM ENV VARIABLES HERE OR DEFINE THEM IN A FILE .mega-linter.yml AT THE ROOT OF YOUR REPOSITORY
# DISABLE: COPYPASTE,SPELL # Uncomment to disable copy-paste and spell checks
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/release-lib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ env:
LIBR_POLARS_FEATURES: "full_features"
LIBR_POLARS_PROFILE: release-optimized

permissions: read-all

jobs:
build:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -208,8 +210,8 @@ jobs:
- name: create checksums
working-directory: libs
run: |
sha256sum * >"../sha256sums.txt"
md5sum * >"../md5sums.txt"
sha256sum -- * >"../sha256sums.txt"
md5sum -- * >"../md5sums.txt"
- name: create release
uses: softprops/action-gh-release@v2
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ env:
LIBR_POLARS_PROFILE: release-optimized
NOT_CRAN: "true"

permissions: read-all

jobs:
build:
runs-on: ${{ matrix.config.os }}
Expand All @@ -52,6 +54,7 @@ jobs:
- uses: ./.github/actions/setup
with:
rust-nightly: true
target: ''
token: "${{ secrets.GITHUB_TOKEN }}"

- uses: r-lib/actions/setup-pandoc@v2
Expand All @@ -68,18 +71,16 @@ jobs:
needs: dev

- name: Build lib
if: matrix.config.target == ''
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
TARGET=x86_64-pc-windows-gnu
else
TARGET="$(rustc -vV | grep host | cut -d' ' -f2)"
fi
Rscript -e 'pkgbuild::compile_dll()'
echo "LIBR_POLARS_PATH=$(pwd)/src/rust/target/${TARGET}/${{ env.LIBR_POLARS_PROFILE }}/libr_polars.a" >>$GITHUB_ENV
echo "LIBR_POLARS_PATH=$(pwd)/src/rust/target/${TARGET}/${{ env.LIBR_POLARS_PROFILE }}/libr_polars.a" >>"$GITHUB_ENV"
- name: make binary R package + test on host arch
if: matrix.config.target == ''
run: |
devtools::install(quick = TRUE)
devtools::test(stop_on_failure = TRUE)
Expand Down
5 changes: 5 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
https://megalinter.io/configuration/
https://r-lib.github.io/p/pak/stable/%s/%s/%s
https://megalinter.io/flavors/
https://rpolars.github.io/vignettes
https://rpolars.github.io/man
5 changes: 5 additions & 0 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,9 @@ DISABLE:
- RUST
- R
DISABLE_LINTERS:
- C_CPPLINT
- CSS_STYLELINT
- REPOSITORY_KICS
- SPELL_CSPELL
DISABLE_ERRORS_LINTERS:
- COPYPASTE_JSCPD
13 changes: 13 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
extends: default

rules:
braces:
max-spaces-inside: 1
comments-indentation: disable
document-start: disable
empty-lines:
level: warning
line-length:
max: 120
level: warning
truthy: disable
12 changes: 6 additions & 6 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ When updating the Rust Polars crate that the R package depends on,
the following steps are required:

1. Since the version of the Polars crate is specified by the Git revision,
update the `rev` of all `polars-*` crates in the `src/rust/Cargo.toml` file.
update the `rev` of all `polars-*` crates in the `src/rust/Cargo.toml` file.
2. Update the `Config/polars/RustToolchainVersion` field in the `DESCRIPTION`
file to the version of the Rust toolchain specified in the `toolchain.channel`
field of the `rust-toolchain.toml` file in the Polars crate Git repository.
file to the version of the Rust toolchain specified in the `toolchain.channel`
field of the `rust-toolchain.toml` file in the Polars crate Git repository.
3. Update the toolchain to the version specified in the `DESCRIPTION` file.
4. Repeat the build, test, and bug fixes of the R package.

Expand Down Expand Up @@ -127,7 +127,7 @@ Rscript dev/generate-lib-sums.R
The R package releases are done on GitHub pull requests.

1. Create a local branch for the release, push it to the remote repository (main
repository), then open a pull request to the `main` branch.
repository), then open a pull request to the `main` branch.
2. Bump the R package version with the `usethis` package.

```r
Expand All @@ -137,9 +137,9 @@ usethis::use_version()

3. Check the CI status of the pull request.
4. Push a tag named starting with `v` (e.g. `v0.10.0`). It triggers the GitHub
action to build the website and create a GitHub release.
action to build the website and create a GitHub release.
5. Bump the R package version to "dev version" with the `usethis` package
before merging the pull request.
before merging the pull request.

```r
usethis::use_dev_version()
Expand Down
Loading

0 comments on commit 49e2056

Please sign in to comment.