Skip to content

Commit

Permalink
Merge #288 - Rewrite JS code to Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed Dec 2, 2022
2 parents 45f9a5b + 223edb4 commit 2c08b72
Show file tree
Hide file tree
Showing 50 changed files with 5,598 additions and 1,783 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[data/**/*.json]
indent_size = 2
18 changes: 17 additions & 1 deletion .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,29 @@ jobs:
with:
path: ~/.composer/cache/
key: composer-cache
- name: Cache cargo binaries
uses: actions/cache@v3
id: cache-mariadb-mysql-kbs
with:
path: ~/.cargo/bin/mariadb-mysql-kbs
key: ${{ runner.os }}-cargo-bin-kbs-1.3.0-rc1
- name: Set up toolchain
if: steps.cache-mariadb-mysql-kbs.outputs.cache-hit != 'true'
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.64.0
override: true
- name: Install mariadb-mysql-kbs
if: steps.cache-mariadb-mysql-kbs.outputs.cache-hit != 'true'
run: cargo install mariadb-mysql-kbs@1.3.0-rc1
- name: Install
run: |
yarn install
composer install --no-interaction
- name: Build
run: |
yarn run build
mariadb-mysql-kbs extract
composer run build
- name: Install sudo-bot
run: yarn global add sudo-bot
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build and test rust code

on:
pull_request:
push:

permissions:
contents: read

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

jobs:
build_and_test:
runs-on: ubuntu-latest
name: Build and test
steps:
- name: Cache cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v3
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo binaries
uses: actions/cache@v3
with:
path: ~/.cargo/bin
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.64.0
override: true
components: rustfmt, llvm-tools-preview
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-Cinstrument-coverage"
RUSTDOCFLAGS: "-Cinstrument-coverage"
- name: Test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-fail-fast
env:
CARGO_INCREMENTAL: "0"
RUSTFLAGS: "-Cinstrument-coverage"
RUSTDOCFLAGS: "-Cinstrument-coverage"
- name: Install grcov
run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi
- name: Run grcov
run: grcov . --binary-path target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov
- uses: codecov/codecov-action@v3
with:
files: ./coverage.lcov
flags: rust
fail_ci_if_error: true # optional (default = false)
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ node_modules
/.php_cs.cache
/target
composer.lock
/*.lcov
/*.profraw
Loading

0 comments on commit 2c08b72

Please sign in to comment.