Skip to content

Integration tests #1010

Integration tests

Integration tests #1010

name: Integration tests
on:
schedule:
- cron: '0 6 * * *'
workflow_dispatch:
inputs:
build_secret:
type: string
description: Build secret
workflow_call: {}
jobs:
check-user-permissions:
runs-on: ubuntu-latest
steps:
- id: set-build-secret
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "::set-output name=BUILD_SECRET::${{ github.event.inputs.build_secret }}"
else
echo "::set-output name=BUILD_SECRET::${{ secrets.BUILD_SECRET }}"
fi
- name: Check user permission
uses: stjude/proteinpaint/.github/actions/check-user-permissions@master
with:
BUILD_SECRET: ${{ secrets.BUILD_SECRET }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUT_BUILD_SECRET: ${{ steps.set-build-secret.outputs.BUILD_SECRET }}
build:
needs: check-user-permissions
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 10
- uses: actions/setup-node@v3
with:
cache: 'npm'
node-version: '20'
- 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: |
cd shared/types
npm run build
cd ../../server
npx tsc
cd ..
- 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
- 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 }} https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"commit": "${{ env.SHORT_SHA }}",
"date-time": "${{ steps.current-time.outputs.formattedTime }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}