[pull] master from magma:master #2818
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copyright 2022 The Magma Authors. | |
# | |
# This source code is licensed under the BSD-style license found in the | |
# LICENSE file in the root directory of this source tree. | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# owner: @magma/approvers-cloud | |
# purpose: NMS linting and testing | |
# remediation: https://magma.github.io/magma/docs/next/nms/dev_testing | |
name: NMS Lint & Test | |
on: | |
push: | |
branches: | |
- master | |
- 'v1.*' | |
pull_request: | |
branches: | |
- master | |
- 'v1.*' | |
types: | |
- opened | |
- reopened | |
- synchronize | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
path_filter: | |
runs-on: ubuntu-20.04 | |
outputs: | |
should_not_skip: ${{ steps.changes.outputs.filesChanged }} | |
steps: | |
# Need to get git on push event | |
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # [email protected] | |
if: github.event_name == 'push' | |
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # [email protected] | |
id: changes | |
with: | |
filters: | | |
filesChanged: | |
- [".github/workflows/nms-workflow.yml", "nms/**"] | |
- name: Save should_not_skip output | |
if: always() | |
run: | | |
mkdir -p ./pr | |
echo -n ${{ steps.changes.outputs.filesChanged == 'false' }} > ./pr/skipped | |
- uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3 | |
if: always() | |
with: | |
name: pr | |
path: pr/ | |
nms-typescript: | |
needs: path_filter | |
if: ${{ needs.path_filter.outputs.should_not_skip == 'true' }} | |
name: nms-typescript job | |
runs-on: ubuntu-20.04 | |
defaults: | |
run: | |
working-directory: "${{ github.workspace }}/nms" | |
steps: | |
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # [email protected] | |
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # [email protected] | |
with: | |
node-version: 16 | |
- name: install yarn | |
run: npm install --global yarn | |
- name: yarn install | |
run: yarn install | |
- name: yarn tsc | |
run: yarn tsc --NoEmit | |
# Notify ci channel when failing | |
# Plugin info: https://github.com/marketplace/actions/slack-notify | |
- name: Notify failure to slack | |
if: failure() && github.event_name == 'push' | |
uses: rtCamp/[email protected] | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_CI }} | |
SLACK_TITLE: "NMS typescript failed" | |
SLACK_MESSAGE: ${{ github.event.head_commit.message || github.event.pull_request.title }} | |
SLACK_USERNAME: ${{ github.workflow }} | |
SLACK_ICON_EMOJI: ":boom:" | |
SLACK_COLOR: "#FF0000" | |
SLACK_FOOTER: ' ' | |
nms-eslint: | |
needs: path_filter | |
if: ${{ needs.path_filter.outputs.should_not_skip == 'true' }} | |
name: nms-eslint job | |
runs-on: ubuntu-20.04 | |
env: | |
MAGMA_ROOT: "${{ github.workspace }}" | |
steps: | |
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # [email protected] | |
- uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # [email protected] | |
with: | |
node-version: 16 | |
- name: apt install yarn | |
run: | | |
cd ${MAGMA_ROOT}/nms | |
sudo apt-get install -y apt-transport-https | |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | |
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list | |
sudo apt-get update -y | |
sudo apt-get install -y yarn | |
- name: Install dependencies | |
run: | | |
cd ${MAGMA_ROOT}/nms | |
yarn install --frozen-lockfile | |
- name: run eslint | |
run: | | |
cd ${MAGMA_ROOT}/nms | |
yarn run eslint ./ | |
# Notify ci channel when failing | |
# Plugin info: https://github.com/marketplace/actions/slack-notify | |
- name: Notify failure to slack | |
if: failure() && github.event_name == 'push' | |
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected] | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_CI }} | |
SLACK_TITLE: "NMS eslint tests failed" | |
SLACK_MESSAGE: ${{ github.event.head_commit.message || github.event.pull_request.title }} | |
SLACK_USERNAME: ${{ github.workflow }} | |
SLACK_ICON_EMOJI: ":boom:" | |
SLACK_COLOR: "#FF0000" | |
SLACK_FOOTER: ' ' | |
nms-yarn-test: | |
needs: path_filter | |
if: ${{ needs.path_filter.outputs.should_not_skip == 'true' }} | |
name: nms-yarn-test job | |
runs-on: ubuntu-20.04 | |
env: | |
MAGMA_ROOT: "${{ github.workspace }}" | |
steps: | |
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # [email protected] | |
- uses: borales/actions-yarn@d8ce577a6f5d99a459fc7fdf2a86844617e353e4 # [email protected] | |
with: | |
cmd: install # will run `yarn install` command | |
- name: run yarn test | |
run: | | |
cd ${MAGMA_ROOT}/nms | |
yarn add jest@^28.1.3 -W --dev | |
yarn test:ci | |
# Notify ci channel when failing | |
# Plugin info: https://github.com/marketplace/actions/slack-notify | |
- name: Notify failure to slack | |
if: failure() && github.event_name == 'push' | |
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected] | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_CI }} | |
SLACK_TITLE: "NMS yarn tests failed" | |
SLACK_MESSAGE: ${{ github.event.head_commit.message || github.event.pull_request.title }} | |
SLACK_USERNAME: ${{ github.workflow }} | |
SLACK_ICON_EMOJI: ":boom:" | |
SLACK_COLOR: "#FF0000" | |
SLACK_FOOTER: ' ' | |
nms-e2e-test: | |
needs: path_filter | |
if: ${{ needs.path_filter.outputs.should_not_skip == 'true' }} | |
name: nms-e2e-test job | |
runs-on: ubuntu-20.04 | |
env: | |
MAGMA_ROOT: "${{ github.workspace }}" | |
NMS_ROOT: "${{ github.workspace }}/nms" | |
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: "true" | |
PUPPETEER_EXECUTABLE_PATH: "/usr/bin/google-chrome-stable" | |
steps: | |
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # [email protected] | |
- name: apt install yarn | |
run: | | |
cd ${MAGMA_ROOT}/nms | |
sudo apt-get install -y apt-transport-https | |
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - | |
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list | |
sudo apt-get update -y | |
sudo apt-get install -y yarn | |
yarn add jest@^26.4.2 -W --dev | |
- name: apt install chrome | |
run: | | |
cd ${MAGMA_ROOT}/nms | |
# Install latest chrome dev package | |
# Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer | |
# installs, work. | |
curl -sS https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | |
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" | sudo tee /etc/apt/sources.list.d/google.list | |
sudo apt-get update -y | |
sudo apt-get install -y google-chrome-stable libxss1 --no-install-recommends | |
sudo rm -rf /var/lib/apt/lists/* | |
- uses: borales/actions-yarn@d8ce577a6f5d99a459fc7fdf2a86844617e353e4 # [email protected] | |
with: | |
cmd: install # will run `yarn install` command | |
- name: run e2e_test_setup.sh | |
run: | | |
source $NVM_DIR/nvm.sh | |
nvm install stable | |
cd ${MAGMA_ROOT}/nms | |
./e2e_test_setup.sh | |
- name: Publish Test Results | |
if: always() | |
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # pin@v3 | |
with: | |
name: NMS Test Results | |
path: "/tmp/nms_artifacts/*" | |
# Notify ci channel when failing | |
# Plugin info: https://github.com/marketplace/actions/slack-notify | |
- name: Notify failure to slack | |
if: failure() && github.event_name == 'push' | |
uses: rtCamp/action-slack-notify@12e36fc18b0689399306c2e0b3e0f2978b7f1ee7 # [email protected] | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_CI }} | |
SLACK_TITLE: "NMS e2e tests failed" | |
SLACK_MESSAGE: ${{ github.event.head_commit.message || github.event.pull_request.title }} | |
SLACK_USERNAME: ${{ github.workflow }} | |
SLACK_ICON_EMOJI: ":boom:" | |
SLACK_COLOR: "#FF0000" | |
SLACK_FOOTER: ' ' |