-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci(tests): fix tests and ci workflows #163
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
|
||
[*.{js,jsx,mjs,ejs,yml,json,cpp,cc,h,html,md,sh,sql}] | ||
indent_style = space | ||
indent_size = 2 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: Docker build & push image | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will be needed in a forthcoming PR for doing E2E testing in ephemeral CI instances. The reason being it will be much easier to track regressions and also we need the container env anyway for network tests. |
||
|
||
on: | ||
push: | ||
branches: [v4] | ||
tags: ["v*"] | ||
pull_request: | ||
branches: [v4] | ||
paths: | ||
- .github/workflows/docker-build-push.yaml | ||
- kiwistand/** | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
if: ${{ github.repository == 'attestate/kiwistand' }} # Comment this out if you want to publish your own images on a fork! | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set lowercase repository owner environment variable | ||
run: | | ||
echo "OWNER_LOWERCASE=${OWNER,,}" >> ${GITHUB_ENV} | ||
env: | ||
OWNER: "${{ github.repository_owner }}" | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
- name: Inject slug/short variables | ||
uses: rlespinasse/[email protected] | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
with: | ||
install: true | ||
driver-opts: | | ||
image=moby/buildkit:master | ||
network=host | ||
|
||
- name: Install cosign | ||
if: github.event_name != 'pull_request' | ||
uses: sigstore/[email protected] | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
if: github.event_name != 'pull_request' | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata tags and labels on PRs | ||
if: github.event_name == 'pull_request' | ||
id: meta-pr | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ghcr.io/${{ env.OWNER_LOWERCASE }}/kiwistand | ||
tags: | | ||
type=raw,value=sha-${{ env.GITHUB_SHA_SHORT }} | ||
labels: | | ||
org.opencontainers.image.source="https://github.com/${{ github.repository_owner }}/kiwistand" | ||
- name: Extract metadata tags and labels for main, release or tag | ||
if: github.event_name != 'pull_request' | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
flavor: | | ||
latest=auto | ||
images: ghcr.io/${{ env.OWNER_LOWERCASE }}/kiwistand | ||
tags: | | ||
type=semver,pattern={{version}} | ||
type=semver,pattern={{major}}.{{minor}} | ||
type=semver,pattern={{major}}.{{minor}}.{{patch}} | ||
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }} | ||
type=raw,value=sha-${{ env.GITHUB_SHA_SHORT }} | ||
labels: | | ||
maintainer=${{ github.repository_owner }} | ||
org.opencontainers.image.source="https://github.com/${{ github.repository_owner }}/kiwistand" | ||
|
||
- name: Build and push Docker image | ||
id: build-and-push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: ${{ github.event_name != 'pull_request' }} | ||
build-args: | | ||
GIT_SHA=${{ env.GITHUB_SHA }} | ||
DOCKER_LABEL=sha-${{ env.GITHUB_SHA_SHORT }} | ||
tags: ${{ steps.meta.outputs.tags || steps.meta-pr.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels || steps.meta-pr.outputs.labels }} | ||
cache-from: type=gha | ||
cache-to: type=gha |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "ESNext", | ||
"moduleResolution": "Bundler", | ||
"checkJs": true, | ||
"target": "ES2022", | ||
"allowImportingTsExtensions": true, | ||
"strictNullChecks": true, | ||
"strictFunctionTypes": true | ||
}, | ||
"exclude": [ | ||
"node_modules", | ||
"**/node_modules/*" | ||
] | ||
} | ||
Comment on lines
+1
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dev: |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1222,7 +1222,7 @@ test("trying to add message to store that isn't on allowlist", async (t) => { | |
}); | ||
|
||
test("adding message from too far into the future", async (t) => { | ||
env.MAX_TIMESTAMP_DELTA_SECS = 60; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixes: Type 'number' is not assignable to type 'string' |
||
env.MAX_TIMESTAMP_DELTA_SECS = "60"; | ||
const address = "0x0f6A79A579658E401E0B81c6dde1F2cd51d97176"; | ||
const privateKey = | ||
"0xad54bdeade5537fb0a553190159783e45d02d316a992db05cbed606d3ca36b39"; | ||
|
@@ -1232,7 +1232,7 @@ test("adding message from too far into the future", async (t) => { | |
const text = "hello world"; | ||
const href = "https://example.com"; | ||
const type = "amplify"; | ||
const timestamp = Math.floor(Date.now() / 1000) + 61; | ||
const timestamp = (Math.floor(Date.now() / 1000) + 61).toString(); | ||
const message = id.create(text, href, type, timestamp); | ||
const signedMessage = await id.sign(signer, message, EIP712_MESSAGE); | ||
|
||
|
@@ -1275,7 +1275,6 @@ test("adding message from too far into the future", async (t) => { | |
), | ||
); | ||
}); | ||
|
||
test("adding message from before minimum timestamp", async (t) => { | ||
const address = "0x0f6A79A579658E401E0B81c6dde1F2cd51d97176"; | ||
const privateKey = | ||
|
@@ -1286,7 +1285,7 @@ test("adding message from before minimum timestamp", async (t) => { | |
const text = "hello world"; | ||
const href = "https://example.com"; | ||
const type = "amplify"; | ||
const timestamp = 0; | ||
const timestamp = "0"; | ||
const message = id.create(text, href, type, timestamp); | ||
const signedMessage = await id.sign(signer, message, EIP712_MESSAGE); | ||
|
||
|
@@ -1317,7 +1316,7 @@ test("adding message from before minimum timestamp", async (t) => { | |
}, | ||
}, | ||
}; | ||
env.MIN_TIMESTAMP_SECS = 1; | ||
env.MIN_TIMESTAMP_SECS = "1"; | ||
await t.throwsAsync( | ||
async () => | ||
await store.add( | ||
|
@@ -1330,7 +1329,6 @@ test("adding message from before minimum timestamp", async (t) => { | |
), | ||
); | ||
}); | ||
|
||
test.serial("adding a comment to the store with missing parent", async (t) => { | ||
store.upvotes.clear(); | ||
t.plan(2); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
correct editorconfig 🍆