Skip to content

Commit 8ad6589

Browse files
authored
Update lib_examples/base64_example (#77)
* Update lib_examples with recovered version * Add .gitignore and .gitmodules * Stop tracking target folder; now ignored by .gitignore * Stop tracking docs/configs from base64 lib and update .gitignore * Removed cached build files and added them to .gitignore * Remove node_modules from tracking and update .gitignore * Untrack Yarn cache and update .gitignore * modified * Added base64-example.yml
1 parent 707f852 commit 8ad6589

File tree

3 files changed

+48
-6
lines changed

3 files changed

+48
-6
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Run base64_example Tests on PR
2+
on:
3+
pull_request:
4+
paths:
5+
- "lib_examples/base64_example/**"
6+
schedule:
7+
- cron: "0 2 * * *"
8+
workflow_dispatch:
9+
10+
jobs:
11+
test:
12+
defaults:
13+
run:
14+
working-directory: lib_examples/base64_example
15+
permissions:
16+
issues: write
17+
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Install Nargo
23+
uses: noir-lang/[email protected]
24+
with:
25+
toolchain: stable
26+
27+
- name: Run Noir unit tests
28+
run: |
29+
nargo test
30+
31+
- name: Create issue on failure (nightly)
32+
if: failure() && github.event_name == 'schedule'
33+
uses: actions/github-script@v6
34+
with:
35+
script: |
36+
github.issues.create({
37+
owner: context.repo.owner,
38+
repo: context.repo.repo,
39+
title: '[Nightly] base64_example workflow failed',
40+
body: `The nightly base64_example workflow failed. Please investigate.\n\n/cc @noir-lang/developerrelations`,
41+
labels: ['nightly', 'bug']
42+
})

lib_examples/base64_example/Nargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ authors = [""]
55
compiler_version = ">=0.36.0"
66

77
[dependencies]
8-
base64 = {tag = "v0.3.1", git = "https://github.com/noir-lang/noir_base64.git"}
8+
noir_base64 = {tag = "v0.4.2", git = "https://github.com/noir-lang/noir_base64.git"}

lib_examples/base64_example/src/main.nr

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
mod test_inputs;
2-
use base64::{BASE64_ENCODER, BASE64_DECODER};
2+
use noir_base64;
33

44
// Choose number of encode and/or decode runs
55
pub global ENCODE_RUNS: u32 = 3;
@@ -13,20 +13,20 @@ comptime global U: u32 = comptime { TEST_INPUT.as_bytes().len() };
1313
comptime global B: u32 = comptime {
1414
let mut q = U / 3;
1515
let r = U - q * 3;
16-
if (r > 0) { q += 1; }; // round up since encoded base64 gets padded
16+
if (r > 0) { q += 1; } // round up since encoded base64 gets padded
1717
q * 4
1818
};
1919

2020
fn main(input: str<U>, base64_encoded: str<B>) {
2121
for _ in 0..ENCODE_RUNS {
22-
let _encoded: [u8; B] = BASE64_ENCODER.encode(input.as_bytes());
22+
let _encoded: [u8; B] = noir_base64::BASE64_ENCODER::encode(input.as_bytes());
2323
}
2424
for _ in 0..DECODE_RUNS {
25-
let _decoded: [u8; U] = BASE64_DECODER.decode(base64_encoded.as_bytes());
25+
let _decoded: [u8; U] = noir_base64::BASE64_DECODER::decode(base64_encoded.as_bytes());
2626
}
2727
}
2828

2929
#[test]
3030
fn test() {
3131
main(TEST_INPUT, TEST_BASE64_ENCODED);
32-
}
32+
}

0 commit comments

Comments
 (0)