Skip to content

Commit

Permalink
Merge branch 'master' into refactor/jsonnet-less-stdlib
Browse files Browse the repository at this point in the history
  • Loading branch information
JarvisCraft committed May 15, 2024
2 parents 731c7c0 + a5bc57a commit 3729c79
Show file tree
Hide file tree
Showing 25 changed files with 192 additions and 191 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Checks
on: [ pull_request ]
jobs:
tests:
name: Tests
uses: ./.github/workflows/test.yaml
lints:
name: Lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
- uses: auguwu/clippy-action@1.3.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
permissions:
checks: write
formatting:
name: Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
- uses: actions-rust-lang/rustfmt@v1.1.0

15 changes: 0 additions & 15 deletions .github/workflows/clippy_check.yml

This file was deleted.

68 changes: 18 additions & 50 deletions .github/workflows/release.yml → .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,54 +1,27 @@
name: CI
on: [push]
name: Release
on:
push:
tags: [ 'v*' ]
jobs:
test:
name: Test Suite
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all
tests:
uses: ./.github/workflows/test.yaml

cargo-release:
if: startsWith(github.ref, 'refs/tags/') && !endsWith(github.ref, '-test')
needs: [test]
if: !endsWith(github.ref, '-test')
needs: [ tests ]
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- uses: actions/checkout@v4.1.4
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
with:
toolchain: stable
override: true
- name: Install cargo release command
uses: actions-rs/cargo@v1
with:
command: install
args: cargo-release
- name: Run cargo login
uses: actions-rs/cargo@v1
with:
command: login
args: ${{ secrets.CARGO_TOKEN }}
- name: Publish crates
uses: actions-rs/cargo@v1
with:
command: release
args: --no-dev-version --skip-push --skip-tag --no-confirm
- run: cargo install cargo-release
- run: cargo login ${{ secrets.CARGO_TOKEN }}
- run: cargo release --no-dev-version --skip-push --skip-tag --no-confirm

github-release:
if: startsWith(github.ref, 'refs/tags/')
needs: [test]
needs: [ tests ]
strategy:
matrix:
target:
Expand Down Expand Up @@ -108,14 +81,12 @@ jobs:
run: sudo apt update

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
with:
toolchain: stable
override: true
target: ${{ matrix.target }}

- name: Checkout
uses: actions/checkout@v2
- uses: actions/checkout@v4.1.4

- name: Add experimental flags
if: ${{ endsWith(github.ref, '-test' )}}
Expand Down Expand Up @@ -147,10 +118,7 @@ jobs:

- name: Run build
if: ${{ !startsWith(matrix.target, 'aarch64-unknown-linux-') }}
uses: actions-rs/cargo@v1
with:
command: build
args: --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }}
run: cargo build --bin=jrsonnet --release --target ${{ matrix.target }} ${{ env.EXPERIMENTAL_FLAGS }}

- name: Package
shell: bash
Expand All @@ -164,7 +132,7 @@ jobs:
run: shasum -a 256 ${{ matrix.name }} > ${{ matrix.name }}.sha256

- name: Publish
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2.0.4
with:
draft: true
files: "jrsonnet*"
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Test
on: [ workflow_call ]
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
- run: cargo test --all
test-stable:
name: Test on stable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.4
- name: Install the latest stable toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1.8.0
with:
toolchain: stable
- run: cargo test --all

42 changes: 21 additions & 21 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jrsonnet-gcmodule = "0.3.6"
# and other libraries want to handle spans etc by itself, which is okay for compiler diagnostics, but is
# bad for interpreter, where interpreter and parser are paired much closer.
hi-doc = "0.1.1"
annotate-snippets = "0.10.1"
annotate-snippets = "0.11.2"

# CLI
clap = "4.5"
Expand All @@ -39,16 +39,16 @@ clap_complete = "4.5"
# Parsing, manifestification is implemented manually everywhere
# Note on serde_yaml_with_quirks: This is a fork of serde-yaml with legacy yaml 1.1 support:
# https://github.com/dtolnay/serde-yaml/pull/225
serde = "1.0.197"
serde_json = "1.0.114"
serde = "1.0.202"
serde_json = "1.0.117"
serde_yaml_with_quirks = "0.8.24"

# Error handling
anyhow = "1.0.80"
thiserror = "1.0"
anyhow = "1.0.83"
thiserror = "1.0.60"

# Code formatting
dprint-core = "0.65.0"
dprint-core = "0.66.2"

