Skip to content

Commit

Permalink
Merge branch 'main' into update-ci-to-run-linux-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brianheineman authored Jan 23, 2025
2 parents 901c16f + c673a67 commit 7045adf
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 111 deletions.
69 changes: 0 additions & 69 deletions .github/release-drafter.yml

This file was deleted.

31 changes: 0 additions & 31 deletions .github/workflows/release-drafter.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release-plz

permissions:
pull-requests: write
contents: write

on:
push:
branches:
- main

jobs:

# Release unpublished packages.
release-plz-release:
name: Release-plz release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/action@v0.5
with:
command: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

# Create a PR with the new versions and changelog, preparing the next release.
release-plz-pr:
name: Release-plz PR
runs-on: ubuntu-latest
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: release-plz/action@v0.5
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
28 changes: 28 additions & 0 deletions release-plz.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[workspace]
changelog_path = "./CHANGELOG.md"
git_release_enable = true
git_release_body = """
{{ changelog }}
{% if remote.contributors %}
### Contributors
{% for contributor in remote.contributors %}
* @{{ contributor.username }}
{% endfor %}
{% endif %}
"""

[changelog]
body = """
## `{{ package }}` - [{{ version | trim_start_matches(pat="v") }}]{%- if release_link -%}({{ release_link }}){% endif %} - {{ timestamp | date(format="%Y-%m-%d") }}
{% for group, commits in commits | group_by(attribute="group") %}
### {{ group | upper_first }}
{% for commit in commits %}
{%- if commit.scope -%}
- *({{commit.scope}})* {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }}{%- if commit.links %} ({% for link in commit.links %}[{{link.text}}]({{link.href}}) {% endfor -%}){% endif %}
{% else -%}
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }}
{% endif -%}
{% endfor -%}
{% endfor -%}
"""
2 changes: 1 addition & 1 deletion ristretto_classfile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ anyhow = { workspace = true }
criterion = { workspace = true }
flate2 = { workspace = true }
indoc = { workspace = true }
reqwest = { workspace = true }
reqwest = { workspace = true, features = ["rustls-tls-native-roots"] }
tar = { workspace = true }
tokio = { workspace = true }
zip = { workspace = true }
Expand Down
13 changes: 7 additions & 6 deletions ristretto_classfile/src/attributes/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ impl Attribute {
.iter()
.filter(|(&k, _)| k <= exception.range_pc.end)
.max_by_key(|(&k, _)| k)
.map(|(_, &v)| v + 1)
.map(|(_, &v)| v)
.ok_or(InvalidInstructionOffset(u32::from(exception.range_pc.end)))?;
exception.handler_pc = *byte_to_instruction_map
.get(&exception.handler_pc)
Expand Down Expand Up @@ -730,7 +730,7 @@ impl Attribute {
.iter()
.filter(|(&k, _)| k <= exception.range_pc.end)
.max_by_key(|(&k, _)| k)
.map(|(_, &v)| v + 1)
.map(|(_, &v)| v)
.ok_or(InvalidInstructionOffset(u32::from(exception.range_pc.end)))?;
exception.handler_pc = *instruction_to_byte_map
.get(&exception.handler_pc)
Expand Down Expand Up @@ -1278,19 +1278,20 @@ mod test {
name_index: 1,
max_stack: 2,
max_locals: 3,
code: vec![Instruction::Iconst_1],
code: vec![Instruction::Iconst_1, Instruction::Return],
exception_table: vec![exception_table_entry],
attributes: vec![constant.clone(), line_number_table.clone()],
};
let expected_bytes = [
0, 1, 0, 0, 0, 41, 0, 2, 0, 3, 0, 0, 0, 1, 4, 0, 1, 0, 0, 0, 1, 0, 0, 0, 4, 0, 2, 0, 2,
0, 0, 0, 2, 0, 42, 0, 3, 0, 0, 0, 6, 0, 1, 0, 0, 0, 1,
0, 1, 0, 0, 0, 42, 0, 2, 0, 3, 0, 0, 0, 2, 4, 177, 0, 1, 0, 0, 0, 1, 0, 0, 0, 4, 0, 2,
0, 2, 0, 0, 0, 2, 0, 42, 0, 3, 0, 0, 0, 6, 0, 1, 0, 0, 0, 1,
];
let expected = indoc! {"
Code:
stack=2, locals=3
0: iconst_1
[ExceptionTableEntry { range_pc: 0..1, handler_pc: 0, catch_type: 4 }]
1: return
[ExceptionTableEntry { range_pc: 0..2, handler_pc: 0, catch_type: 4 }]
ConstantValue { name_index: 2, constant_value_index: 42 }
LineNumberTable:
line 1: 0
Expand Down
5 changes: 5 additions & 0 deletions ristretto_classfile/tests/class_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ pub fn test_expressions() -> Result<()> {
test_class(include_bytes!("../../classes/Expressions.class"))
}

#[test]
pub fn test_jdbc() -> Result<()> {
test_class(include_bytes!("../../classes/JDBC.class"))
}

#[test]
pub fn test_minimum() -> Result<()> {
test_class(include_bytes!("../../classes/Minimum.class"))
Expand Down
6 changes: 2 additions & 4 deletions ristretto_vm/src/native_methods/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,10 +735,8 @@ mod tests {
extra_methods.join("\n"),
));
};
if !errors.is_empty() {
eprintln!("{}", errors.join("\n"));
assert!(errors.is_empty());
}
let errors = errors.join("\n");
assert_eq!("", errors);
Ok(())
}

Expand Down

0 comments on commit 7045adf

Please sign in to comment.