Skip to content

Commit f0a1fdc

Browse files
authored
ci: add automated releases (#2)
1 parent 8f08668 commit f0a1fdc

File tree

12 files changed

+128
-12
lines changed

12 files changed

+128
-12
lines changed

.changelog.toml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[changelog]
2+
body = """
3+
4+
## [{{ version | trim_start_matches(pat="v") }}]\
5+
{%- if release_link -%}\
6+
({{ release_link }})\
7+
{% endif %} \
8+
- {{ timestamp | date(format="%Y-%m-%d") }}
9+
{% for group, commits in commits | group_by(attribute="group") %}
10+
### {{ group | upper_first }}
11+
{% for commit in commits %}
12+
{%- if commit.scope -%}
13+
- *({{commit.scope}})* {% if commit.breaking %}[**breaking**] {% endif %}\
14+
{{ commit.message }}{{ self::username(commit=commit) }}\
15+
{%- if commit.links %} \
16+
({% for link in commit.links %}[{{link.text}}]({{link.href}}) {% endfor -%})\
17+
{% endif %}
18+
{% else -%}
19+
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message }}{{ self::username(commit=commit) }}
20+
{% endif -%}
21+
{% endfor -%}
22+
{% endfor %}
23+
{%- if remote.contributors %}
24+
### Contributors
25+
{% for contributor in remote.contributors %}
26+
* @{{ contributor.username }}
27+
{%- endfor %}
28+
{% endif -%}
29+
{%- macro username(commit) -%}
30+
{% if commit.remote.username %} (by @{{ commit.remote.username }}){% endif -%}
31+
{% endmacro -%}
32+
"""

.github/dependabot.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
# Check for updates every Monday
6+
schedule:
7+
interval: "weekly"

.github/workflows/lint-pr.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: "Lint PR"
2+
on:
3+
pull_request_target:
4+
types:
5+
- opened
6+
- edited
7+
- synchronize
8+
- reopened
9+
permissions:
10+
pull-requests: read
11+
jobs:
12+
main:
13+
name: Validate PR title
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: amannn/action-semantic-pull-request@v5
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release-plz.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Release
2+
permissions:
3+
pull-requests: write
4+
contents: write
5+
on:
6+
push:
7+
branches:
8+
- main
9+
jobs:
10+
release-plz:
11+
name: Release-plz
12+
runs-on: warp-ubuntu-latest-x64-8x
13+
concurrency:
14+
group: release-plz-${{ github.ref }}
15+
cancel-in-progress: false
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
token: ${{ secrets.RELEASE_PLZ_TOKEN }}
22+
- name: Run release-plz
23+
uses: MarcoIeni/[email protected]
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.RELEASE_PLZ_TOKEN }}
26+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

.github/workflows/test.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
test:
1616
name: Test
1717
# running with macos since it contains the safari driver
18-
runs-on: warp-macos-13-arm64-6x
18+
runs-on: macos-latest
1919
steps:
2020
- name: Checkout
2121
uses: actions/checkout@v4
@@ -44,6 +44,7 @@ jobs:
4444
with:
4545
workspaces: |
4646
.
47+
- run: cargo build --target wasm32-unknown-unknown --tests --features unsafe-debug-query
4748
- run: wasm-pack test --headless --safari --features unsafe-debug-query
4849
working-directory: ./
4950
- run: wasm-pack test --headless --chrome --features unsafe-debug-query

.release-plz.toml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[workspace]
2+
changelog_config = "./.changelog.toml"

CHANGELOG.md

Whitespace-only changes.

README.md