# Stdlib hashing functions
md5 = "0.7.0"
Expand All @@ -63,36 +63,36 @@ bincode = "1.3"
# Source code parsing.
# Jrsonnet has two parsers for jsonnet - one is for execution, and another is for better parsing diagnostics/lints/LSP.
# First (and fast one) is based on peg, second is based on rowan.
peg = "0.8.2"
peg = "0.8.3"
logos = "0.14.0"
ungrammar = "1.16.1"
rowan = "0.15"
rowan = "0.15.15"

mimallocator = "0.1.3"
indoc = "2.0"
insta = "1.35"
insta = "1.39"
tempfile = "3.10"
pathdiff = "0.2.1"
hashbrown = "0.14.3"
hashbrown = "0.14.5"
static_assertions = "1.1"
rustc-hash = "1.1"
num-bigint = "0.4.4"
derivative = "2.2.0"
strsim = "0.11.0"
num-bigint = "0.4.5"
derivative = "2.2"
strsim = "0.11.1"
structdump = "0.2.0"
proc-macro2 = "1.0"
quote = "1.0"
syn = "2.0"
proc-macro2 = "1.0.82"
quote = "1.0.36"
syn = "2.0.63"
drop_bomb = "0.1.5"
base64 = "0.21.7"
indexmap = "2.2.3"
base64 = "0.22.1"
indexmap = "2.2"
itertools = "0.12.1"
xshell = "0.2.5"
xshell = "0.2.6"

lsp-server = "0.7.6"
lsp-types = "0.95.0"
lsp-types = "0.95.1"

regex = "1.10.3"
regex = "1.10"
lru = "0.12.2"

[workspace.lints.rust]
Expand Down
2 changes: 1 addition & 1 deletion cmds/jrsonnet-fmt/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fn reformat(input: &str) -> String {

#[test]
fn complex_comments_snapshot() {
insta::assert_display_snapshot!(reformat(indoc!(
insta::assert_snapshot!(reformat(indoc!(
"{
comments: {
_: '',
Expand Down
2 changes: 1 addition & 1 deletion crates/jrsonnet-cli/src/tla.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{ExtFile, ExtStr};
pub struct TlaOpts {
/// Add top level string argument.
/// Top level arguments will be passed to function before manifestification stage.
/// This is preferred to ExtVars method.
/// This is preferred to [`ExtVars`] method.
/// If [=data] is not set then it will be read from `name` env variable.
#[clap(long, short = 'A', name = "name[=tla data]", number_of_values = 1)]
tla_str: Vec<ExtStr>,
Expand Down
3 changes: 1 addition & 2 deletions crates/jrsonnet-evaluator/src/arr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ use jrsonnet_parser::LocExpr;
use crate::{function::FuncVal, gc::TraceBox, tb, Context, Result, Thunk, Val};

mod spec;
pub use spec::ArrayLike;
pub(crate) use spec::*;
pub use spec::{ArrayLike, *};

/// Represents a Jsonnet array value.
#[derive(Debug, Clone, Trace)]
Expand Down
10 changes: 0 additions & 10 deletions crates/jrsonnet-evaluator/src/function/arglike.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,6 @@ impl ArgLike for TlaArg {
}
}

mod sealed {
/// Implemented for `ArgsLike`, where only unnamed arguments present
pub trait Unnamed {}
/// Implemented for `ArgsLike`, where only named arguments present
pub trait Named {}
}

pub trait ArgsLike {
fn unnamed_len(&self) -> usize;
fn unnamed_iter(
Expand Down Expand Up @@ -182,7 +175,6 @@ impl ArgsLike for ArgsDesc {
}
}

impl<V: ArgLike, S> sealed::Named for HashMap<IStr, V, S> {}
impl<V: ArgLike, S> ArgsLike for HashMap<IStr, V, S> {
fn unnamed_len(&self) -> usize {
0
Expand Down Expand Up @@ -247,7 +239,6 @@ impl<A: ArgLike> ArgsLike for GcHashMap<IStr, A> {

macro_rules! impl_args_like {
($count:expr; $($gen:ident)*) => {
impl<$($gen: ArgLike,)*> sealed::Unnamed for ($($gen,)*) {}
impl<$($gen: ArgLike,)*> ArgsLike for ($($gen,)*) {
fn unnamed_len(&self) -> usize {
$count
Expand Down Expand Up @@ -279,7 +270,6 @@ macro_rules! impl_args_like {
}
impl<$($gen: ArgLike,)*> OptionalContext for ($($gen,)*) where $($gen: OptionalContext),* {}

impl<$($gen: ArgLike,)*> sealed::Named for ($((IStr, $gen),)*) {}
impl<$($gen: ArgLike,)*> ArgsLike for ($((IStr, $gen),)*) {
fn unnamed_len(&self) -> usize {
0
Expand Down
Loading

0 comments on commit 3729c79

Please sign in to comment.