Skip to content

Commit

Permalink
PI1 25619: Update Node Js 10.x to 12.x versions to latest compatible …
Browse files Browse the repository at this point in the history
…versions (ie 18.x / 19.x) (#1371)
  • Loading branch information
kristin-at-theta authored Sep 26, 2023
1 parent e2f579e commit 191542f
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/deploy-support.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
else
echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
fi
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Validate branch name
run: ./.github/branchNameValidation.sh $STAGE_PREFIX$branch_name
- name: set branch specific variable names
Expand All @@ -34,18 +34,18 @@ jobs:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
CODE_CLIMATE_ID: ${{ secrets.CODE_CLIMATE_ID }}
- name: Configure AWS credentials for GitHub Actions
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.AWS_OIDC_ROLE_TO_ASSUME }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- name: lock this branch to prevent concurrent builds
run: ./.github/github-lock.sh $branch_name
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v1
- uses: actions/setup-node@v3
with:
node-version: "14.x"
- uses: actions/cache@v2
node-version: "18.x"
- uses: actions/cache@v3
with:
path: "**/node_modules"
key: deploy-support-${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock', 'plugins/**') }}
Expand Down
50 changes: 25 additions & 25 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "14.x"
node-version: "18.x"
- name: Install dependencies
run: |
npm ci
npm ci --legacy-peer-deps
for service in services/*/; do
pushd "$service"
if [ -f package-lock.json ]; then npm ci; fi
if [ -f package-lock.json ]; then npm ci --legacy-peer-deps; fi
popd
done
- name: Run ESLint
Expand All @@ -36,12 +36,12 @@ jobs:
name: Unit Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "14.x"
node-version: "18.x"
- name: Unit Test & Publish Coverage
uses: paambaati/codeclimate-action@v2.7.5
uses: paambaati/codeclimate-action@v5.0.0
env:
CC_TEST_REPORTER_ID: ${{ secrets.CODECLIMATE_TEST_REPORTER_ID }}
with:
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
"""
exit 1
fi
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Validate branch name
run: ./.github/branchNameValidation.sh $STAGE_PREFIX$branch_name
- name: set branch specific variable names
Expand All @@ -102,17 +102,17 @@ jobs:
COGNITO_TEST_USERS_PASSWORD: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_COGNITO_TEST_USERS_PASSWORD] || secrets.COGNITO_TEST_USERS_PASSWORD }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Configure AWS credentials for GitHub Actions
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.AWS_OIDC_ROLE_TO_ASSUME }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- uses: actions/setup-node@v1
- uses: actions/setup-node@v3
with:
node-version: "14.x"
node-version: "18.x"
- name: Combine package-lock.json files to single file
run: find services -maxdepth 3 -name package-lock.json | xargs cat package-lock.json > combined-package-lock.txt
- name: cache service dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
services/.sechub/node_modules
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
"""
exit 1
fi
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Validate branch name
run: ./.github/branchNameValidation.sh $STAGE_PREFIX$branch_name
- name: set branch specific variable names
Expand All @@ -198,17 +198,17 @@ jobs:
COGNITO_TEST_USERS_PASSWORD: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_COGNITO_TEST_USERS_PASSWORD] || secrets.COGNITO_TEST_USERS_PASSWORD }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Configure AWS credentials for GitHub Actions
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.AWS_OIDC_ROLE_TO_ASSUME }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- uses: actions/setup-node@v1
- uses: actions/setup-node@v3
with:
node-version: "14.x"
node-version: "18.x"
- name: Combine package-lock.json files to single file
run: find services -maxdepth 3 -name package-lock.json | xargs cat package-lock.json > combined-package-lock.txt
- name: cache service dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: |
services/.sechub/node_modules
Expand Down Expand Up @@ -337,7 +337,7 @@ jobs:
steps:
- name: set branch_name
run: echo "branch_name=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: set branch specific variable names
run: ./.github/build_vars.sh set_names
- name: set variable values
Expand All @@ -350,13 +350,13 @@ jobs:
COGNITO_TEST_USERS_PASSWORD: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_COGNITO_TEST_USERS_PASSWORD] || secrets.COGNITO_TEST_USERS_PASSWORD }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Configure AWS credentials for GitHub Actions
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.AWS_OIDC_ROLE_TO_ASSUME }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- name: Combine package-lock.json files to single file
run: find services -maxdepth 3 -name package-lock.json | xargs cat package-lock.json > combined-package-lock.txt
- name: cache service dependencies
Expand Down Expand Up @@ -392,7 +392,7 @@ jobs:
browser: chrome
config: baseUrl=${{ env.APPLICATION_ENDPOINT }}
- name: Upload screenshots
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: cypress-screenshots
Expand Down Expand Up @@ -452,13 +452,13 @@ jobs:
COGNITO_TEST_USERS_PASSWORD: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_COGNITO_TEST_USERS_PASSWORD] || secrets.COGNITO_TEST_USERS_PASSWORD }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Configure AWS credentials for GitHub Actions
uses: aws-actions/configure-aws-credentials@v2
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.AWS_OIDC_ROLE_TO_ASSUME }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
- name: Combine package-lock.json files to single file
run: find services -maxdepth 3 -name package-lock.json | xargs cat package-lock.json > combined-package-lock.txt
- name: cache service dependencies
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/destroy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- name: set branch_name
run: echo "branch_name=${{ github.event.ref }}" >> $GITHUB_ENV
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: set branch specific variable names
run: ./.github/build_vars.sh set_names
- name: set variable values
Expand All @@ -25,7 +25,7 @@ jobs:
AWS_DEFAULT_REGION: ${{ secrets[env.BRANCH_SPECIFIC_VARNAME_AWS_DEFAULT_REGION] || secrets.AWS_DEFAULT_REGION }}
STAGE_PREFIX: ${{ secrets.STAGE_PREFIX }}
- name: Configure AWS credentials for GitHub Actions
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ env.AWS_OIDC_ROLE_TO_ASSUME }}
aws-region: ${{ env.AWS_DEFAULT_REGION }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: set branch_name
run: echo "branch_name=${GITHUB_HEAD_REF}" >> $GITHUB_ENV
- name: Configure AWS credentials for GitHub Actions
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_OIDC_ROLE_TO_ASSUME }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
Expand Down
4 changes: 2 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ stage=${1:-dev}
install_deps() {
if [ "$CI" == "true" ]; then # If we're in a CI system
if [ ! -d "node_modules" ]; then # If we don't have any node_modules (CircleCI cache miss scenario), run npm ci. Otherwise, we're all set, do nothing.
npm ci
npm ci --legacy-peer-deps
fi
else # We're not in a CI system, let's npm install
npm install
npm install --legacy-peer-deps
fi
}

