Skip to content

Commit 4349081

Browse files
authored
Merge pull request #7 from scrtlabs/secret-cw1.1
Secret cw1.1
2 parents ca0cbb1 + 310f940 commit 4349081

File tree

295 files changed

+15708
-25302
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

295 files changed

+15708
-25302
lines changed

.circleci/config.yml

Lines changed: 172 additions & 84 deletions
Large diffs are not rendered by default.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# install-rust
2+
3+
A small github action to install `rustup` and a Rust toolchain. This is
4+
generally expressed inline, but it was repeated enough in this repository it
5+
seemed worthwhile to extract.
6+
7+
Some gotchas:
8+
9+
- Can't `--self-update` on Windows due to permission errors (a bug in Github
10+
Actions)
11+
- `rustup` isn't installed on macOS (a bug in Github Actions)
12+
13+
When the above are fixed we should delete this action and just use this inline:
14+
15+
```yml
16+
- run: rustup update $toolchain && rustup default $toolchain
17+
shell: bash
18+
```
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: "Install Rust toolchain"
2+
description: "Install both `rustup` and a Rust toolchain"
3+
4+
inputs:
5+
toolchain:
6+
description: "Default toolchain to install"
7+
required: false
8+
default: "stable"
9+
10+
runs:
11+
using: node16
12+
main: "main.js"

.github/actions/install-rust/main.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const child_process = require('child_process');
2+
const toolchain = process.env.INPUT_TOOLCHAIN;
3+
const fs = require('fs');
4+
5+
function set_env(name, val) {
6+
fs.appendFileSync(process.env['GITHUB_ENV'], `${name}=${val}\n`)
7+
}
8+
9+
// Needed for now to get 1.24.2 which fixes a bug in 1.24.1 that causes issues
10+
// on Windows.
11+
if (process.platform === 'win32') {
12+
child_process.execFileSync('rustup', ['self', 'update']);
13+
}
14+
15+
child_process.execFileSync('rustup', ['set', 'profile', 'minimal']);
16+
child_process.execFileSync('rustup', ['update', toolchain, '--no-self-update']);
17+
child_process.execFileSync('rustup', ['default', toolchain]);
18+
19+
// Deny warnings on CI to keep our code warning-free as it lands in-tree. Don't
20+
// do this on nightly though since there's a fair amount of warning churn there.
21+
// RUSTIX: Disable this so that it doesn't overwrite RUSTFLAGS for setting
22+
// "--cfg rustix_use_libc". We re-add it manually in the workflow.
23+
//if (!toolchain.startsWith('nightly')) {
24+
// set_env("RUSTFLAGS", "-D warnings");
25+
//}
26+
27+
// Save disk space by avoiding incremental compilation, and also we don't use
28+
// any caching so incremental wouldn't help anyway.
29+
set_env("CARGO_INCREMENTAL", "0");
30+
31+
// Turn down debuginfo from 2 to 1 to help save disk space
32+
set_env("CARGO_PROFILE_DEV_DEBUG", "1");
33+
set_env("CARGO_PROFILE_TEST_DEBUG", "1");
34+
35+
if (process.platform === 'darwin') {
36+
set_env("CARGO_PROFILE_DEV_SPLIT_DEBUGINFO", "unpacked");
37+
set_env("CARGO_PROFILE_TEST_SPLIT_DEBUGINFO", "unpacked");
38+
}

.github/workflows/ci.yml

Lines changed: 44 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,68 @@
11
name: Contract Development
22

3-
# Pushes to long living branches and all PRs
4-
on:
5-
push:
6-
branches:
7-
- main
8-
- 0.[0-9]+
9-
pull_request:
3+
## Pushes to long living branches and all PRs
4+
on: [push, pull_request]
5+
# push:
6+
# branches:
7+
# - secret
8+
# - 0.[0-9]+
9+
# pull_request:
1010

1111
env:
1212
RUST_BACKTRACE: 1
1313