+31-7
Original file line numberDiff line numberDiff line change
@@ -65,32 +65,56 @@ async fn code_in_web_worker() -> Result<i32, diesel::QueryResult<usize>> {
6565

6666
look in `tests/web.rs` for working example!
6767

68-
## Development
68+
## Contributing
6969

70-
### Install yarn dependencies
70+
### Building
71+
72+
#### Install yarn dependencies
7173

7274
`yarn install`
7375

74-
### Build the SQLite/OPFS BUndle
76+
#### Build the SQLite/OPFS BUndle
7577

7678
`yarn run build`
7779

78-
### Build the rust code, and re-build `package.json` if it changed
80+
#### Build the rust code, and re-build `package.json` if it changed
7981

8082
`cargo build --target wasm32-unknown-unknown`
8183

82-
### Run Tests
84+
#### Run Tests
8385

8486
`wasm-pack test --safari --features unsafe-debug-query`
8587

8688
navigate to `http://localhost:8000` to observe test output
8789

88-
### Run Tests (headless)
90+
#### Run Tests (headless)
8991

9092
`wasm-pack test --safari --headless`
9193

92-
### Setting up the project in VSCode
94+
#### Setting up the project in VSCode
9395

9496
rust-analyzer does not like crates with different targets in the same workspace.
9597
If you want this to work well with your LSP, open `diesel-wasm-sqlite` as it's
9698
own project in VSCode.
99+
100+
### Opening a Pull Request
101+
102+
PR Title should follow
103+
[conventional commits format](https://www.conventionalcommits.org/en/v1.0.0/)
104+
105+
In short, if should be one of:
106+
107+
- `fix:` represents bug fixes, and results in a SemVer patch bump.
108+
- `feat:` represents a new feature, and results in a SemVer minor bump.
109+
- `<prefix>!:` (e.g. feat!:): represents a **breaking change** (indicated by the
110+
!) and results in a SemVer major bump.
111+
- `doc:` documentation changes
112+
- `perf:` changes related to performance
113+
- `refactor:` a refactor
114+
- `style:`
115+
- `test:`
116+
117+
You can add extra context to conventional commits by using parantheses, for
118+
instance if a PR touched only database-related code, a PR title may be:
119+
120+
- `feat(db): Add SQLCipher plaintext_header support to database connection`

flake.nix

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
cargo-audit
5151
chromedriver
5252
geckodriver
53+
54+
nodejs
55+
yarn-berry
5356
] ++ lib.optionals isDarwin [
5457
libiconv
5558
frameworks.CoreServices

src/ffi.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ pub async fn init_sqlite() {
9898
.expect("Serialization must be infallible for const struct");
9999
let mem = Memory::new(&js_sys::Object::from(mem))
100100
.expect("Wasm Memory could not be instantiated");
101+
let proxy_uri = wasm_bindgen::link_to!(module = "/src/js/sqlite3-opfs-async-proxy.js");
102+
tracing::debug!("proxy_uri={:?}", proxy_uri);
101103
let opts = serde_wasm_bindgen::to_value(&Opts {
102104
wasm_binary: WASM,
103105
wasm_memory: mem,
104-
proxy_uri: wasm_bindgen::link_to!(module = "/src/js/sqlite3-opfs-async-proxy.js"),
106+
proxy_uri,
105107
})
106108
.expect("serialization must be infallible for const struct");
107109
let opts = Object::from(opts);

tests/common/mod.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ static INIT: OnceCell<()> = OnceCell::const_new();
88
pub async fn init() {
99
INIT.get_or_init(|| async {
1010
console::log_1(&"INIT".into());
11-
tracing_wasm::set_as_global_default();
11+
let config = tracing_wasm::WASMLayerConfigBuilder::default()
12+
.set_console_config(tracing_wasm::ConsoleConfig::ReportWithoutConsoleColor)
13+
.build();
14+
tracing_wasm::set_as_global_default_with_config(config);
1215
console_error_panic_hook::set_once();
1316
diesel_wasm_sqlite::init_sqlite().await;
1417
})

tests/test/web.rs

-2
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,6 @@ async fn can_find() {
311311
tracing::info!("{changed} rows changed");
312312

313313
let res: Option<StoredBook> = dsl::books.find(1).first(&mut conn).optional().unwrap();
314-
tracing::debug!("res: {:?}", res);
315-
tracing::debug!("FIND RES: {:?}", res);
316314

317315
let res: Vec<StoredBook> = diesel::sql_query("SELECT * FROM books where (id = 1)")
318316
.load::<StoredBook>(&mut conn).unwrap();

0 commit comments

Comments
 (0)