Expand Down
5 changes: 1 addition & 4 deletions services/app-api/form/submitWaiverExtensionT.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ submitAny.mockResolvedValue("yup!");

const testEvent = {
this: "is an event object",
body: "needs to have somebody to love?",
};

const expectedResponse = {
Expand All @@ -21,10 +22,6 @@ const expectedResponse = {
statusCode: 200,
};

it("calls submitAny", async () => {
expect(main(testEvent)).resolves.toStrictEqual(expectedResponse);
});

it("should submit temporary extension 1915b form", async () => {
const data = {
temporaryExtensionType: "1915(b)",
Expand Down
24 changes: 4 additions & 20 deletions services/app-api/utils/packageExists.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,15 @@ import packageExists from "./packageExists";
jest.mock("../libs/dynamodb-lib");
const testID = "a TEST ID";

describe("ID is checked in every table", () => {
it("checks one table first", () => {
describe("ID is checked in one table", () => {
it("true if the query returns more than 0 items", () => {
dynamoDb.query.mockResolvedValueOnce({ Count: 2 });

expect(packageExists(testID)).resolves.toBe(true);
});

it("checks two tables next", () => {
dynamoDb.query
.mockResolvedValueOnce({ Count: 0 })
.mockResolvedValueOnce({ Count: 2 });

expect(packageExists(testID)).resolves.toBe(true);
});

dynamoDb.query.mockResolvedValue({ Count: 0 });

it("does a scan if the two queries fail", () => {
dynamoDb.scan.mockResolvedValueOnce({ Count: 2 });

expect(packageExists(testID)).resolves.toBe(true);
});

it("returns false if none of the checks return anything", () => {
dynamoDb.scan.mockResolvedValueOnce({ Count: 0 });
it("false if the query returns 0 items", () => {
dynamoDb.query.mockResolvedValueOnce({ Count: 0 });

expect(packageExists(testID)).resolves.toBe(false);
});
Expand Down
2 changes: 1 addition & 1 deletion unit-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RET=0
for d in services/*/; do
pushd $d
if [ "`jq '.scripts.test' <package.json`" != null ]; then
npm clean-install
npm clean-install --legacy-peer-deps

# if tests fail for any one of the packages, record the failure and test the rest
if ! npm test -- --coverage --ci --detectOpenHandles --forceExit --reporters='default' --reporters='../../github-actions-reporter'; then
Expand Down

0 comments on commit 191542f

Please sign in to comment.