Skip to content

Commit 115e174

Browse files
committed
Release v0.1.0
0 parents  commit 115e174

Some content is hidden

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

70 files changed

+11710
-0
lines changed

.envrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
watch_file flake.nix
2+
watch_file flake.lock
3+
mkdir -p .direnv
4+
eval "$(nix print-dev-env --profile "$(direnv_layout_dir)/flake-profile")"

.eslintrc.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require("@rushstack/eslint-patch/modern-module-resolution");
2+
3+
module.exports = {
4+
root: true,
5+
ignorePatterns: ["dist/", "*.js", "target/"],
6+
parserOptions: {
7+
tsconfigRootDir: __dirname,
8+
project: "tsconfig.json",
9+
},
10+
extends: ["@saberhq"],
11+
};

.github/dependabot.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
7+
- package-ecosystem: "npm"
8+
directory: "/"
9+
schedule:
10+
interval: "daily"
11+
- package-ecosystem: "cargo"
12+
directory: "/"
13+
schedule:
14+
interval: "daily"

.github/workflows/programs-e2e.yml

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
name: E2E
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
SOLANA_VERSION: "1.8.11"
12+
RUST_TOOLCHAIN: nightly-2021-12-09
13+
14+
jobs:
15+
sdk:
16+
runs-on: ubuntu-latest
17+
name: Build the SDK
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- uses: cachix/install-nix-action@v16
22+
with:
23+
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
24+
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
25+
extra_nix_config: |
26+
experimental-features = nix-command flakes
27+
- name: Setup Cachix
28+
uses: cachix/cachix-action@v10
29+
with:
30+
name: saber
31+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
32+
- name: Parse IDLs
33+
run: nix shell .#ci --command ./scripts/parse-idls.sh
34+
35+
- name: Setup Node
36+
uses: actions/setup-node@v2
37+
with:
38+
always-auth: true
39+
40+
- name: Get yarn cache directory path
41+
id: yarn-cache-dir-path
42+
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
43+
- name: Yarn Cache
44+
uses: actions/cache@v2
45+
with:
46+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
47+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
48+
restore-keys: |
49+
${{ runner.os }}-modules-
50+
51+
- name: Install Yarn dependencies
52+
run: yarn install
53+
- run: ./scripts/generate-idl-types.sh
54+
- run: yarn build
55+
- run: yarn typecheck
56+
- run: yarn lint
57+
- run: yarn doctor
58+
59+
integration-tests:
60+
runs-on: ubuntu-latest
61+
steps:
62+
- uses: actions/checkout@v2
63+
64+
# Install Rust and Anchor
65+
- name: Install Rust nightly
66+
uses: actions-rs/toolchain@v1
67+
with:
68+
override: true
69+
profile: minimal
70+
toolchain: ${{ env.RUST_TOOLCHAIN }}
71+
- uses: Swatinem/rust-cache@v1
72+
- name: Install Linux dependencies
73+
run: |
74+
sudo apt-get update
75+
sudo apt-get install -y pkg-config build-essential libudev-dev
76+
77+
# Install Cachix
78+
- uses: cachix/install-nix-action@v16
79+
with:
80+
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
81+
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
82+
extra_nix_config: |
83+
experimental-features = nix-command flakes
84+
- name: Setup Cachix
85+
uses: cachix/cachix-action@v10
86+
with:
87+
name: saber
88+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
89+
90+
# Install Solana
91+
- name: Cache Solana binaries
92+
id: solana-cache
93+
uses: actions/cache@v2
94+
with:
95+
path: |
96+
~/.cache/solana
97+
~/.local/share/solana/install
98+
key: ${{ runner.os }}-${{ env.SOLANA_VERSION }}
99+
- name: Install Solana
100+
if: steps.solana-cache.outputs.cache-hit != 'true'
101+
run: |
102+
nix shell .#ci --command solana-install init ${{ env.SOLANA_VERSION }}
103+
- name: Setup Solana Path
104+
run: |
105+
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH
106+
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH"
107+
solana --version
108+
109+
# Run build
110+
- name: Build program
111+
run: nix shell .#ci --command anchor build
112+
- name: Download programs
113+
run: ./scripts/download-programs.sh
114+
115+
- name: Get yarn cache directory path
116+
id: yarn-cache-dir-path
117+
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
118+
- name: Yarn Cache
119+
uses: actions/cache@v2
120+
with:
121+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
122+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
123+
restore-keys: |
124+
${{ runner.os }}-modules-
125+
126+
- run: nix shell .#ci --command yarn install
127+
- name: Generate IDL types
128+
run: nix shell .#ci --command yarn idl:generate:nolint
129+
- run: yarn build
130+
- name: Run e2e tests
131+
run: nix shell .#ci --command yarn test:e2e
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Unit
2+
3+
on:
4+
push:
5+
branches: [master]
6+
paths:
7+
- .github/workflows/programs-unit.yml
8+
- programs/**
9+
- Cargo.toml
10+
- Cargo.lock
11+
pull_request:
12+
branches: [master]
13+
paths:
14+
- .github/workflows/programs-unit.yml
15+
- programs/**
16+
- Cargo.toml
17+
- Cargo.lock
18+
19+
env:
20+
CARGO_TERM_COLOR: always
21+
RUST_TOOLCHAIN: nightly-2021-12-10
22+
23+
jobs:
24+
lint:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Install Rust nightly
29+
uses: actions-rs/toolchain@v1
30+
with:
31+
override: true
32+
profile: minimal
33+
toolchain: ${{ env.RUST_TOOLCHAIN }}
34+
components: rustfmt, clippy
35+
- uses: Swatinem/rust-cache@v1
36+
- name: Run fmt
37+
run: cargo fmt -- --check
38+
- name: Run clippy
39+
run: cargo clippy --all-targets -- --deny=warnings
40+
- name: Check if publish works
41+
run: cargo publish --no-verify --dry-run
42+
43+
unit-tests:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- uses: actions/checkout@v2
47+
- name: Install Rust nightly
48+
uses: actions-rs/toolchain@v1
49+
with:
50+
override: true
51+
profile: minimal
52+
toolchain: ${{ env.RUST_TOOLCHAIN }}
53+
components: rustfmt, clippy
54+
- uses: Swatinem/rust-cache@v1
55+
- name: Run unit tests
56+
run: cargo test --lib
57+
58+
doc:
59+
runs-on: ubuntu-latest
60+
steps:
61+
- uses: actions/checkout@v2
62+
- name: Install Rust nightly
63+
uses: actions-rs/toolchain@v1
64+
with:
65+
override: true
66+
profile: minimal
67+
toolchain: ${{ env.RUST_TOOLCHAIN }}
68+
components: rustfmt, clippy
69+
- uses: Swatinem/rust-cache@v1
70+
- name: Generate docs
71+
run: cargo doc

.github/workflows/release.yml

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch: {}
5+
push:
6+
tags:
7+
- "v*.*.*"
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
RUST_TOOLCHAIN: nightly-2021-12-09
12+
NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
13+
14+
jobs:
15+
release-sdk:
16+
runs-on: ubuntu-latest
17+
name: Release SDK on NPM
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- uses: cachix/install-nix-action@v16
22+
with:
23+
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
24+
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
25+
extra_nix_config: |
26+
experimental-features = nix-command flakes
27+
- name: Setup Cachix
28+
uses: cachix/cachix-action@v10
29+
with:
30+
name: saber
31+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
32+
33+
- name: Setup Node
34+
uses: actions/setup-node@v2
35+
with:
36+
always-auth: true
37+
38+
- name: Get yarn cache directory path
39+
id: yarn-cache-dir-path
40+
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
41+
- name: Yarn Cache
42+
uses: actions/cache@v2
43+
with:
44+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
45+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
46+
restore-keys: |
47+
${{ runner.os }}-modules-
48+
49+
- name: Install Yarn dependencies
50+
run: yarn install
51+
- name: Parse IDLs
52+
run: nix shell .#ci --command yarn idl:generate
53+
- run: yarn build
54+
- run: |
55+
echo 'npmAuthToken: "${NPM_AUTH_TOKEN}"' >> .yarnrc.yml
56+
- name: Publish
57+
run: yarn npm publish
58+
59+
release-crate:
60+
runs-on: ubuntu-latest
61+
name: Release crate on crates.io
62+
steps:
63+
- uses: actions/checkout@v2
64+
65+
- uses: cachix/install-nix-action@v16
66+
with:
67+
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
68+
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
69+
extra_nix_config: |
70+
experimental-features = nix-command flakes
71+
- name: Setup Cachix
72+
uses: cachix/cachix-action@v10
73+
with:
74+
name: saber
75+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
76+
77+
- name: Install Rust nightly
78+
uses: actions-rs/toolchain@v1
79+
with:
80+
override: true
81+
profile: minimal
82+
toolchain: ${{ env.RUST_TOOLCHAIN }}
83+
- uses: Swatinem/rust-cache@v1
84+
- name: Publish crates
85+
run: nix shell .#ci --command cargo workspaces publish --from-git --yes --skip-published --token ${{ secrets.CARGO_PUBLISH_TOKEN }}
86+
87+
release-binaries:
88+
runs-on: ubuntu-latest
89+
name: Release verifiable binaries
90+
steps:
91+
- uses: actions/checkout@v2
92+
- uses: cachix/install-nix-action@v16
93+
with:
94+
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
95+
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
96+
extra_nix_config: |
97+
experimental-features = nix-command flakes
98+
- name: Setup Cachix
99+
uses: cachix/cachix-action@v10
100+
with:
101+
name: saber
102+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
103+
104+
- name: Build programs
105+
run: nix shell .#ci --command anchor build --verifiable
106+
- name: Release
107+
uses: softprops/action-gh-release@v1
108+
with:
109+
files: |
110+
target/deploy/*
111+
target/idl/*
112+
target/verifiable/*
113+
114+
site:
115+
runs-on: ubuntu-latest
116+
steps:
117+
- name: Checkout
118+
uses: actions/checkout@v2
119+
120+
- uses: cachix/install-nix-action@v16
121+
with:
122+
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install
123+
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve"
124+
extra_nix_config: |
125+
experimental-features = nix-command flakes
126+
- name: Setup Cachix
127+
uses: cachix/cachix-action@v10
128+
with:
129+
name: saber
130+
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
131+
132+
- name: Get yarn cache directory path
133+
id: yarn-cache-dir-path
134+
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
135+
- name: Yarn Cache
136+
uses: actions/cache@v2
137+
with:
138+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
139+
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
140+
restore-keys: |
141+
${{ runner.os }}-modules-
142+
143+
- name: Install Yarn dependencies
144+
run: yarn install
145+
- name: Parse IDLs
146+
run: nix shell .#ci --command yarn idl:generate
147+
- run: yarn docs:generate
148+
- run: cp -R images/ site/
149+
150+
- name: Deploy 🚀
151+
uses: JamesIves/[email protected]
152+
with:
153+
branch: gh-pages
154+
folder: site

0 commit comments

Comments
 (0)