[Snyk] Security upgrade @google-cloud/logging-winston from 4.0.4 to 5.0.0 #44
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
name: build | |
on: | |
pull_request: | |
push: | |
branches: | |
- master # when base_ref is master | |
tags: | |
- '**' | |
jobs: | |
# debug: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Dump github context | |
# env: | |
# GH_CONTEXT: ${{ toJson(github) }} | |
# run: echo "$GH_CONTEXT" | |
unit-cli: | |
if: "! contains(github.head_ref, 'docs')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: '10.x' | |
- uses: actions/cache@v1 | |
id: cache | |
with: | |
path: ./cli/node_modules | |
key: cli-${{ hashFiles('**/package-lock.json') }} | |
- working-directory: ./cli | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: tests | |
working-directory: ./cli | |
run: npm run test | |
unit-bf: | |
if: "! contains(github.head_ref, 'docs')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: '12.x' | |
- name: install meteor | |
run: curl https://install.meteor.com/ | sh | |
- uses: actions/cache@v1 | |
id: cache | |
with: | |
path: ./botfront/node_modules | |
key: bf-${{ hashFiles('**/package-lock.json') }} | |
- uses: actions/cache@v1 | |
with: | |
path: ~/.cache/Cypress | |
key: cypress-${{ hashFiles('**/package.json') }} | |
- working-directory: ./botfront | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: mocha tests | |
working-directory: ./botfront | |
run: npm run test-once | |
license-check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: get-npm-version | |
id: package-version | |
uses: martinbeentjes/npm-get-version-action@master | |
with: | |
path: ./botfront | |
- working-directory: ./botfront | |
run: npx license-checker --excludePackages 'botfront@${{ steps.package-version.outputs.current-version }}' --failOn 'GPL-3.0;GPL-2.0;GPL;AGPL-3.0-only;AGPL-3.0' | |
- working-directory: ./cli | |
run: npx license-checker --excludePackages 'botfront@${{ steps.package-version.outputs.current-version }}' --failOn 'GPL-3.0;GPL-2.0;GPL;AGPL-3.0-only;AGPL-3.0' | |
build-bf: # to do: run meteor build in previous step and build from simplified dockerfile | |
if: "! contains(github.head_ref, 'docs')" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- name: build bf image | |
run: | | |
docker build \ | |
-t botfront-local \ | |
. | |
- name: save map files from meteor build | |
if: contains(github.ref, 'tags') | |
run: | | |
docker run \ | |
-v $(pwd)/maps:/maps \ | |
--entrypoint /bin/bash \ | |
botfront-local \ | |
-c "cd /opt/bundle/bundle/programs && find . -name '*.map' ! -path './server/**' -exec cp --parents '{}' /maps/ \;" | |
- name: get version | |
if: contains(github.ref, 'tags') | |
id: version | |
run: | | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
echo ::set-output name=tag::$VERSION | |
- run: docker save botfront-local $(docker history -q botfront-local | awk '!/<missing>/{print}') > botfront-local.tar | |
- uses: actions/upload-artifact@v1 | |
if: contains(github.ref, 'tags') | |
with: | |
name: source-maps-${{ steps.version.outputs.tag }} | |
path: maps | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: botfront-local | |
path: botfront-local.tar | |
integration: | |
if: "! contains(github.head_ref, 'docs')" | |
runs-on: ubuntu-latest | |
needs: [build-bf] | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/download-artifact@v1 | |
with: | |
name: botfront-local | |
path: . | |
- run: docker load < botfront-local.tar | |
- name: get versions | |
id: versions | |
run: | | |
config=cli/project-template/.botfront/botfront.yml | |
rasa=$(sed -n 's/\S*rasa: \(.*\)$/\1/p' $config | sed 's/.*://') | |
echo ::set-output name=rasa::$rasa | |
- name: cypress tests | |
working-directory: ./botfront/cypress | |
run: | | |
mkdir -p mounted/models | |
docker-compose up \ | |
--abort-on-container-exit \ | |
--exit-code-from e2e | |
env: | |
RASA_TAG: ${{ steps.versions.outputs.rasa }} | |
GITHUB_TOKEN: ${{ secrets.CYPRESS_GITHUB_TOKEN }} | |
GITHUB_TEMPLATE_REPO: botfront/ci_repo_template | |
- name: persist screenshots as artifact on failure | |
if: failure() | |
uses: actions/upload-artifact@v1 | |
with: | |
name: screenshots | |
path: ./botfront/cypress/screenshots | |
push-bf: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && (contains(github.ref, 'master') || contains(github.ref, 'tags')) | |
needs: [unit-bf, build-bf, integration] | |
steps: | |
- name: log in | |
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin | |
- name: download image | |
uses: actions/download-artifact@v1 | |
with: | |
name: botfront-local | |
path: . | |
- run: docker load < botfront-local.tar | |
- name: push image | |
run: | | |
# Strip git ref prefix from version | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
# Add branch- prefix for branch pushes | |
[[ "${{ github.ref }}" == "refs/heads/"* ]] && VERSION=branch-$VERSION | |
echo VERSION=$VERSION | |
docker tag botfront-local botfront/botfront:$VERSION | |
docker push botfront/botfront:$VERSION | |
- run: touch empty | |
- name: overwrite bf artifact with empty file | |
uses: actions/upload-artifact@v1 | |
with: | |
name: botfront-local | |
path: empty | |
create-github-release: | |
runs-on: ubuntu-latest | |
if: contains(github.ref, 'tags') | |
needs: [push-bf] | |
steps: | |
- uses: actions/create-release@v1.0.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
prerelease: ${{ contains(github.ref, 'rc') || contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} | |
create-npm-release: | |
runs-on: ubuntu-latest | |
needs: [create-github-release] | |
steps: | |
- uses: actions/checkout@v1 | |
- name: npm publish | |
working-directory: ./cli | |
run: | | |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
if [[ "${{ github.ref }}" =~ rc|alpha|beta ]]; then | |
npm publish --tag next | |
else | |
npm publish | |
fi | |
env: | |
CI: true | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
build-netlify-docs: | |
runs-on: ubuntu-latest | |
needs: [create-github-release] | |
steps: | |
- run: | | |
if ! [[ "${{ github.ref }}" =~ rc|alpha|beta ]]; then | |
echo "https://api.netlify.com/build_hooks/${{ secrets.NETLIFY_HOOK }}" | xargs curl -X POST -d {} | |
fi |