Integration tests #425
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: Integration tests | |
on: | |
schedule: | |
- cron: '0 6 * * *' | |
workflow_dispatch: | |
inputs: | |
build_secret: | |
type: string | |
description: Build secret | |
workflow_call: {} | |
jobs: | |
build: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
steps: | |
- name: Check secret | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
if [ "${{ github.event.inputs.build_secret }}" != "${{ secrets.BUILD_SECRET }}" ]; then | |
echo "Wrong build secret." | |
exit 1 | |
fi | |
- name: Check user permission | |
if: github.event_name == 'workflow_dispatch' | |
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 | |
if: github.event_name == 'workflow_dispatch' | |
run: | | |
if [ "${{ 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 | |
with: | |
fetch-depth: 10 | |
- uses: actions/setup-node@v3 | |
with: | |
cache: 'npm' | |
node-version: '16' | |
- name: Install PP packages | |
run: | | |
npm ci | |
- name: Copy serverconfig.json to root | |
run: | | |
cp container/ci/serverconfig.json container/ | |
- 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: Login to Github | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.PAT }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Pack Tarballs | |
run: | | |
cd ./container | |
./pack.sh | |
- name: Build Docker Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./container/ | |
file: ./container/server/Dockerfile | |
tags: ppserver:latest | |
platforms: linux/amd64 | |
outputs: type=docker | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Run local server and integration tests | |
run: | | |
cd ./container | |
./run.sh ppserver:latest | |
sleep 10 | |
cd .. | |
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 }} |