1414
jobs:
15+
test-packages:
16+
name: Package Tests for ${{ matrix.build }} ${{ matrix.rust }}
17+
runs-on: ${{ matrix.os }}
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [ubuntu-latest, macos-latest, windows-latest]
22+
rust: [1.60.0, stable]
23+
24+
steps:
25+
- name: Checkout sources
26+
uses: actions/checkout@v3
27+
- name: Install Rust
28+
uses: actions-rs/toolchain@v1
29+
with:
30+
toolchain: ${{ matrix.rust }}
31+
target: wasm32-unknown-unknown
32+
profile: minimal
33+
override: true
34+
- name: Build std
35+
run: cargo build
36+
- name: Test std
37+
run: cargo test
38+
1539
test-hackatom:
16-
name: ${{ matrix.build }}
40+
name: Contract Tests for ${{ matrix.build }} ${{ matrix.rust }}
1741
runs-on: ${{ matrix.os }}
1842
strategy:
1943
fail-fast: false
2044
matrix:
21-
include:
22-
- build: macOS
23-
os: macOS-latest
24-
- build: Windows
25-
os: windows-latest
45+
os: [ubuntu-latest, macos-latest, windows-latest]
46+
rust: [1.60.0, stable]
47+
2648
defaults:
2749
run:
2850
shell: bash
2951
working-directory: ./contracts/hackatom
3052
steps:
3153
- name: Checkout sources
32-
uses: actions/checkout@v2
54+
uses: actions/checkout@v3
3355
- name: Install Rust
34-
uses: actions-rs/toolchain@v1
56+
uses: ./.github/actions/install-rust
3557
with:
36-
toolchain: 1.56.1
37-
target: wasm32-unknown-unknown
38-
profile: minimal
39-
override: true
58+
toolchain: ${{ matrix.rust }}
59+
- name: Add wasm toolchain
60+
run: |
61+
rustup target add wasm32-unknown-unknown
62+
4063
- name: Build hackatom wasm
4164
run: cargo wasm --locked
4265
- name: Unit Test hackatom
4366
run: cargo unit-test --locked
44-
- name: Integration Test hackatom
45-
run: cargo integration-test --locked
67+
# - name: Integration Test hackatom
68+
# run: cargo integration-test --locked

.github/workflows/lint.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
on: [push, pull_request]
2+
3+
name: Linting
4+
5+
jobs:
6+
lints:
7+
name: ${{ matrix.make.name }} ${{ matrix.rust }} (${{ matrix.os }})
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ubuntu-latest, macos-latest, windows-latest]
13+
rust: [1.60.0, stable]
14+
make:
15+
- name: Clippy
16+
task: "cargo clippy"
17+
18+
env:
19+
RUST_BACKTRACE: full
20+
RUSTV: ${{ matrix.rust }}
21+
steps:
22+
- uses: actions/checkout@v3
23+
24+
- name: Install Rust
25+
uses: ./.github/actions/install-rust
26+
with:
27+
toolchain: ${{ matrix.rust }}
28+
- name: Add wasm toolchain
29+
run: |
30+
rustup target add wasm32-unknown-unknown
31+
32+
- name: Install Clippy
33+
if: matrix.make.name == 'Clippy'
34+
run: |
35+
rustup component add clippy
36+
37+
- name: ${{ matrix.make.name }}
38+
run: ${{ matrix.make.task }}

.mergify.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ pull_request_rules:
99
- label!=WIP
1010
# We need to list them all individually. Here is why: https://doc.mergify.io/conditions.html#validating-all-status-check
1111
- "status-success=ci/circleci: package_crypto"
12-
- "status-success=ci/circleci: package_profiler"
1312
- "status-success=ci/circleci: package_schema"
1413
- "status-success=ci/circleci: package_std"
1514
- "status-success=ci/circleci: package_storage"

0 commit comments

Comments
 (0)