Skip to content

Commit

Permalink
WIP fixing build
Browse files Browse the repository at this point in the history
  • Loading branch information
tompahoward committed Nov 7, 2020
1 parent 69317f2 commit cee599d
Showing 1 changed file with 80 additions and 35 deletions.
115 changes: 80 additions & 35 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- name: Cache NPM dependencies
uses: actions/cache@v1
- uses: actions/cache@v1
with:
path: |
~/.npm
Expand All @@ -40,13 +39,6 @@ jobs:
node-version: 12.x
- run: env
- run: npm install
- run: npm config set script-shell $(which bash)
- uses: actions/upload-artifact@v2
with:
name: dependencies
path: |
node_modules
~/.npm

lint:
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
Expand All @@ -62,11 +54,19 @@ jobs:

steps:
- uses: actions/checkout@v2

- uses: actions/cache@v1
with:
path: |
~/.npm
node_modules
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }}

- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- uses: actions/download-artifact@v2
- run: npm config set script-shell $(which bash)
- run: npm run lint

build:
Expand All @@ -82,12 +82,20 @@ jobs:
shell: bash

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- uses: actions/cache@v1
with:
path: |
~/.npm
node_modules
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }}

- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- uses: actions/download-artifact@v2
- run: npm config set script-shell $(which bash)
- run: npm run build

test-node-api:
Expand All @@ -107,19 +115,22 @@ jobs:
shell: bash

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- uses: actions/cache@v1
with:
path: |
~/.npm
node_modules
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- uses: actions/download-artifact@v2
- run: npm config set script-shell $(which bash)
- run: npm run cover:node-api
- uses: actions/upload-artifact@v2
with:
name: test-node-api
path: |
coverage/node-api

get-browser-list:
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"
Expand All @@ -137,13 +148,21 @@ jobs:
shell: bash

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- uses: actions/cache@v1
with:
path: |
~/.npm
node_modules
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }}

- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x

- uses: actions/download-artifact@v2
- run: npm config set script-shell $(which bash)
- run: npm run --silent json:list-github-actions-browser-matrix > browser-matrix.json
- id: set-matrix
run: echo "::set-output name=matrix::$(cat browser-matrix.json)"
Expand All @@ -153,7 +172,6 @@ jobs:
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')"

needs:
- dependencies
- get-browser-list

runs-on: ubuntu-latest
Expand All @@ -167,28 +185,30 @@ jobs:
shell: bash

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- uses: actions/cache@v1
with:
path: |
~/.npm
node_modules
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }}

- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x

- uses: actions/download-artifact@v2
- run: npm config set script-shell $(which bash)
- run: npm run cover:browser-api:${{ matrix.browser }}:remote
env:
BROWSERSTACK_ACCESS_KEY: ${{secrets.BROWSERSTACK_ACCESS_KEY}}
BROWSERSTACK_USERNAME: ${{secrets.BROWSERSTACK_USERNAME}}
- uses: actions/upload-artifact@v2
with:
name: test-browser-api-${{ matrix.browser }}
path: |
coverage/browser-api-${{ matrix.browser }}-remote

report-cover:
if: github.ref == 'refs/heads/main' && ! contains(toJSON(github.event.commits.*.message), '[skip-ci]')

needs:
- dependencies
- test-node-api
- test-browser-api

Expand All @@ -200,11 +220,20 @@ jobs:

steps:
- uses: actions/checkout@v2

- uses: actions/cache@v1
with:
path: |
~/.npm
node_modules
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }}

- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- uses: actions/download-artifact@v2

- run: npm config set script-shell $(which bash)
- run: npm run report:cover

publish-reports:
Expand All @@ -213,7 +242,6 @@ jobs:
continue-on-error: true

needs:
- dependencies
- report-cover

runs-on: ubuntu-latest
Expand All @@ -223,7 +251,7 @@ jobs:
shell: bash

steps:
- uses: actions/download-artifact@v2

- name: Publish Cover Report
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
Expand All @@ -233,11 +261,20 @@ jobs:
TARGET_FOLDER: /builds/${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}/coverage
CLEAN: true # Automatically remove deleted files from the deploy branch

- name: Publish Test Results
uses: JamesIves/github-pages-deploy-action@3.7.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: test-results/full # The folder the action should deploy.
TARGET_FOLDER: /builds/${GITHUB_RUN_ID}-${GITHUB_RUN_NUMBER}/test-results
CLEAN: true # Automatically remove deleted files from the deploy branch


publish:
if: github.ref == 'refs/heads/main' && ! contains(toJSON(github.event.commits.*.message), '[skip-ci]')

needs:
- dependencies
- lint
- build
- report-cover
Expand All @@ -250,13 +287,21 @@ jobs:

steps:
- uses: actions/checkout@v2

- uses: actions/cache@v1
with:
path: |
~/.npm
node_modules
key: ${{ runner.OS }}-npm-cache-${{ hashFiles('**/package-lock.json') }}

- uses: actions/setup-node@v1
with:
node-version: 12.x
registry-url: https://registry.npmjs.org/
- uses: actions/download-artifact@v2
- name: Publish and Tag
run: |
npm config set script-shell $(which bash)
PACKAGE_NAME=$(node -p "require('./package.json').name")
CURRENT_VERSION=$(npm --unsafe-perm show "${PACKAGE_NAME}" version)
PACKAGE_VERSION=$(node -p "require('./package.json').version")
Expand Down

0 comments on commit cee599d

Please sign in to comment.