Skip to content

Commit

Permalink
chore: restore test fixtures (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
seren5240 authored Mar 9, 2024
1 parent 300cebb commit bcbaad2
Show file tree
Hide file tree
Showing 121 changed files with 3,071 additions and 104 deletions.
135 changes: 64 additions & 71 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,77 +7,70 @@ on:
branches: [main]

jobs:
# test-rust:
# name: Rust tests (marzano)
# timeout-minutes: 20
# strategy:
# fail-fast: false
# matrix:
# os: [nscloud-ubuntu-22.04-amd64-8x32]
# runs-on: ${{ matrix.os }}
# permissions:
# contents: "read"
# id-token: "write"
# env:
# ROOT_ANALYSIS_DIR: "${{ github.workspace }}/data"
# BUILD_OS: ${{ matrix.os }}
# os: ${{ matrix.os }}
# BUILD_PLATFORM: amd64
# steps:
# - name: clone code
# uses: actions/checkout@v3
# with:
# submodules: true
# fetch-depth: 0
# - name: Install Protoc
# run: sudo apt-get install -y protobuf-compiler
# - uses: dopplerhq/[email protected]
# id: doppler
# with:
# doppler-token: ${{ secrets.DOPPLER_SECRETS_TOKEN }}
# - name: install Rust
# uses: actions-rs/toolchain@v1
# with:
# # If you update this, also update build.mjs
# toolchain: nightly-2023-08-01
# override: true
# - name: install Terraform
# run: |
# wget https://releases.hashicorp.com/terraform/1.6.0/terraform_1.6.0_linux_amd64.zip
# unzip terraform_1.6.0_linux_amd64.zip
# chmod +x terraform
# sudo mv terraform /usr/local/bin/
# - name: install dependencies
# run: |
# cargo install buildkite-test-collector
# - name: setup node.js environment
# uses: actions/setup-node@v3
# - name: Install prettier
# run: |
# npm install -g prettier
# prettier --version
# - name: test
# env:
# GRIT_API_URL: ${{ steps.doppler.outputs.GRIT_API_URL }}
# API_TESTING_TOKEN: ${{ steps.doppler.outputs.API_TESTING_TOKEN }}
# run: |
# cargo test --workspace \
# --features test_ci \
# --exclude marzano-wasm-bindings \
# --exclude rustfsm \
# --exclude temporal-sdk-core-test-utils \
# --exclude temporal-client \
# --exclude temporal-sdk-core-protos \
# --exclude temporal-sdk \
# --exclude temporal-sdk-core \
# --exclude rustfsm_procmacro \
# --exclude rustfsm_codegen \
# --exclude google-cloud-metadata \
# --exclude google-cloud-auth \
# --exclude google-cloud-googleapis \
# --exclude google-cloud-gax \
# --exclude google-cloud-pubsub \
# -- -Z unstable-options
test-rust:
name: Rust tests (marzano)
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
os: [nscloud-ubuntu-22.04-amd64-8x32]
runs-on: ${{ matrix.os }}
permissions:
contents: "read"
id-token: "write"
env:
ROOT_ANALYSIS_DIR: "${{ github.workspace }}/data"
BUILD_OS: ${{ matrix.os }}
os: ${{ matrix.os }}
BUILD_PLATFORM: amd64
steps:
- name: clone code
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Install Protoc
run: sudo apt-get install -y protobuf-compiler
- name: install Rust
uses: actions-rs/toolchain@v1
with:
# If you update this, also update build.mjs
toolchain: nightly-2023-11-16
override: true
- name: install Terraform
run: |
wget https://releases.hashicorp.com/terraform/1.6.0/terraform_1.6.0_linux_amd64.zip
unzip terraform_1.6.0_linux_amd64.zip
chmod +x terraform
sudo mv terraform /usr/local/bin/
- name: install dependencies
run: |
cargo install buildkite-test-collector
- name: setup node.js environment
uses: actions/setup-node@v3
- name: Install prettier
run: |
npm install -g prettier
prettier --version
- name: test
run: |
cargo test --workspace \
--features test_ci \
--exclude marzano-wasm-bindings \
--exclude rustfsm \
--exclude temporal-sdk-core-test-utils \
--exclude temporal-client \
--exclude temporal-sdk-core-protos \
--exclude temporal-sdk \
--exclude temporal-sdk-core \
--exclude rustfsm_procmacro \
--exclude rustfsm_codegen \
--exclude google-cloud-metadata \
--exclude google-cloud-auth \
--exclude google-cloud-googleapis \
--exclude google-cloud-gax \
--exclude google-cloud-pubsub \
-- -Z unstable-options
test-rust-wasm:
name: Rust wasm
timeout-minutes: 15
Expand Down
2 changes: 2 additions & 0 deletions crates/cli/fixtures/bad_libs/.grit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.gritmodules*
*.log
8 changes: 8 additions & 0 deletions crates/cli/fixtures/bad_libs/.grit/grit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 0.0.1
patterns:
- name: bad
body: |
engine marzano(0.1)
language js
`console.log($arg) => .
31 changes: 31 additions & 0 deletions crates/cli/fixtures/bad_output/.grit/patterns/bad.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
title: Rewrite `x == -0` ⇒ `Object.is(x, -0)`
---

Convert any equality check with `-0` to the more precise `Object.is`.

Details on [on StackOverflow](https://stackoverflow.com/questions/7223359/are-0-and-0-the-same).

tags: #SD

```grit
engine marzano(1.0)
language js
`foo()` => `foo(`
```

## Basic example

```javascript
if (x == -0 || x !== -0) {
foo();
}
```

```typescript
if (x == -0 || x !== -0) {
foo(
}
```
36 changes: 36 additions & 0 deletions crates/cli/fixtures/bad_test/.grit/patterns/bad.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
title: Rewrite `x == -0` ⇒ `Object.is(x, -0)`
---

Convert any equality check with `-0` to the more precise `Object.is`.

Details on [on StackOverflow](https://stackoverflow.com/questions/7223359/are-0-and-0-the-same).

tags: #SD

```grit
engine marzano(1.0)
language js
binary_expression($left, $operator, $right) as $exp where {
$operator <: or {
or { "==", "===" } where $exp => `Object.is($left, -0)`,
or { "!=", "!==" } where $exp => `!Object.is($left, -0)`
}
}
```

## Basic example

```javascript
if (x == -0 || x !== -0) {
foo(;
}
```
```typescript
if (Object.is(x, -0) || !Object.is(x, -0)) {
foo();
}
```
2 changes: 2 additions & 0 deletions crates/cli/fixtures/check_actions/.grit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.gritmodules
*.log
25 changes: 25 additions & 0 deletions crates/cli/fixtures/check_actions/.grit/grit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 0.0.1
patterns:
- name: test_js
level: error
tags:
- style
- debugging
body: |
`$a = $b` => `console.log($b)`
- name: test_python
level: warn
tags:
- style
- debugging
body: |
language python
`print($a)` => `println($a)`
- name: test_notice
description: This is just a notice.
level: info
body: |
language python
`if $z: $cond` where {
$z <: `1 == 1`
} => $cond
2 changes: 2 additions & 0 deletions crates/cli/fixtures/check_actions_clean/.grit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.gritmodules
*.log
25 changes: 25 additions & 0 deletions crates/cli/fixtures/check_actions_clean/.grit/grit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: 0.0.1
patterns:
- name: test_js
level: error
tags:
- style
- debugging
body: |
`$a = $b` => `console.log($b)`
- name: test_python
level: warn
tags:
- style
- debugging
body: |
language python
`print($a)` => `println($a)`
- name: test_notice
description: This is just a notice.
level: info
body: |
language python
`if $z: $cond` where {
$z <: `1 == 1`
} => $cond
30 changes: 30 additions & 0 deletions crates/cli/fixtures/check_ignore/.grit/grit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: 0.0.1
patterns:
- name: test
tags:
- style
- debugging
level: error
body: |
`$a = $b` => `console.log($b)`
- name: another_test
level: warn
body: |
`$a = $b` => .
- name: third
level: error
body: |
`$a = $b` => `$b = $a`
- name: test_python
tags:
- style
- debugging
level: error
body: |
language python
`print($a)` => `println($a)`
- name: another_python
level: warn
body: |
language python
`print($a)` => .
9 changes: 9 additions & 0 deletions crates/cli/fixtures/check_js/.grit/grit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 0.0.1
patterns:
- name: test
tags:
- style
- debugging
level: error
body: |
`$a = $b` => `console.log($b)`
29 changes: 29 additions & 0 deletions crates/cli/fixtures/check_level/.grit/grit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
version: 0.0.3
patterns:
- name: github.com/getgrit/stdlib#*
- name: custom_no_console_log
level: warn
body: |
engine marzano(0.1)
language js
`console.log($msg)` => . where {
$filename <: is_not_excluded(),
$msg <: not within `if (DUMP_SECRETS) { $_ }`,
$msg <: not includes "listening on port",
$msg <: not includes "[KEEP]"
}
- name: no_tests_with_only
description: Forbid skipping tests with .only.
level: error
body: |
engine marzano(0.1)
language js
`$testlike.only` => `$testlike` where {
$testlike <: or {
`describe`,
`it`,
`test`
}
}
File renamed without changes.
17 changes: 17 additions & 0 deletions crates/cli/fixtures/check_multiple_targeted/.grit/grit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 0.0.1
patterns:
- name: test_js
tags:
- style
- debugging
level: error
body: |
`$a = $b` => `console.log($b)`
- name: test_python
tags:
- style
- debugging
level: error
body: |
language python
`print($a)` => `println($a)`
10 changes: 10 additions & 0 deletions crates/cli/fixtures/check_plumbing/.grit/grit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 0.0.1
patterns:
- name: no_skip
level: error
body: |
`test.only($a, $b)` => `test($a, $b)`
- name: no_console
level: error
body: |
or { `console.log($msg)`, `console.error($msg)` } => `console.warn($msg)`
2 changes: 2 additions & 0 deletions crates/cli/fixtures/check_python/.grit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.gritmodules
*.log
10 changes: 10 additions & 0 deletions crates/cli/fixtures/check_python/.grit/grit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 0.0.1
patterns:
- name: test
tags:
- style
- debugging
level: error
body: |
language python
`print($apple)` => `print_test($apple)`
Loading

0 comments on commit bcbaad2

Please sign in to comment.