Nightly #291
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: Nightly | |
on: | |
schedule: | |
- cron: "0 2 * * *" # 2am | |
workflow_dispatch: | |
inputs: | |
pushToDist: | |
description: 'Whether to update the nightly branch on highcharts-dist' | |
required: false | |
default: true | |
type: boolean | |
permissions: | |
contents: read # to fetch code (actions/checkout) | |
jobs: | |
nightly_test_bs: | |
name: Browserstack tests | |
uses: ./.github/workflows/highcharts-browserstack.yml | |
with: | |
testTimezones: true | |
secrets: | |
BROWSERSTACK_KEY: ${{secrets.BROWSERSTACK_KEY}} | |
BROWSERSTACK_USER: ${{secrets.BROWSERSTACK_USER}} | |
nightly_test_headless: | |
name: Nightly headless tests | |
uses: ./.github/workflows/highcharts-headless.yml | |
with: | |
testTimezones: true | |
notify_if_error: | |
runs-on: ubuntu-latest | |
needs: ['nightly_test_headless', 'nightly_test_bs'] | |
if: ${{ always() && contains(needs.*.result, 'failure') }} | |
env: | |
JSON_NEEDS: ${{ toJSON(needs) }} | |
steps: | |
- name: Checkout repository scripts | |
uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
.github/scripts | |
- name: Create list of failed jobs | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const { writeFileSync } = require('fs'); | |
const needsJSON = JSON.parse(process.env.JSON_NEEDS); | |
const list = Object.keys(needsJSON).filter(key => { | |
const value = needsJSON[key]; | |
return typeof value === 'object' && value.result === 'failure'; | |
}).map(key => `* ${key}`); | |
console.log(list); | |
const listBody = JSON.stringify({ | |
date: (new Date()).toLocaleDateString('no-NO'), | |
body: 'Errors occured in the following job(s):\n'+ | |
list.join('\n') + | |
'\n\n'+ | |
'See the run on github (https://github.com/highcharts/highcharts/actions/runs/${{ github.run_id }}) for more information' | |
}); | |
writeFileSync( | |
'info.json', | |
listBody | |
); | |
- name: Call Slack webhook | |
id: slack | |
uses: slackapi/slack-github-action@v1.24.0 | |
with: | |
payload-file-path: "info.json" | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NIGHTLY_ERROR_WEBHOOK }} | |
nightly_visual_diff: | |
runs-on: ubuntu-latest | |
env: | |
HIGHCHARTS_VISUAL_TESTS_BUCKET: ${{secrets.VISUAL_TESTS_S3_BUCKET}} | |
AWS_ACCESS_KEY_ID: ${{secrets.VISUAL_TESTS_AWS_ACCESS_KEY_ID}} | |
AWS_SECRET_ACCESS_KEY: ${{secrets.VISUAL_TESTS_AWS_SECRET_ACCESS_KEY}} | |
AWS_REGION: ${{secrets.VISUAL_TESTS_AWS_REGION}} | |
BROWSER_COUNT: 2 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 'lts/*' | |
cache: 'npm' | |
- name: Install Dependencies | |
run: npm i | |
- name: Set application version env var | |
run: | | |
echo "HIGHCHARTS_VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_ENV | |
echo ${HIGHCHARTS_VERSION} | |
- name: Build Highcharts | |
run: npx gulp scripts | |
- run: npx karma start test/karma-conf.js --tests highcharts/*/* --reference --browsercount ${BROWSER_COUNT} --no-fail-on-empty-test-suite | |
- run: npx karma start test/karma-conf.js --tests maps/*/* --reference --browsercount ${BROWSER_COUNT} --no-fail-on-empty-test-suite | |
- run: npx karma start test/karma-conf.js --tests stock/*/* --reference --browsercount ${BROWSER_COUNT} --no-fail-on-empty-test-suite | |
- run: npx karma start test/karma-conf.js --tests gantt/*/* --reference --browsercount ${BROWSER_COUNT} --no-fail-on-empty-test-suite | |
- name: Sync references from S3 | |
run: | | |
aws s3 sync s3://${HIGHCHARTS_VISUAL_TESTS_BUCKET}/visualtests/reference/latest/ ./samples/ \ | |
--exclude "*" \ | |
--include "*/reference.svg" | |
- name: Upload new reference images | |
run: | | |
npx gulp dist-testresults \ | |
--tag ${HIGHCHARTS_VERSION} \ | |
--bucket ${HIGHCHARTS_VISUAL_TESTS_BUCKET} | |
- run: npx karma start test/karma-conf.js --tests highcharts/*/* --single-run --browsercount ${BROWSER_COUNT} --visualcompare || true | |
- run: npx karma start test/karma-conf.js --tests stock/*/* --single-run --browsercount ${BROWSER_COUNT} --visualcompare || true | |
- run: npx karma start test/karma-conf.js --tests maps/*/* --single-run --browsercount ${BROWSER_COUNT} --visualcompare || true | |
- run: npx karma start test/karma-conf.js --tests gantt/*/* --single-run --browsercount ${BROWSER_COUNT} --visualcompare || true | |
- run: sudo apt-get update -y | |
- run: sudo apt-get install -y librsvg2-bin | |
- name: "Generate PNGs and diff" | |
run: | | |
find . -name reference.svg -print -execdir rsvg-convert -o reference.png {} \; | |
find . -name candidate.svg -print -execdir rsvg-convert -o candidate.png {} \; | |
find . -name reference.png -print -execdir npx pixelmatch candidate.png reference.png diff.png 0 \; | |
- name: Upload reference images | |
run: npx gulp dist-testresults --bucket ${HIGHCHARTS_VISUAL_TESTS_BUCKET} | |
nightly_dist: | |
runs-on: ubuntu-latest | |
needs: [nightly_test_headless, nightly_test_bs, nightly_visual_diff] | |
steps: | |
- name: Checkout highcharts | |
uses: actions/checkout@v4 | |
with: | |
path: highcharts | |
- name: Checkout highcharts-dist | |
uses: actions/checkout@v4 | |
with: | |
repository: highcharts/highcharts-dist | |
token: ${{ secrets.PR_COMMENT_TOKEN }} | |
path: highcharts-dist | |
ref: 'nightly' | |
fetch-depth: 0 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 'lts/*' | |
cache: 'npm' | |
cache-dependency-path: ./highcharts/package-lock.json | |
- name: Install and build | |
working-directory: ./highcharts | |
run: | | |
npm i | |
npm run build -- --CI true | |
npx gulp dist-verify | |
npx gulp dist-release --force-yes | |
- name: Upload to github | |
working-directory: ./highcharts-dist | |
if: ${{ github.event_name == 'schedule' || inputs.pushToDist }} | |
run: | | |
git config --global user.name "CircleCI" | |
git config --global user.email "technical+circleci_mu@highsoft.com" | |
git config --global core.editor vi | |
git add . | |
git commit -m "Nightly build - ${{github.run_id}}" | |
git push -u origin nightly | |
nightly_changelog: | |
runs-on: ubuntu-latest | |
env: | |
HIGHCHARTS_VISUAL_TESTS_BUCKET: ${{secrets.VISUAL_TESTS_S3_BUCKET}} | |
AWS_ACCESS_KEY_ID: ${{secrets.VISUAL_TESTS_AWS_ACCESS_KEY_ID}} | |
AWS_SECRET_ACCESS_KEY: ${{secrets.VISUAL_TESTS_AWS_SECRET_ACCESS_KEY}} | |
AWS_REGION: ${{secrets.VISUAL_TESTS_AWS_REGION}} | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # get the full history | |
- run: npm i | |
- name: Build tree.json | |
run: | | |
npx gulp scripts | |
npx gulp jsdoc-options | |
- name: Generate and upload nightly changelog | |
run: | | |
node changelog/generate --review | |
aws s3 cp ./changelog/review.html s3://${HIGHCHARTS_VISUAL_TESTS_BUCKET}/changelog/nightly-changelog.html | |
- name: create list of merge commits | |
id: makelist | |
run: | | |
git log --since "24 hours ago" --oneline --grep "^.*Merge pull" > 24hoursofhighcharts.list | |
echo "lines=$(cat 24hoursofhighcharts.list | grep -e "Merge" -c)" >> $GITHUB_OUTPUT | |
- name: Convert to JSON | |
if: ${{ steps.makelist.outputs.lines > 0 }} | |
run: | | |
node ./.github/scripts/createListJSON \ | |
24hoursofhighcharts.list \ | |
24hoursofhighcharts.json | |
- name: Call Slack webhook | |
id: slack | |
if: ${{ steps.makelist.outputs.lines > 0 }} | |
uses: slackapi/slack-github-action@v1.24.0 | |
with: | |
payload-file-path: "24hoursofhighcharts.json" | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NIGHTLY_CHANGES_WEBHOOK }} | |