Skip to content
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

Switch to npm #3831

Merged
merged 7 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions .docker/prod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
ARG VERSION=stable
ARG DEBIAN_FRONTEND=noninteractive

FROM --platform=linux/amd64 debian:oldstable-slim as builder
FROM --platform=linux/amd64 debian:stable-slim as builder

ENV NODE_VERSION=node_14.x
ENV NODE_VERSION=node_18.x
ENV NODE_KEYRING=/usr/share/keyrings/nodesource.gpg
ENV DISTRIBUTION=bullseye
ENV YARN_KEYRING=/usr/share/keyrings/yarn.gpg
ENV DISTRIBUTION=bookworm

RUN apt-get update && \
apt-get install -y --no-install-recommends \
Expand All @@ -16,22 +15,16 @@ RUN apt-get update && \

RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee "$NODE_KEYRING" >/dev/null && \
echo "deb [signed-by=$NODE_KEYRING] https://deb.nodesource.com/$NODE_VERSION $DISTRIBUTION main" | tee /etc/apt/sources.list.d/nodesource.list
RUN curl -fsSL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee "$YARN_KEYRING" >/dev/null && \
echo "deb [signed-by=$YARN_KEYRING] https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list


# Install Debian core dependencies required for building gvm with PostgreSQL
# support and not yet installed as dependencies of gvm-libs-core
RUN apt-get update && \
apt-get install -y --no-install-recommends \
nodejs \
yarn && \
nodejs && \
rm -rf /var/lib/apt/lists/*

COPY . /source
WORKDIR /source

RUN yarn && yarn build
RUN npm install && npm run build

FROM greenbone/gsad:${VERSION}

Expand Down
70 changes: 39 additions & 31 deletions .github/workflows/ci-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,59 @@ name: Build and test JavaScript

on:
push:
branches: [ main, stable, oldstable ]
branches:
- main
pull_request:
branches: [ main, stable, oldstable ]
branches:
- main

jobs:
testing:
env:
REPORT_DIR: reports
name: Testing and upload coverage
name: Run tests
runs-on: 'ubuntu-latest'
strategy:
matrix:
# 14.x is recommended by https://nodejs.org/en/
node-version: [14.x]
node-version:
- 18
- 20
steps:
- uses: actions/checkout@v3
- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# See: https://github.com/actions/cache/blob/main/examples.md#node---yarn
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Use Yarn cache
uses: actions/cache@v3
id: yarn-cache
cache: "npm"
- name: Install dependencies
run: npm install
- name: Run JavaScript tests
env:
JEST_JUNIT_OUTPUT_DIR: ${{ env.REPORT_DIR }}
run: npm run test

coverage:
env:
REPORT_DIR: reports
name: Upload coverage
runs-on: 'ubuntu-latest'
strategy:
matrix:
node-version:
- 18
steps:
- uses: actions/checkout@v3
- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
# `--prefer-offline` gives cache priority
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Install dependencies
run: yarn install --prefer-offline
run: npm install
- name: Run JavaScript tests
env:
JEST_JUNIT_OUTPUT_DIR: ${{ env.REPORT_DIR }}
run: yarn test:coverage --reporters=default --reporters=jest-junit
run: npm run test:coverage -- --reporters=default --reporters=jest-junit
- name: Load Lint Results
uses: actions/download-artifact@v3
with:
Expand All @@ -56,28 +72,20 @@ jobs:
runs-on: 'ubuntu-latest'
strategy:
matrix:
node-version: [14.x]
node-version:
- 18
- 20
steps:
- uses: actions/checkout@v3
- name: Set up node ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# See: https://github.com/actions/cache/blob/main/examples.md#node---yarn
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Use Yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}
# `--prefer-offline` gives cache priority
cache: "npm"
- name: Install dependencies
run: yarn install --prefer-offline
run: npm install
- name: Lint JavaScript files
run: yarn lint --format junit -o ${{ env.REPORT_FILE }}
run: npm run lint -- --format junit -o ${{ env.REPORT_FILE }}
- name: Store Lint Results
uses: actions/upload-artifact@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ jobs:
- name: Install node
uses: actions/setup-node@v3
with:
cache: 'yarn'
cache: "npm"
- name: Install dependencies
run: yarn install --prefer-offline
run: npm install
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
17 changes: 3 additions & 14 deletions .github/workflows/release-pontos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,10 @@ jobs:
- name: Set up node
uses: actions/setup-node@v3
with:
node-version: "14.x"
- name: Get Yarn cache directory
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Use Yarn cache
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-14.x-${{ hashFiles('**/yarn.lock') }}
# `--prefer-offline` gives cache priority
- name: Install dependencies
run: yarn install --prefer-offline
node-version: "14"
cache: "npm"
- name: Build dist files
run: yarn build
run: node run build
- name: Create tarballs
run: |
tar -C build -czvf gsa-dist-${{ needs.release.outputs.release-version }}.tar.gz .
Expand Down
Loading
Loading