Skip to content

Add S3CacheService tests #372

Add S3CacheService tests

Add S3CacheService tests #372

Workflow file for this run

name: CI
on:
push:
branches:
- master
permissions:
contents: read
packages: write
jobs:
setup:
name: Setup Environment
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Set up Node 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Cache NPM dependencies
uses: actions/cache@v3
id: cache-npm
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
if: steps.cache-npm.outputs.cache-hit != 'true'
run: npm ci
build:
name: Build
runs-on: ubuntu-latest
needs:
- setup
env:
NODE_ENV: production
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Set up Node 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Restore cache
uses: actions/cache@v3
id: npm-cache
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
- name: Build
run: npm run build
- name: Cache build
uses: actions/cache@v3
with:
path: |
packages/*/dist
apps/*/dist
key: "${{ runner.os }}-build-${{ github.sha }}"
lint:
name: Lint
runs-on: ubuntu-latest
needs:
- setup
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Set up Node 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Restore cache
uses: actions/cache@v3
id: npm-cache
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
- name: Lint
run: npm run lint
test:
name: Unit Test API
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Set up Node 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Restore NPM cache
uses: actions/cache@v3
id: npm-cache
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
- name: Restore build cache
uses: actions/cache@v3
with:
path: |
packages/*/dist
apps/*/dist
key: "${{ runner.os }}-build-${{ github.sha }}"
- name: Test
run: npm run test:cov --workspace=api
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
test_e2e:
name: Unit Test API (e2e)
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Set up Node 20
uses: actions/setup-node@v3
with:
node-version: 20
- name: Restore NPM cache
uses: actions/cache@v3
id: npm-cache
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
- name: Restore build cache
uses: actions/cache@v3
with:
path: |
packages/*/dist
apps/*/dist
key: "${{ runner.os }}-build-${{ github.sha }}"
- name: Test
run: npm run test:e2e --workspace=api
docker:
name: "Build and push Docker images"
runs-on: ubuntu-latest
needs:
- build
- test
- test_e2e
env:
NODE_ENV: production
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v4
with:
push: true
tags: |
mrbartusek/stocked-up:${{ steps.vars.outputs.sha_short}}
mrbartusek/stocked-up:latest
ghcr.io/mrbartusek/stocked-up:${{ steps.vars.outputs.sha_short}}
ghcr.io/mrbartusek/stocked-up:latest
codeql:
name: Perform CodeQL Analysis
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: javascript
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:javascript"