feat: add cache (#2)

* ci: remove main workflow
ci: add pr workflow to branch next

* docs: correct readme
ci: add docker build on release
ci: add lint and test to release flow

* feat: add cache for both memory and redis
refactor: cleanup getAccountability nested promise
refactor: import path for get-auth-providers.ts
docs: document cache options
ci: add redis file to gitignore

* ci: use test:coverage for testing to update pr

---------

Co-authored-by: Krise <krise86@users.noreply.github.com>
This commit is contained in:
Kristoffer
2023-08-02 16:44:07 +02:00
committed by GitHub
parent aea5b84c41
commit 8f8ce1e02b
12 changed files with 284 additions and 97 deletions

47
.github/workflows/docker-release.yml vendored Normal file
View File

@@ -0,0 +1,47 @@
name: Create and publish a Docker image
on:
release:
types:
- published
- prereleased
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.release.tag_name }}
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -1,27 +0,0 @@
name: Merge to Main
on:
push:
branches: [ main ]
jobs:
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
matrix:
node: [ 18, 20 ]
name: Node ${{ matrix.node }} Release
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
- run: pnpm install
- run: pnpm lint
- run: pnpm test

View File

@@ -2,7 +2,9 @@ name: Pull Request
on:
pull_request:
branches: [ main ]
branches:
- main
- next
jobs:
check:
@@ -27,8 +29,10 @@ jobs:
name: install dependencies
- run: pnpm lint
name: linting
- run: pnpm test
- run: pnpm test:coverage
name: testing
- run: pnpm build
name: build package
- name: 'Report Coverage'
if: always() # Also generate the report if tests are failing
uses: davelosert/vitest-coverage-report-action@v2

View File

@@ -34,6 +34,10 @@ jobs:
cache: 'pnpm'
- name: Install dependencies
run: pnpm install
- run: pnpm lint
name: linting
- run: pnpm test
name: testing
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
run: pnpm audit signatures
- name: Release