Skip to content

Integration tests

Integration tests #368

name: Integration tests
on:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
inputs:
build_secret:
type: string
description: Build secret
jobs:
build:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Check secret
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ github.event.inputs.build_secret }}" != "${{ secrets.BUILD_SECRET }}" ]; then
echo "Wrong build secret."
exit 1
fi
- name: Check user permission
id: check
uses: scherermichael-oss/action-has-permission@master
with:
required-permission: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Exit if user doesn't have write permission
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ steps.check.outputs.has-permission }}" = "false" ]
then
echo "Only users with write permission are allowed to execute this workflow."
exit 1
fi
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
cache: 'npm'
node-version: '16'
- name: Install PP packages
run: |
npm ci
cd rust && npm run build
- name: Copy serverconfig.json to root
run: |
cd container/ci
node -e 'const fs = require("fs"); const serverconfig = JSON.parse(fs.readFileSync("serverconfig.json")); tpmasterdir = "/home/runner/work/${{ github.event.repository.name }}/${{ github.event.repository.name }}/server/test/tp"; fs.writeFileSync("data.json", JSON.stringify(serverconfig));'
TPMASTERDIR=$(node -p "require('./serverconfig.json').tpmasterdir")
mv serverconfig.json ../
- name: Create cache folder
run: mkdir cache
- name: install xvfb
run: sudo apt-get install xvfb
- name: TSC
run: tsc --esModuleInterop server/genome/*.ts server/dataset/*.ts
- name: CP termdb
run: |
mkdir -p container/dataset
cp server/dataset/termdb.test.js container/dataset
- name: Run local server and integration tests
run: |
cd container
cp ci/ci-run.sh ci-run.sh
./ci-run.sh
sleep 10
xvfb-run --auto-servernum npm run test:integration-ci
- name: Get current time
uses: josStorer/get-current-time@v2.0.2
id: current-time
if: always()
with:
format: MMM DD, yyyy HH:mm:ss
utcOffset: "-06:00"
- name: Set short git commit SHA
id: vars
if: always()
run: echo "SHORT_SHA=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV
- name: Post build results on slack
id: slack
if: always()
uses: slackapi/slack-github-action@v1.23.0
with:
payload: |
{
"status": "${{ job.status }}",
"commit": "${{ env.SHORT_SHA }}",
"date-time": "${{ steps.current-time.outputs.formattedTime }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}