changes #185
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: TDS Workflow | |
on: | |
push: | |
branches: [master, main] | |
pull_request: | |
branches: [master, main] | |
env: | |
NODE_VERSION: "12.14.x" | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Branch | |
uses: actions/checkout@v2 | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache shared node modules | |
uses: actions/cache@v2 | |
id: cache-tds-files-shared-node-modules | |
with: | |
path: "*/*/*/node_modules" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/*/package.json') }} | |
- name: Cache shared dist | |
uses: actions/cache@v2 | |
id: cache-tds-files-shared-dist | |
with: | |
path: "*/*/*/dist" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/*/package.json') }} | |
- name: Cache packages node modules | |
uses: actions/cache@v2 | |
id: cache-tds-files-packages-node-modules | |
with: | |
path: "*/*/node_modules" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/package.json') }} | |
- name: Cache packages dist | |
uses: actions/cache@v2 | |
id: cache-tds-files-packages-dist | |
with: | |
path: "*/*/dist" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/package.json') }} | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
id: cache-tds-files-node-modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('package-lock.json') }} | |
- name: Bootstrap | |
if: ${{ steps.cache-tds-files-shared-node-modules.outputs.cache-hit != 'true' || steps.cache-tds-files-shared-dist.outputs.cache-hit != 'true' || steps.cache-tds-files-packages-node-modules.outputs.cache-hit != 'true' || steps.cache-tds-files-packages-dist.outputs.cache-hit != 'true' || steps.cache-tds-files-node-modules.outputs.cache-hit != 'true' }} | |
run: npm run bootstrap | |
lint: | |
name: Lint Tests | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout Branch | |
uses: actions/checkout@v2 | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache shared node modules | |
uses: actions/cache@v2 | |
id: cache-tds-files-shared-node-modules | |
with: | |
path: "*/*/*/node_modules" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/*/package.json') }} | |
- name: Cache shared dist | |
uses: actions/cache@v2 | |
id: cache-tds-files-shared-dist | |
with: | |
path: "*/*/*/dist" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/*/package.json') }} | |
- name: Cache packages node modules | |
uses: actions/cache@v2 | |
id: cache-tds-files-packages-node-modules | |
with: | |
path: "*/*/node_modules" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/package.json') }} | |
- name: Cache packages dist | |
uses: actions/cache@v2 | |
id: cache-tds-files-packages-dist | |
with: | |
path: "*/*/dist" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/package.json') }} | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
id: cache-tds-files-node-modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('package-lock.json') }} | |
- name: Run Lint Tests | |
run: npm run lint | |
unit: | |
name: Unit Tests | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Checkout Branch | |
uses: actions/checkout@v2 | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "12.14.x" | |
- name: Cache shared node modules | |
uses: actions/cache@v2 | |
id: cache-tds-files-shared-node-modules | |
with: | |
path: "*/*/*/node_modules" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/*/package.json') }} | |
- name: Cache shared dist | |
uses: actions/cache@v2 | |
id: cache-tds-files-shared-dist | |
with: | |
path: "*/*/*/dist" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/*/package.json') }} | |
- name: Cache packages node modules | |
uses: actions/cache@v2 | |
id: cache-tds-files-packages-node-modules | |
with: | |
path: "*/*/node_modules" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/package.json') }} | |
- name: Cache packages dist | |
uses: actions/cache@v2 | |
id: cache-tds-files-packages-dist | |
with: | |
path: "*/*/dist" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/package.json') }} | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
id: cache-tds-files-node-modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('package-lock.json') }} | |
- name: Run Unit Tests | |
run: npm run test | |
# e2e: | |
# name: E2E Tests | |
# runs-on: ubuntu-latest | |
# needs: build | |
# steps: | |
# - name: Checkout Branch | |
# uses: actions/checkout@v2 | |
# - name: Setup Node | |
# uses: actions/setup-node@v1 | |
# with: | |
# node-version: ${{ env.NODE_VERSION }} | |
# - name: Cache shared node modules | |
# uses: actions/cache@v2 | |
# id: cache-tds-files-shared-node-modules | |
# with: | |
# path: "*/*/*/node_modules" | |
# key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/*/package.json') }} | |
# - name: Cache shared dist | |
# uses: actions/cache@v2 | |
# id: cache-tds-files-shared-dist | |
# with: | |
# path: "*/*/*/dist" | |
# key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/*/package.json') }} | |
# - name: Cache packages node modules | |
# uses: actions/cache@v2 | |
# id: cache-tds-files-packages-node-modules | |
# with: | |
# path: "*/*/node_modules" | |
# key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/package.json') }} | |
# - name: Cache packages dist | |
# uses: actions/cache@v2 | |
# id: cache-tds-files-packages-dist | |
# with: | |
# path: "*/*/dist" | |
# key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/package.json') }} | |
# - name: Cache node modules | |
# uses: actions/cache@v2 | |
# id: cache-tds-files-node-modules | |
# with: | |
# path: node_modules | |
# key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('package-lock.json') }} | |
# - name: Prepare node-sass | |
# run: npm rebuild node-sass | |
# - name: Get Branch Name | |
# shell: bash | |
# run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
# id: get_branch | |
# - name: Styleguidist Server | |
# run: | | |
# npm run dev:e2e-direct & | |
# sleep 10 | |
# - name: Run tests | |
# run: npm run test:e2e-direct -- -a | |
prepr-log: | |
if: github.event_name == 'pull_request' | |
name: Pre PR logs | |
runs-on: ubuntu-latest | |
needs: [lint, unit] | |
steps: | |
- name: Checkout Branch | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache shared node modules | |
uses: actions/cache@v2 | |
id: cache-tds-files-shared-node-modules | |
with: | |
path: "*/*/*/node_modules" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/*/package.json') }} | |
- name: Cache shared dist | |
uses: actions/cache@v2 | |
id: cache-tds-files-shared-dist | |
with: | |
path: "*/*/*/dist" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/*/package.json') }} | |
- name: Cache packages node modules | |
uses: actions/cache@v2 | |
id: cache-tds-files-packages-node-modules | |
with: | |
path: "*/*/node_modules" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/package.json') }} | |
- name: Cache packages dist | |
uses: actions/cache@v2 | |
id: cache-tds-files-packages-dist | |
with: | |
path: "*/*/dist" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/package.json') }} | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
id: cache-tds-files-node-modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('package-lock.json') }} | |
- name: Install expect | |
run: sudo apt-get install -y expect | |
- name: Pre PR log output | |
run: ./scripts/prePr.sh | |
prepr-bot: | |
if: github.event_name == 'pull_request' | |
name: Pre PR bot | |
runs-on: ubuntu-latest | |
needs: prepr-log | |
steps: | |
- name: Checkout Branch | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install expect | |
run: sudo apt-get install -y expect | |
- name: Configure Git Config & Branch | |
run: | | |
git status | |
git config --global user.email "[email protected]" | |
git config --global user.name "TDSBot" | |
- name: Rebase branch | |
run: git rebase origin/master | |
- name: TDS Bot output | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
GITHUB_PULL_REQUEST: ${{ github.event.pull_request.number }} | |
run: | | |
cd ./scripts/gha | |
npm ci | |
node github-pr.js | |
release: | |
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' | |
name: Cut a release | |
runs-on: ubuntu-latest | |
needs: [lint, unit] | |
environment: | |
name: npm | |
url: https://www.npmjs.com/settings/tds/packages | |
steps: | |
- name: Checkout Branch | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref_name }} | |
token: ${{ secrets.GH_TOKEN_WRITE }} | |
- name: Configure Git Config & Branch | |
run: | | |
git config user.name "TDSBot" | |
git config user.email "[email protected]" | |
git fetch origin --tags | |
- name: Setup .npmrc | |
run: | | |
npm set @telus:registry=https://npm.pkg.github.com/telus | |
npm set "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" | |
- name: Setup Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Cache shared node modules | |
uses: actions/cache@v2 | |
id: cache-tds-files-shared-node-modules | |
with: | |
path: "*/*/*/node_modules" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/*/package.json') }} | |
- name: Cache shared dist | |
uses: actions/cache@v2 | |
id: cache-tds-files-shared-dist | |
with: | |
path: "*/*/*/dist" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/*/package.json') }} | |
- name: Cache packages node modules | |
uses: actions/cache@v2 | |
id: cache-tds-files-packages-node-modules | |
with: | |
path: "*/*/node_modules" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/package.json') }} | |
- name: Cache packages dist | |
uses: actions/cache@v2 | |
id: cache-tds-files-packages-dist | |
with: | |
path: "*/*/dist" | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('*/*/package.json') }} | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
id: cache-tds-files-node-modules | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-${{ github.action}}-${{ hashFiles('package-lock.json') }} | |
- name: Lerna Publish | |
run: npm run lerna:cipublish | |
- name: Update contributors | |
run: npm run contributors:update | |
- name: Commit updated contributors | |
run: | | |
if [[ $(git diff --name-only) ]] | |
then | |
git add .all-contributorsrc README.md | |
git commit -m "chore(other): update contributors" --no-verify | |
git push | |
else | |
echo 'No contributor changes.' | |
fi |