-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 115e174
Showing
70 changed files
with
11,710 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
watch_file flake.nix | ||
watch_file flake.lock | ||
mkdir -p .direnv | ||
eval "$(nix print-dev-env --profile "$(direnv_layout_dir)/flake-profile")" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require("@rushstack/eslint-patch/modern-module-resolution"); | ||
|
||
module.exports = { | ||
root: true, | ||
ignorePatterns: ["dist/", "*.js", "target/"], | ||
parserOptions: { | ||
tsconfigRootDir: __dirname, | ||
project: "tsconfig.json", | ||
}, | ||
extends: ["@saberhq"], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "npm" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" | ||
- package-ecosystem: "cargo" | ||
directory: "/" | ||
schedule: | ||
interval: "daily" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
name: E2E | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
SOLANA_VERSION: "1.8.11" | ||
RUST_TOOLCHAIN: nightly-2021-12-09 | ||
|
||
jobs: | ||
sdk: | ||
runs-on: ubuntu-latest | ||
name: Build the SDK | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: cachix/install-nix-action@v16 | ||
with: | ||
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install | ||
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve" | ||
extra_nix_config: | | ||
experimental-features = nix-command flakes | ||
- name: Setup Cachix | ||
uses: cachix/cachix-action@v10 | ||
with: | ||
name: saber | ||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
- name: Parse IDLs | ||
run: nix shell .#ci --command ./scripts/parse-idls.sh | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
always-auth: true | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | ||
- name: Yarn Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-modules- | ||
- name: Install Yarn dependencies | ||
run: yarn install | ||
- run: ./scripts/generate-idl-types.sh | ||
- run: yarn build | ||
- run: yarn typecheck | ||
- run: yarn lint | ||
- run: yarn doctor | ||
|
||
integration-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
# Install Rust and Anchor | ||
- name: Install Rust nightly | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
override: true | ||
profile: minimal | ||
toolchain: ${{ env.RUST_TOOLCHAIN }} | ||
- uses: Swatinem/rust-cache@v1 | ||
- name: Install Linux dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y pkg-config build-essential libudev-dev | ||
# Install Cachix | ||
- uses: cachix/install-nix-action@v16 | ||
with: | ||
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install | ||
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve" | ||
extra_nix_config: | | ||
experimental-features = nix-command flakes | ||
- name: Setup Cachix | ||
uses: cachix/cachix-action@v10 | ||
with: | ||
name: saber | ||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
|
||
# Install Solana | ||
- name: Cache Solana binaries | ||
id: solana-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cache/solana | ||
~/.local/share/solana/install | ||
key: ${{ runner.os }}-${{ env.SOLANA_VERSION }} | ||
- name: Install Solana | ||
if: steps.solana-cache.outputs.cache-hit != 'true' | ||
run: | | ||
nix shell .#ci --command solana-install init ${{ env.SOLANA_VERSION }} | ||
- name: Setup Solana Path | ||
run: | | ||
echo "$HOME/.local/share/solana/install/active_release/bin" >> $GITHUB_PATH | ||
export PATH="/home/runner/.local/share/solana/install/active_release/bin:$PATH" | ||
solana --version | ||
# Run build | ||
- name: Build program | ||
run: nix shell .#ci --command anchor build | ||
- name: Download programs | ||
run: ./scripts/download-programs.sh | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | ||
- name: Yarn Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-modules- | ||
- run: nix shell .#ci --command yarn install | ||
- name: Generate IDL types | ||
run: nix shell .#ci --command yarn idl:generate:nolint | ||
- run: yarn build | ||
- name: Run e2e tests | ||
run: nix shell .#ci --command yarn test:e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: Unit | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
paths: | ||
- .github/workflows/programs-unit.yml | ||
- programs/** | ||
- Cargo.toml | ||
- Cargo.lock | ||
pull_request: | ||
branches: [master] | ||
paths: | ||
- .github/workflows/programs-unit.yml | ||
- programs/** | ||
- Cargo.toml | ||
- Cargo.lock | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
RUST_TOOLCHAIN: nightly-2021-12-10 | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Rust nightly | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
override: true | ||
profile: minimal | ||
toolchain: ${{ env.RUST_TOOLCHAIN }} | ||
components: rustfmt, clippy | ||
- uses: Swatinem/rust-cache@v1 | ||
- name: Run fmt | ||
run: cargo fmt -- --check | ||
- name: Run clippy | ||
run: cargo clippy --all-targets -- --deny=warnings | ||
- name: Check if publish works | ||
run: cargo publish --no-verify --dry-run | ||
|
||
unit-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Rust nightly | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
override: true | ||
profile: minimal | ||
toolchain: ${{ env.RUST_TOOLCHAIN }} | ||
components: rustfmt, clippy | ||
- uses: Swatinem/rust-cache@v1 | ||
- name: Run unit tests | ||
run: cargo test --lib | ||
|
||
doc: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install Rust nightly | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
override: true | ||
profile: minimal | ||
toolchain: ${{ env.RUST_TOOLCHAIN }} | ||
components: rustfmt, clippy | ||
- uses: Swatinem/rust-cache@v1 | ||
- name: Generate docs | ||
run: cargo doc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: {} | ||
push: | ||
tags: | ||
- "v*.*.*" | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
RUST_TOOLCHAIN: nightly-2021-12-09 | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | ||
|
||
jobs: | ||
release-sdk: | ||
runs-on: ubuntu-latest | ||
name: Release SDK on NPM | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: cachix/install-nix-action@v16 | ||
with: | ||
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install | ||
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve" | ||
extra_nix_config: | | ||
experimental-features = nix-command flakes | ||
- name: Setup Cachix | ||
uses: cachix/cachix-action@v10 | ||
with: | ||
name: saber | ||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
always-auth: true | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | ||
- name: Yarn Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-modules- | ||
- name: Install Yarn dependencies | ||
run: yarn install | ||
- name: Parse IDLs | ||
run: nix shell .#ci --command yarn idl:generate | ||
- run: yarn build | ||
- run: | | ||
echo 'npmAuthToken: "${NPM_AUTH_TOKEN}"' >> .yarnrc.yml | ||
- name: Publish | ||
run: yarn npm publish | ||
|
||
release-crate: | ||
runs-on: ubuntu-latest | ||
name: Release crate on crates.io | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: cachix/install-nix-action@v16 | ||
with: | ||
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install | ||
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve" | ||
extra_nix_config: | | ||
experimental-features = nix-command flakes | ||
- name: Setup Cachix | ||
uses: cachix/cachix-action@v10 | ||
with: | ||
name: saber | ||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
|
||
- name: Install Rust nightly | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
override: true | ||
profile: minimal | ||
toolchain: ${{ env.RUST_TOOLCHAIN }} | ||
- uses: Swatinem/rust-cache@v1 | ||
- name: Publish crates | ||
run: nix shell .#ci --command cargo workspaces publish --from-git --yes --skip-published --token ${{ secrets.CARGO_PUBLISH_TOKEN }} | ||
|
||
release-binaries: | ||
runs-on: ubuntu-latest | ||
name: Release verifiable binaries | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: cachix/install-nix-action@v16 | ||
with: | ||
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install | ||
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve" | ||
extra_nix_config: | | ||
experimental-features = nix-command flakes | ||
- name: Setup Cachix | ||
uses: cachix/cachix-action@v10 | ||
with: | ||
name: saber | ||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
|
||
- name: Build programs | ||
run: nix shell .#ci --command anchor build --verifiable | ||
- name: Release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: | | ||
target/deploy/* | ||
target/idl/* | ||
target/verifiable/* | ||
site: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- uses: cachix/install-nix-action@v16 | ||
with: | ||
install_url: https://nixos-nix-install-tests.cachix.org/serve/i6laym9jw3wg9mw6ncyrk6gjx4l34vvx/install | ||
install_options: "--tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve" | ||
extra_nix_config: | | ||
experimental-features = nix-command flakes | ||
- name: Setup Cachix | ||
uses: cachix/cachix-action@v10 | ||
with: | ||
name: saber | ||
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
|
||
- name: Get yarn cache directory path | ||
id: yarn-cache-dir-path | ||
run: echo "::set-output name=dir::$(yarn config get cacheFolder)" | ||
- name: Yarn Cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | ||
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-modules- | ||
- name: Install Yarn dependencies | ||
run: yarn install | ||
- name: Parse IDLs | ||
run: nix shell .#ci --command yarn idl:generate | ||
- run: yarn docs:generate | ||
- run: cp -R images/ site/ | ||
|
||
- name: Deploy 🚀 | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
folder: site |
Oops, something went wrong.