feat: add CI (#20)

* Add CI

* Rename CI

* Remove only modifier

* Define specific node version
This commit is contained in:
Arnaud 2025-05-28 18:32:45 +02:00 committed by GitHub
parent df64af08e5
commit a8970d2377
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 36 additions and 2 deletions

29
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,29 @@
name: CI
on:
push:
branches:
- master
pull_request:
workflow_dispatch:
env:
node_version: 22.12.0
permissions:
id-token: write
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ env.node_version }}
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm test

View File

@ -6,6 +6,11 @@ The SDK has a small bundle size and support tree shaking.
The SDK is currently under early development and the API can change at any time. The SDK is currently under early development and the API can change at any time.
[![License: Apache](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Stability: experimental](https://img.shields.io/badge/stability-experimental-orange.svg)](#stability)
[![CI](https://github.com/codex-storage/codex-js/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/codex-storage/codex-js/actions/workflows/ci.yml?query=branch%3Amaster)
## Breaking changes ## Breaking changes
- Version 0.1.0 introduces [upload strategy](#upload) to support browser and Node JS. - Version 0.1.0 introduces [upload strategy](#upload) to support browser and Node JS.

View File

@ -2,7 +2,7 @@ import { afterEach, assert, describe, it, vi } from "vitest";
import { Fetch } from "../fetch-safe/fetch-safe"; import { Fetch } from "../fetch-safe/fetch-safe";
import { CodexError } from "../errors/errors"; import { CodexError } from "../errors/errors";
describe.only("fetch", () => { describe("fetch", () => {
afterEach(() => { afterEach(() => {
vi.restoreAllMocks(); vi.restoreAllMocks();
}); });
@ -26,7 +26,7 @@ describe.only("fetch", () => {
assert.deepStrictEqual(result, { error: true, data: error }); assert.deepStrictEqual(result, { error: true, data: error });
}); });
it.only("returns an error when the json parsing failed", async () => { it("returns an error when the json parsing failed", async () => {
const mockResponse = { const mockResponse = {
ok: true, ok: true,
status: 200, status: 200,