Compare commits
70
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
212c9198eb | ||
|
|
be0a57a1d9 | ||
|
|
8bdcd8fb83 | ||
|
|
885a4571ff | ||
|
|
e746efcb94 | ||
|
|
16c9d4962a | ||
|
|
283287f74f | ||
|
|
98f3eb75c0 | ||
|
|
853cb845ff | ||
|
|
e9a3c3a669 | ||
|
|
895081e509 | ||
|
|
b76b74cb63 | ||
|
|
289ad40d86 | ||
|
|
f0c9d4d904 | ||
|
|
f6b5df831e | ||
|
|
d1d7c576cf | ||
|
|
8d19cdeae6 | ||
|
|
52e6093011 | ||
|
|
7fd9c8eee3 | ||
|
|
f302bbbb24 | ||
|
|
b22b494ede | ||
|
|
6c23ce847d | ||
|
|
6a466a611f | ||
|
|
1300d7e372 | ||
|
|
66e4f3d47a | ||
|
|
37028cc3eb | ||
|
|
0e6fd9269b | ||
|
|
3d63bbb3eb | ||
|
|
5d8f14c992 | ||
|
|
6f87f48dca | ||
|
|
7d398caa66 | ||
|
|
96dd7bf6d2 | ||
|
|
59249d44d3 | ||
|
|
f011557cd5 | ||
|
|
d52996c02a | ||
|
|
b59aa8d9c1 | ||
|
|
523ec5fd0b | ||
|
|
a1d8e34390 | ||
|
|
2d6233cdc7 | ||
|
|
eb9dcf830b | ||
|
|
af49d4905d | ||
|
|
8fa9e5d9e6 | ||
|
|
492fe68c9e | ||
|
|
f215cb3196 | ||
|
|
6e3b798273 | ||
|
|
16b55b58e3 | ||
|
|
90a2fe12d5 | ||
|
|
bc38a4a787 | ||
|
|
654b205e00 | ||
|
|
ece32ef55f | ||
|
|
5cd77eb5de | ||
|
|
e7a23faa5a | ||
|
|
e0f9b1ab50 | ||
|
|
323e45ab0e | ||
|
|
6fd329e047 | ||
|
|
7d602d2f03 | ||
|
|
78b9416985 | ||
|
|
d2afef19a9 | ||
|
|
e67ffcd204 | ||
|
|
6cf9ed1620 | ||
|
|
4f21677ae5 | ||
|
|
9f7d8ebb51 | ||
|
|
81d726cca2 | ||
|
|
74ba049b5c | ||
|
|
46a4f58019 | ||
|
|
e9d7200a05 | ||
|
|
544711885e | ||
|
|
7d3cebea79 | ||
|
|
1ce22d9d9f | ||
|
|
4eef88b5df |
@@ -1,9 +1,8 @@
|
|||||||
name: public-benchmark-pages
|
name: public-benchmark-pages
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_run:
|
schedule:
|
||||||
workflows: [main-release-gate]
|
- cron: '*/15 * * * *'
|
||||||
types: [completed]
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
@@ -19,10 +18,8 @@ jobs:
|
|||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install SSH client
|
- name: Install SSH client
|
||||||
run: |
|
run: |
|
||||||
if ! command -v ssh >/dev/null 2>&1; then
|
apt-get update -qq
|
||||||
apt-get update -qq
|
apt-get install -y -qq --no-install-recommends openssh-client
|
||||||
apt-get install -y -qq --no-install-recommends openssh-client
|
|
||||||
fi
|
|
||||||
- name: Render measured benchmark history
|
- name: Render measured benchmark history
|
||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
name: completed-ci-badge
|
name: completed-ci-badge
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_run:
|
schedule:
|
||||||
workflows: [main-release-gate, next-build]
|
- cron: '*/15 * * * *'
|
||||||
types: [completed]
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
@@ -12,7 +11,7 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
runs-on: alkane-fast
|
runs-on: alkane-ci
|
||||||
permissions:
|
permissions:
|
||||||
actions: read
|
actions: read
|
||||||
contents: write
|
contents: write
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
name: source-pr
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
branches: [main, next]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: alkane-os-source-pr-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
source:
|
|
||||||
runs-on: alkane-fast
|
|
||||||
env:
|
|
||||||
CARGO_TARGET_DIR: target
|
|
||||||
CARGO_BUILD_JOBS: 2
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Detect README-only change
|
|
||||||
id: surface
|
|
||||||
run: |
|
|
||||||
surface=full
|
|
||||||
if [ "$GITHUB_EVENT_NAME" = pull_request ] &&
|
|
||||||
{ [ "$GITHUB_BASE_REF" = main ] || [ "$GITHUB_BASE_REF" = next ]; } &&
|
|
||||||
base="$(git merge-base HEAD "origin/$GITHUB_BASE_REF" 2>/dev/null)" &&
|
|
||||||
changed="$(git diff --name-only "$base" HEAD)" &&
|
|
||||||
[ "$changed" = README.md ]; then
|
|
||||||
surface=documentation
|
|
||||||
fi
|
|
||||||
echo "surface=$surface" >> "$GITHUB_OUTPUT"
|
|
||||||
- name: Check README-only change
|
|
||||||
if: steps.surface.outputs.surface == 'documentation'
|
|
||||||
run: |
|
|
||||||
base="$(git merge-base HEAD "origin/$GITHUB_BASE_REF")"
|
|
||||||
git diff --check "$base" HEAD
|
|
||||||
if git grep -nIE '^[[:space:]]*-----BEGIN (RSA |EC |OPENSSH )?PRIVATE KEY-----[[:space:]]*$' --; then
|
|
||||||
echo "private key material found in tracked source" >&2
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
status=$?
|
|
||||||
[ "$status" -eq 1 ]
|
|
||||||
fi
|
|
||||||
- name: Check source
|
|
||||||
if: steps.surface.outputs.surface != 'documentation'
|
|
||||||
run: |
|
|
||||||
rustup component add rustfmt
|
|
||||||
cargo fmt --check
|
|
||||||
cargo test --locked
|
|
||||||
- name: Clean generated source check
|
|
||||||
if: always()
|
|
||||||
run: python3 ci/cleanup-generated.py
|
|
||||||
@@ -22,10 +22,8 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
- name: Install Pages SSH client
|
- name: Install Pages SSH client
|
||||||
run: |
|
run: |
|
||||||
if ! command -v ssh >/dev/null 2>&1; then
|
apt-get update -qq
|
||||||
apt-get update -qq
|
apt-get install -y -qq --no-install-recommends openssh-client
|
||||||
apt-get install -y -qq --no-install-recommends openssh-client
|
|
||||||
fi
|
|
||||||
- name: Install Rust quality tools
|
- name: Install Rust quality tools
|
||||||
run: rustup component add rustfmt clippy
|
run: rustup component add rustfmt clippy
|
||||||
- name: Formatting
|
- name: Formatting
|
||||||
@@ -56,18 +54,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
cargo test --release --locked -- --ignored --nocapture --test-threads=1 | tee bench-current.txt
|
cargo test --release --locked -- --ignored --nocapture --test-threads=1 | tee bench-current.txt
|
||||||
- name: Restore coverage tool
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: /root/.cargo/bin/cargo-llvm-cov
|
|
||||||
key: cargo-llvm-cov-0.8.7-rust-1.97.1-${{ runner.os }}
|
|
||||||
- name: Coverage tool
|
- name: Coverage tool
|
||||||
run: |
|
run: |
|
||||||
rustup component add llvm-tools-preview
|
rustup component add llvm-tools-preview
|
||||||
if [ "$(cargo llvm-cov --version 2>/dev/null || true)" != 'cargo-llvm-cov 0.8.7' ]; then
|
if ! command -v cargo-llvm-cov >/dev/null 2>&1; then
|
||||||
cargo install --locked --force cargo-llvm-cov --version 0.8.7
|
cargo install --locked cargo-llvm-cov --version 0.8.7
|
||||||
fi
|
fi
|
||||||
[ "$(cargo llvm-cov --version)" = 'cargo-llvm-cov 0.8.7' ]
|
|
||||||
- name: Unit test coverage
|
- name: Unit test coverage
|
||||||
run: |
|
run: |
|
||||||
mkdir -p coverage
|
mkdir -p coverage
|
||||||
|
|||||||
@@ -10,10 +10,9 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: alkane-fast
|
runs-on: alkane-ci
|
||||||
env:
|
env:
|
||||||
CARGO_TARGET_DIR: target
|
CARGO_TARGET_DIR: target
|
||||||
CARGO_BUILD_JOBS: 2
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -55,8 +55,8 @@ def publish(api: str, repo: str, branch: str, data: bytes, token: str) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
if os.environ["GITHUB_EVENT_NAME"] not in ("workflow_run", "workflow_dispatch"):
|
if os.environ["GITHUB_EVENT_NAME"] not in ("schedule", "workflow_dispatch"):
|
||||||
raise RuntimeError("badge publisher must follow CI completion or manual dispatch")
|
raise RuntimeError("badge publisher must run on a timer or manual dispatch")
|
||||||
if os.environ["GITHUB_REF"] != "refs/heads/main":
|
if os.environ["GITHUB_REF"] != "refs/heads/main":
|
||||||
raise RuntimeError("badge publisher must use the main branch")
|
raise RuntimeError("badge publisher must use the main branch")
|
||||||
repo = os.environ["GITHUB_REPOSITORY"]
|
repo = os.environ["GITHUB_REPOSITORY"]
|
||||||
|
|||||||
@@ -21,12 +21,8 @@ PAGES_HOST_KEY = "[gitea.bluefla.re]:2222 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO
|
|||||||
|
|
||||||
def run(*args: str, env: dict[str, str] | None = None,
|
def run(*args: str, env: dict[str, str] | None = None,
|
||||||
cwd: Path | None = None) -> subprocess.CompletedProcess[str]:
|
cwd: Path | None = None) -> subprocess.CompletedProcess[str]:
|
||||||
result = subprocess.run(args, env=env, cwd=cwd, text=True,
|
return subprocess.run(args, env=env, cwd=cwd, text=True,
|
||||||
capture_output=True, check=False)
|
capture_output=True, check=True)
|
||||||
if result.returncode:
|
|
||||||
detail = result.stderr.strip()[:2000]
|
|
||||||
raise RuntimeError(f"{args[0]} {args[1]} exited {result.returncode}: {detail}")
|
|
||||||
return result
|
|
||||||
|
|
||||||
|
|
||||||
def current_main_sha() -> str:
|
def current_main_sha() -> str:
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ assert b">fail</text>" in svg
|
|||||||
assert b"#d1242f" in svg
|
assert b"#d1242f" in svg
|
||||||
assert b">pass</text>" in module.badge("next", "success", 108)
|
assert b">pass</text>" in module.badge("next", "success", 108)
|
||||||
environment = {
|
environment = {
|
||||||
"GITHUB_EVENT_NAME": "workflow_run",
|
"GITHUB_EVENT_NAME": "schedule",
|
||||||
"GITHUB_REF": "refs/heads/main",
|
"GITHUB_REF": "refs/heads/main",
|
||||||
"GITHUB_REPOSITORY": "owner/repo",
|
"GITHUB_REPOSITORY": "owner/repo",
|
||||||
"GITHUB_API_URL": "https://example.invalid/api/v1",
|
"GITHUB_API_URL": "https://example.invalid/api/v1",
|
||||||
@@ -49,19 +49,13 @@ with patch.dict(os.environ, environment), \
|
|||||||
module.main()
|
module.main()
|
||||||
assert latest.call_count == 2
|
assert latest.call_count == 2
|
||||||
assert [call.args[2] for call in published.call_args_list] == ["main", "next"]
|
assert [call.args[2] for call in published.call_args_list] == ["main", "next"]
|
||||||
with patch.dict(os.environ, {**environment, "GITHUB_EVENT_NAME": "workflow_dispatch"}), \
|
with patch.dict(os.environ, {**environment, "GITHUB_EVENT_NAME": "workflow_run"}):
|
||||||
patch.object(module, "latest_completed", side_effect=[(201, "success"),
|
|
||||||
(202, "failure")]), \
|
|
||||||
patch.object(module, "publish") as published:
|
|
||||||
module.main()
|
|
||||||
assert published.call_count == 2
|
|
||||||
with patch.dict(os.environ, {**environment, "GITHUB_EVENT_NAME": "schedule"}):
|
|
||||||
try:
|
try:
|
||||||
module.main()
|
module.main()
|
||||||
except RuntimeError as error:
|
except RuntimeError as error:
|
||||||
assert "CI completion or manual dispatch" in str(error)
|
assert "timer or manual dispatch" in str(error)
|
||||||
else:
|
else:
|
||||||
raise AssertionError("scheduled event entered badge publisher")
|
raise AssertionError("workflow_run event entered badge publisher")
|
||||||
for invalid in ("", "/main.svg", "../main.svg", "badges//main.svg"):
|
for invalid in ("", "/main.svg", "../main.svg", "badges//main.svg"):
|
||||||
try:
|
try:
|
||||||
publish_file("https://example.invalid/api/v1", "owner/repo", invalid,
|
publish_file("https://example.invalid/api/v1", "owner/repo", invalid,
|
||||||
|
|||||||
+4
-13
@@ -105,12 +105,8 @@ impl PoolSession {
|
|||||||
Ok(false)
|
Ok(false)
|
||||||
}
|
}
|
||||||
PoolNotification::SetVersionMask(mask) => {
|
PoolNotification::SetVersionMask(mask) => {
|
||||||
if self.version_mask == Some(mask) {
|
|
||||||
return Ok(false);
|
|
||||||
}
|
|
||||||
self.version_mask = Some(mask);
|
self.version_mask = Some(mask);
|
||||||
self.tracked = std::array::from_fn(|_| None);
|
Ok(false)
|
||||||
Ok(true)
|
|
||||||
}
|
}
|
||||||
PoolNotification::SetExtranonce(subscription) => {
|
PoolNotification::SetExtranonce(subscription) => {
|
||||||
self.subscription = subscription;
|
self.subscription = subscription;
|
||||||
@@ -123,7 +119,7 @@ impl PoolSession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Apply a pool control message and invalidate the hardware miner's work
|
/// Apply a pool control message and invalidate the hardware miner's work
|
||||||
/// when an extranonce or version-mask change makes earlier jobs stale.
|
/// when an extranonce change makes earlier jobs stale.
|
||||||
pub fn control_with_miner<B: HardwareBackend>(
|
pub fn control_with_miner<B: HardwareBackend>(
|
||||||
&mut self,
|
&mut self,
|
||||||
miner: &mut Bm1366Miner<'_, B>,
|
miner: &mut Bm1366Miner<'_, B>,
|
||||||
@@ -364,15 +360,10 @@ mod tests {
|
|||||||
),
|
),
|
||||||
Err(SessionError::UnverifiedShare)
|
Err(SessionError::UnverifiedShare)
|
||||||
);
|
);
|
||||||
assert_eq!(
|
session.version_mask = VersionMask::new(0x0000_2000);
|
||||||
session.control(
|
|
||||||
b"{\"id\":null,\"method\":\"mining.set_version_mask\",\"params\":[\"00002000\"]}"
|
|
||||||
),
|
|
||||||
Ok(true)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
session.submission(share, "miner.worker", 8),
|
session.submission(share, "miner.worker", 8),
|
||||||
Err(SessionError::StaleShare)
|
Err(SessionError::Submit(SubmitError::UnrepresentableVersion))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,27 +52,9 @@ fn difficulty_changes_on_next_job_and_old_work_keeps_its_target() {
|
|||||||
assert_eq!(second.work_id, 8);
|
assert_eq!(second.work_id, 8);
|
||||||
assert_eq!(&second.target_le[26..28], &[0xff, 0x7f]);
|
assert_eq!(&second.target_le[26..28], &[0xff, 0x7f]);
|
||||||
assert_ne!(first.header, second.header);
|
assert_ne!(first.header, second.header);
|
||||||
assert_eq!(
|
assert!(pool
|
||||||
pool.control(br#"{"id":null,"method":"mining.set_version_mask","params":["00006000"]}"#),
|
.control(br#"{"id":null,"method":"mining.set_version_mask","params":["00006000"]}"#)
|
||||||
Ok(true)
|
.is_ok());
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
pool.submission(
|
|
||||||
ValidShare {
|
|
||||||
nonce: 0xedad_ff38,
|
|
||||||
work_id: first.work_id,
|
|
||||||
rolled_version: 0x2000_0000,
|
|
||||||
hash_le: [0; 32],
|
|
||||||
},
|
|
||||||
"worker",
|
|
||||||
10,
|
|
||||||
),
|
|
||||||
Err(SessionError::StaleShare)
|
|
||||||
);
|
|
||||||
assert_eq!(
|
|
||||||
pool.control(br#"{"id":null,"method":"mining.set_version_mask","params":["00006000"]}"#),
|
|
||||||
Ok(false)
|
|
||||||
);
|
|
||||||
let clean = pool.issue_notify(notify("third", true).as_bytes()).unwrap();
|
let clean = pool.issue_notify(notify("third", true).as_bytes()).unwrap();
|
||||||
assert!(clean.clean_jobs);
|
assert!(clean.clean_jobs);
|
||||||
assert_eq!(clean.work_id, 16);
|
assert_eq!(clean.work_id, 16);
|
||||||
@@ -219,7 +201,7 @@ impl HardwareBackend for FakeBackend {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn pool_job_dispatch_and_version_mask_invalidation_reach_the_miner() {
|
fn pool_job_dispatch_and_extranonce_invalidation_reach_the_miner() {
|
||||||
let mut backend = FakeBackend {
|
let mut backend = FakeBackend {
|
||||||
powered: false,
|
powered: false,
|
||||||
sent: 0,
|
sent: 0,
|
||||||
@@ -244,7 +226,7 @@ fn pool_job_dispatch_and_version_mask_invalidation_reach_the_miner() {
|
|||||||
}
|
}
|
||||||
pool.control_with_miner(
|
pool.control_with_miner(
|
||||||
&mut miner,
|
&mut miner,
|
||||||
br#"{"id":null,"method":"mining.set_version_mask","params":["00006000"]}"#,
|
br#"{"id":null,"method":"mining.set_extranonce","params":["aabbccdd",4]}"#,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
assert_eq!(miner.poll(), Err(MinerError::StaleReport));
|
assert_eq!(miner.poll(), Err(MinerError::StaleReport));
|
||||||
|
|||||||
Reference in New Issue
Block a user