Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

Add CI to test apps which use app-common #146

Merged
merged 8 commits into from
Dec 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 76 additions & 0 deletions .github/workflows/test-apps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Test applications

on:
pull_request:
branches:
- master

jobs:
test-apps:
runs-on: ubuntu-latest
timeout-minutes: 300

strategy:
matrix:
node-version: [16.x]
app:
- app-data-browser-next
- app-user-manager

steps:
- uses: actions/checkout@v2
with:
path: app-common
submodules: recursive

- name: Setup ssh-agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}

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

- name: Install deps of app-common
working-directory: app-common
run: npm install --unsafe-perm
env:
NODE_AUTH_TOKEN: ${{secrets.REPO_ACCESS_TOKEN}}

- name: Build app-common
working-directory: app-common
run: npm run build

- uses: actions/checkout@v2
with:
repository: dataware-tools/${{ matrix.app }}
path: app
submodules: recursive

- name: Build app
env:
NPM_REGISTRY: https://npm.pkg.github.com
NPM_TOKEN: ${{ secrets.REPO_ACCESS_TOKEN }}
shell: bash
working-directory: app
run: |
export DOCKER_BUILDKIT=1
echo "//${NPM_REGISTRY##*://}/:_authToken=${NPM_TOKEN}" > /tmp/.npmrc
docker build -t app:latest --ssh default --secret id=npmrc,src=/tmp/.npmrc --target test .

- name: Run test container
run: (docker run --privileged -v ${PWD}/app-common:/app-common:rw --name app-test app:latest) &

- name: Test app
shell: bash
run: |
docker exec app-test bash -c \
"rm -r node_modules/@dataware-tools/app-common/dist \
&& rm node_modules/@dataware-tools/app-common/package.json \
&& ln -s /app-common/dist node_modules/@dataware-tools/app-common/dist \
&& ln -s /app-common/package.json node_modules/@dataware-tools/app-common/package.json \
&& npm run test \
"