From 932f4d86f88aff4598aa7af6767f89f2f1e50150 Mon Sep 17 00:00:00 2001 From: Alistair Date: Thu, 12 Oct 2023 18:30:25 +0100 Subject: [PATCH] Fix --- .github/workflows/pull-request-nix.yml | 32 ------- .github/workflows/pull-request.yml | 111 +++++++++++++++++++------ .gitignore | 2 + .prettierignore | 6 ++ packages/jstz-types/index.d.ts | 2 +- packages/jstz/index.js | 3 - packages/jstz/package.json | 2 +- 7 files changed, 95 insertions(+), 63 deletions(-) delete mode 100644 .github/workflows/pull-request-nix.yml create mode 100644 .prettierignore delete mode 100644 packages/jstz/index.js diff --git a/.github/workflows/pull-request-nix.yml b/.github/workflows/pull-request-nix.yml deleted file mode 100644 index b3ea98d59..000000000 --- a/.github/workflows/pull-request-nix.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Build (Nix) - -on: - pull_request: - push: - branches: [main] - -jobs: - build-nix: - name: Build (Nix) - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: cachix/install-nix-action@v20 - with: - nix_path: nixpkgs=channel:nixos-unstable - - uses: cachix/cachix-action@v12 - with: - name: trilitech-jstz - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - - - name: Build - run: nix build - - - name: Build Shell - run: nix develop --command bash -c "echo 'Hello World'" - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: kernel - path: result/lib diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 93cf0f467..fc77aad8d 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -6,41 +6,100 @@ on: branches: [main] jobs: - # fmt: - # name: Format - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v4 - # - uses: actions-rs/toolchain@v1 - # with: - # profile: minimal - # override: true - # components: rustfmt - # - uses: luisnquin/setup-alejandra@v1.0.0 - - # - name: Format (rustfmt) - # run: make fmt-rust-check - - # - name: Format (prettier) - # run: npx prettier --check . - - # - name: Format (Nix) - # run: make fmt-nix-check + fmt: + name: Format + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + override: true + components: rustfmt + - uses: luisnquin/setup-alejandra@v1.0.0 + + - name: Format (rustfmt) + run: make fmt-rust-check + + - name: Format (prettier) + run: npx prettier --check . + + - name: Format (Nix) + run: make fmt-nix-check build: - name: Build `jstz_kernel` + name: Build (Cargo) runs-on: ubuntu-latest + needs: fmt steps: - uses: actions/checkout@v4 - uses: actions-rs/toolchain@v1 with: profile: minimal override: true - target: wasm32-unknown-unknown - - uses: KyleMayes/install-llvm-action@v1 + - uses: actions/cache@v3 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Build + run: cargo build + + build-sdk: + name: Build TypeScript SDK + runs-on: ubuntu-latest + needs: fmt + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 with: - version: 16.0.0 - env: true + node-version: 18 + cache: npm + - name: Get npm cache directory + id: npm-cache-dir + shell: bash + run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT} + - name: Configure npm cache + uses: actions/cache@v3 + id: npm-cache + with: + path: ${{ steps.npm-cache-dir.outputs.dir }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + + - run: npm ci - name: Build - run: make build + run: cd packages/jstz && npm run build + + build-nix: + name: Build (Nix) + runs-on: ubuntu-latest + needs: [build, build-sdk] + steps: + - uses: actions/checkout@v4 + - uses: cachix/install-nix-action@v20 + with: + nix_path: nixpkgs=channel:nixos-unstable + - uses: cachix/cachix-action@v12 + with: + name: trilitech-jstz + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + + - name: Build Shell + run: nix develop --command bash -c "echo 'Hello World'" + + - name: Build + run: nix build + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: kernel + path: result/lib diff --git a/.gitignore b/.gitignore index 0800a5894..b324043a9 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,5 @@ node_modules/ # Vitepress directories **/.vitepress/cache **/.vitepress/dist + +**/dist diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..a34b8aa7e --- /dev/null +++ b/.prettierignore @@ -0,0 +1,6 @@ +# Ignore git and node_modules: +**/.git +**/node_modules + +# Ignore artifacts: +**/dist \ No newline at end of file diff --git a/packages/jstz-types/index.d.ts b/packages/jstz-types/index.d.ts index ab3d1712b..ff0767b9f 100644 --- a/packages/jstz-types/index.d.ts +++ b/packages/jstz-types/index.d.ts @@ -141,7 +141,7 @@ declare interface Kv { declare var Kv: Kv; -export type Mutez = number; +declare type Mutez = number; declare interface Ledger { readonly selfAddress: Address; diff --git a/packages/jstz/index.js b/packages/jstz/index.js deleted file mode 100644 index a5b247057..000000000 --- a/packages/jstz/index.js +++ /dev/null @@ -1,3 +0,0 @@ -export function isAddress(addr) { - return typeof addr === "string"; -} diff --git a/packages/jstz/package.json b/packages/jstz/package.json index a4e0b13f3..862986bed 100644 --- a/packages/jstz/package.json +++ b/packages/jstz/package.json @@ -6,7 +6,7 @@ "main": "index.ts", "scripts": { "check:types": "tsc --noEmit", - "build": "tsc" + "build": "tsc --outDir dist" }, "dependencies": { "@tezos/jstz-types": "^0.0.0"