Skip to content

Commit

Permalink
ci: add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
zirkelc committed Oct 7, 2024
1 parent f58d806 commit 7103627
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch:

concurrency:
group: ci-${{ github.ref }}
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup and Install
id: install
uses: ./.github/actions/setup-and-install
with:
node-version: 20

- name: Publish
id: changesets
uses: changesets/action@v1
with:
publish: pnpm release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"test:ci": "vitest --coverage.enabled --coverage.provider=v8 --coverage.reporter=json-summary --coverage.reporter=json --coverage.reporter=text-summary",
"lint": "biome check . --write --no-errors-on-unmatched",
"prepare": "husky",
"release": "pnpm build && pnpm changeset:publish",
"changeset:init": "changeset",
"changeset:version": "changeset version",
"changeset:publish": "changeset publish"
Expand Down
44 changes: 31 additions & 13 deletions packages/store-s3/tests/store.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,23 +62,41 @@ describe("S3Store.load", () => {
}),
);

test("should deserialize content by type", async () => {
describe("should deserialize content by type", () => {
const s3Store = new S3Store({ config, bucket, key });
test("text/plain", async () => {
mockClient("foo", "text/plain");
await expect(s3Store.load({ reference: urlReference })).resolves.toEqual(
"foo",
);

mockClient("foo", "text/plain;charset=utf-8");
await expect(s3Store.load({ reference: urlReference })).resolves.toEqual(
"foo",
);
});

mockClient("foo", "text/plain");
await expect(s3Store.load({ reference: urlReference })).resolves.toEqual(
"foo",
);

mockClient(JSON.stringify({ foo: "bar" }), "application/json");
await expect(s3Store.load({ reference: urlReference })).resolves.toEqual({
foo: "bar",
test("application/json", async () => {
mockClient(JSON.stringify({ foo: "bar" }), "application/json");
await expect(s3Store.load({ reference: urlReference })).resolves.toEqual({
foo: "bar",
});

mockClient(
JSON.stringify({ foo: "bar" }),
"application/json;charset=utf-8",
);
await expect(s3Store.load({ reference: urlReference })).resolves.toEqual({
foo: "bar",
});
});

mockClient("foo", "unsupported/type");
await expect(async () =>
s3Store.load({ reference: urlReference }),
).rejects.toThrowError();
test("unsupported type", async () => {
mockClient("foo", "unsupported/type");
await expect(async () =>
s3Store.load({ reference: urlReference }),
).rejects.toThrowError();
});
});

test(`should get object by reference`, async () => {
Expand Down

0 comments on commit 7103627

Please sign in to comment.