This repository has been archived by the owner on Dec 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ci: gh actions pipeline * add lockfile * chore: update for chai 4.3.6
- Loading branch information
Showing
19 changed files
with
3,682 additions
and
21 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [12.x, 14.x, 16.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: 'yarn' | ||
- id: publish | ||
run: scripts/ci/build-and-test.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Publish and release | ||
|
||
on: | ||
repository_dispatch: | ||
types: | ||
- release-triggered | ||
|
||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
ENV_SUT: ${{ secrets.ENV_SUT }} | ||
CI_PROVIDER_TO_TEST: 'github' | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 12 | ||
registry-url: 'https://registry.npmjs.org' | ||
- id: publish | ||
run: scripts/ci/release.sh | ||
env: | ||
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTOMATION_TOKEN}} | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
with: | ||
tag_name: v${{ steps.publish.outputs.version }} | ||
release_name: Release v${{ steps.publish.outputs.version }} | ||
body: ${{steps.publish.outputs.notes}} | ||
draft: false | ||
prerelease: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,3 @@ node_modules | |
|
||
.idea | ||
.nyc_output | ||
|
||
yarn.lock | ||
package-lock.json |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# scripts | ||
|
||
This directory contains entry points for scripts intended to be run manually by maintainers + contributors, or from `npm` steps |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# scripts/CI | ||
|
||
This directory contains entry points for scripts intended to be run by CI | ||
|
||
Each file in here should map to a CI step. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash -eu | ||
set -eu # Have to set explicitly as github's windows runners don't respect the `eu` in the shebang | ||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running | ||
. "$SCRIPT_DIR"/../lib/robust-bash.sh | ||
|
||
yarn install | ||
yarn run lint | ||
yarn run devtest | ||
yarn run test | ||
rm -rf node_modules | ||
yarn install --production |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# script/CI/lib | ||
|
||
This directory contains scripts that are only used by scripts in the CI directory. |
10 changes: 8 additions & 2 deletions
10
scripts/create_npmrc_file.sh → scripts/ci/lib/create_npmrc_file.sh
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
#!/bin/bash -e | ||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running | ||
. "$SCRIPT_DIR"/../../lib/robust-bash.sh | ||
|
||
require_env_var NODE_AUTH_TOKEN | ||
|
||
set +x #Don't echo the NPM key | ||
|
||
NPMRC_FILE=.npmrc | ||
echo "YOU54F:registry=https://registry.npmjs.org/" > $NPMRC_FILE | ||
echo "//registry.npmjs.org/:_authToken=${NPM_KEY}" >> $NPMRC_FILE | ||
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" >> $NPMRC_FILE | ||
echo "//registry.npmjs.org/:username=you54f" >> $NPMRC_FILE | ||
echo "//registry.npmjs.org/:[email protected]" >> $NPMRC_FILE | ||
echo "//registry.npmjs.org/:always-auth=true" >> $NPMRC_FILE | ||
|
||
set -x | ||
set -x |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash -eu | ||
set -eu # Have to set explicitly as github's windows runners don't respect the `eu` in the shebang | ||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running | ||
. "$SCRIPT_DIR"/../../lib/robust-bash.sh | ||
|
||
require_binary grep | ||
|
||
VERSION="$(jq -r .version package.json)" | ||
echo "$VERSION" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash -eu | ||
set -eu # Have to set explicitly as github's windows runners don't respect the `eu` in the shebang | ||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running | ||
. "$SCRIPT_DIR"/../../lib/robust-bash.sh | ||
|
||
require_binary npm | ||
|
||
VERSION="$("$SCRIPT_DIR/get-version.sh")" | ||
|
||
echo "--> Preparing npmrc file" | ||
"$SCRIPT_DIR"/create_npmrc_file.sh | ||
|
||
echo "--> Releasing version ${VERSION}" | ||
|
||
echo "--> Releasing artifacts" | ||
echo " Publishing cypress-multi-reporters@${VERSION}..." | ||
npm publish --tag latest | ||
echo " done!" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash -eu | ||
set -eu # Have to set explicitly as github's windows runners don't respect the `eu` in the shebang | ||
|
||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")"; pwd)" # Figure out where the script is running | ||
. "$SCRIPT_DIR"/../lib/robust-bash.sh | ||
|
||
require_env_var CI "This script must be run from CI. If you are running locally, note that it stamps your repo git settings." | ||
require_env_var GITHUB_ACTOR | ||
require_env_var NODE_AUTH_TOKEN | ||
|
||
# Setup git for github actions | ||
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | ||
git config user.name "${GITHUB_ACTOR}" | ||
|
||
# It's easier to read the release notes | ||
# from the standard version tool before it runs | ||
RELEASE_NOTES="$(npx standard-version --dry-run | awk 'BEGIN { flag=0 } /^---$/ { if (flag == 0) { flag=1 } else { flag=2 }; next } flag == 1')" | ||
# Don't release if there are no changes | ||
if [ "$(echo "$RELEASE_NOTES" | wc -l)" -eq 1 ] ; then | ||
error "This release would have no release notes. Does it include changes?" | ||
echo " - You must have at least one fix / feat commit to generate release notes" | ||
echo "*** STOPPING RELEASE PROCESS ***" | ||
exit 1 | ||
fi | ||
# This is github actions' method for emitting multi-line values | ||
RELEASE_NOTES="${RELEASE_NOTES//'%'/'%25'}" | ||
RELEASE_NOTES="${RELEASE_NOTES//$'\n'/'%0A'}" | ||
RELEASE_NOTES="${RELEASE_NOTES//$'\r'/'%0D'}" | ||
echo "::set-output name=notes::$RELEASE_NOTES" | ||
|
||
"$SCRIPT_DIR"/build-and-test.sh | ||
npm run release | ||
|
||
# Emit version to next step | ||
VERSION="$("$SCRIPT_DIR/lib/get-version.sh")" | ||
echo "::set-output name=version::$VERSION" | ||
|
||
"$SCRIPT_DIR"/lib/publish.sh | ||
|
||
# Push the new commit back to the repo. | ||
git push --follow-tags |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# scripts/lib | ||
|
||
This directory contains scripts that are only used by other scripts |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash -eu | ||
set -eu # Have to set explicitly as github's windows runners don't respect the `eu` in the shebang | ||
|
||
if [ -z "${LIB_ROBUST_BASH_SH:-}" ]; then | ||
LIB_ROBUST_BASH_SH=included | ||
|
||
function error { | ||
echo "❌ ${1:-}" | ||
} | ||
|
||
function log { | ||
echo "🔵 ${1:-}" | ||
} | ||
|
||
function debug_log { | ||
if [ ! -z "${LIB_ROBUST_BASH_DEBUG:-}" ]; then | ||
echo "🔎 ${1:-}" | ||
fi | ||
} | ||
|
||
function warn { | ||
echo "🟡 ${1:-}" | ||
} | ||
|
||
# Check to see that we have a required binary on the path | ||
# and fail the script if it is not present | ||
function require_binary { | ||
if [ -z "${1:-}" ]; then | ||
error "${FUNCNAME[0]} requires an argument" | ||
exit 1 | ||
fi | ||
|
||
if ! [ -x "$(command -v "$1")" ]; then | ||
error "The required executable '$1' is not on the path." | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Check to see that we have a required environment variable set, | ||
# and fail the script if it is not set. | ||
# | ||
# Optionally, a second argument can be provided to display | ||
# a helpful message before failing | ||
function require_env_var { | ||
var_name="${1:-}" | ||
if [ -z "${!var_name:-}" ]; then | ||
error "The required environment variable ${var_name} is empty" | ||
if [ ! -z "${2:-}" ]; then | ||
echo " - $2" | ||
fi | ||
exit 1 | ||
fi | ||
} | ||
fi |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
# Script to trigger release of the repository | ||
# Requires a Github API token with repo scope stored in the | ||
# environment variable GITHUB_ACCESS_TOKEN_FOR_PF_RELEASES | ||
# Borrowed from Beth Skurrie's excellent script at | ||
# https://github.com/pact-foundation/pact-ruby/blob/master/script/trigger-release.sh | ||
|
||
: "${GITHUB_ACCESS_TOKEN_FOR_YOU54F_RELEASES:?Please set environment variable GITHUB_ACCESS_TOKEN_FOR_YOU54F_RELEASES}" | ||
|
||
repository_slug=$(git remote get-url $(git remote show) | cut -d':' -f2 | sed 's/\.git//') | ||
|
||
output=$(curl -L -v -X POST https://api.github.com/repos/${repository_slug}/dispatches \ | ||
-H 'Accept: application/vnd.github.everest-preview+json' \ | ||
-H "Authorization: Bearer $GITHUB_ACCESS_TOKEN_FOR_YOU54F_RELEASES" \ | ||
-d "{\"event_type\": \"release-triggered\"}" 2>&1) | ||
|
||
if ! echo "${output}" | grep "HTTP\/2 204" > /dev/null; then | ||
echo "$output" | sed "s/${GITHUB_ACCESS_TOKEN_FOR_YOU54F_RELEASES}/********/g" | ||
echo "Failed to trigger release" | ||
exit 1 | ||
else | ||
echo "Release workflow triggered" | ||
fi |
Oops, something went wrong.