Skip to content

Merge branch 'main' into wip/dev-bump-api-version #2939

Merge branch 'main' into wip/dev-bump-api-version

Merge branch 'main' into wip/dev-bump-api-version #2939

Workflow file for this run

name: CI
env:
NodeVersion: 16.15.0
DistDirectory: ./build/
CacheName: dsp-js-lib
on:
push:
release:
types: [published]
jobs:
find-ignored-tests:
name: Find ignored tests
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Run the script
run: ./find-ignored-tests.sh
unit-tests:
name: Run unit tests
needs: [find-ignored-tests]
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Cache node_modules artifacts
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.CacheName }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Set up Node.js ${{ env.NodeVersion }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NodeVersion }}
- name: Install requirements
run: |
sudo apt-get install expect
sudo npm install --global @bazel/bazelisk
- name: Install dependencies
run: make npm-install
- name: Prepare test data
run: make prepare-test-data
- name: Run unit tests
run: make unit-tests
e2e-tests:
name: Run e2e tests incl. build lib
needs: [find-ignored-tests]
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Cache node_modules artifacts
uses: actions/cache@v1
with:
path: node_modules
key: ${{ runner.OS }}-build-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.OS }}-build-${{ env.CacheName }}-
${{ runner.OS }}-build-
${{ runner.OS }}-
- name: Set up Node.js ${{ env.NodeVersion }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NodeVersion }}
- name: Install requirements
run: |
sudo apt-get install expect
sudo npm install --global @bazel/bazelisk
- name: Install dependencies
run: make npm-install
# - name: Get api client test data from knora-api (makefile variant)
# run: make get-test-data-from-release
# - name: Prepare test data
# run: make prepare-test-data
- name: Build lib
run: make build
- name: Prepare test environment
run: make prepare-test-ci
- name: Run e2e tests
run: make e2e-tests
release-please:
name: Prepare next release
runs-on: ubuntu-latest
# Automate releases with Conventional Commit Messages as Pull Requests are merged into "main" branch
if: github.ref == 'refs/heads/main'
steps:
- uses: GoogleCloudPlatform/release-please-action@v2
with:
token: ${{ secrets.GH_TOKEN }}
release-type: node
changelog-types: '[{"type": "feat", "section": "Enhancements", "hidden": false }, {"type": "fix", "section": "Bug Fixes", "hidden": false }, {"type": "chore", "section": "Maintenance", "hidden": false }, {"type": "refactor", "section": "Maintenance", "hidden": false }, {"type": "docs", "section": "Documentation", "hidden": false }]'
build:
name: Build package and publish (on release only)
needs: [
unit-tests,
e2e-tests
]
runs-on: ubuntu-latest
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Set up Node.js ${{ env.NodeVersion }}
uses: actions/setup-node@v1
with:
node-version: ${{ env.NodeVersion }}
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: |
sudo npm install --global @bazel/bazelisk
npm install
npm run peer-deps
- name: Prepare dev publication
run: npm run prepare-dev-publication
- name: Build
run: npm run build
- if: "github.event.release.prerelease"
name: Publish pre-release to GitHub packages
run: npm publish ${{env.DistDirectory}} --registry=https://npm.pkg.github.com/ --_authToken=${{secrets.GITHUB_TOKEN}} --tag rc --access public
- if: "!github.event.release.prerelease"
name: Publish release to GitHub packages
run: npm publish ${{env.DistDirectory}} --registry=https://npm.pkg.github.com/ --_authToken=${{secrets.GITHUB_TOKEN}} --access public
notification:
name: Google chat notification about release and published version
needs: [build]
runs-on: ubuntu-latest
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
steps:
- name: Send notification to google chat room "DSP releases"
uses: lakto/google-chat-action@main
with:
url: ${{ secrets.GOOGLE_CHAT_DSP_RELEASES_WEBHOOK_URL }}
publish-docs:
name: Build and publish API docs
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'release' && !github.event.release.prerelease && startsWith(github.ref, 'refs/tags')
steps:
- name: Check out
uses: actions/checkout@v1
- name: Install dependencies
run: |
npm install
npm run peer-deps
- name: Build API docs
run: |
npm run typedoc-config
npm run build-docs
- name: Publish generated content to GitHub Pages
uses: tsunematsu21/actions-publish-gh-pages@v1.0.1
with:
dir: docs
branch: gh-pages
token: ${{ secrets.GH_TOKEN }}