fix: temporarily swallow exception when setting up focalboard client #512
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: Docker testing | |
on: | |
push: | |
# Publish `dev` as Docker `testing` image. | |
branches: | |
- dev | |
env: | |
IMAGE_NAME: sysblokbot | |
jobs: | |
# Run tests. | |
# See also https://docs.docker.com/docker-hub/builds/automated-testing/ | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@0.9.1 | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/checkout@v2 | |
with: | |
ref: dev | |
- name: Python Style Checker | |
working-directory: ${{ github.workspace }} | |
run: | | |
pip3 install --upgrade pip | |
export PATH="$HOME/.local/bin:$PATH" | |
pip3 install pycodestyle | |
pycodestyle . --max-line-length 100 | |
- name: Notify us about failure | |
if: ${{ failure() }} | |
env: | |
TELEGRAM_TEST_TOKEN: ${{ secrets.TELEGRAM_TEST_TOKEN }} | |
TELEGRAM_ERROR_CHAT_ID: ${{ secrets.TELEGRAM_ERROR_CHAT_ID }} | |
run: | | |
curl -X POST \ | |
-H 'Content-Type: application/json' \ | |
-d '{"parse_mode": "markdown", "chat_id": "${{ env.TELEGRAM_ERROR_CHAT_ID }}", "text": "[github CI] pycodestyle [failed](https://github.com/sysblok/sysblokbot/actions/runs/${{github.run_id}})" \ | |
}' \ | |
https://api.telegram.org/bot${{env.TELEGRAM_TEST_TOKEN}}/sendMessage | |
# - name: Python Pytest Github Action | |
# uses: fylein/python-pytest-github-action@v2 | |
# with: | |
# args: apt-get update && apt-get install -y git && pip3 install -e . && pip3 install -r requirements.txt && pytest tests/unit | |
- name: Notify us about failure | |
if: ${{ failure() }} | |
env: | |
TELEGRAM_TEST_TOKEN: ${{ secrets.TELEGRAM_TEST_TOKEN }} | |
TELEGRAM_ERROR_CHAT_ID: ${{ secrets.TELEGRAM_ERROR_CHAT_ID }} | |
run: | | |
curl -X POST \ | |
-H 'Content-Type: application/json' \ | |
-d '{"parse_mode": "markdown", "chat_id": "${{ env.TELEGRAM_ERROR_CHAT_ID }}", "text": "[github CI] unit tests [failed](https://github.com/sysblok/sysblokbot/actions/runs/${{github.run_id}})" \ | |
}' \ | |
https://api.telegram.org/bot${{env.TELEGRAM_TEST_TOKEN}}/sendMessage | |
# Push image to GitHub Packages. | |
# See also https://docs.docker.com/docker-hub/builds/ | |
push: | |
# Ensure test job passes before pushing image. | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: dev | |
- name: Generate build args | |
id: args | |
run: | | |
echo "::set-output name=commit_hash::$(git rev-parse HEAD)" | |
echo "::set-output name=commit_hash_short::$(git rev-parse --short HEAD)" | |
- name: Publish to Github Packages Registry with cache | |
uses: whoan/docker-build-with-cache-action@v5 | |
env: | |
IMAGE_NAME: ${{ env.IMAGE_NAME }} | |
COMMIT_HASH: "${{ steps.args.outputs.commit_hash }}" | |
COMMIT_HASH_SHORT: "${{ steps.args.outputs.commit_hash_short }}" | |
with: | |
image_name: ${{ github.repository }}/${{ env.IMAGE_NAME }} | |
registry: docker.pkg.github.com | |
username: sysblok | |
password: ${{ secrets.GITHUB_TOKEN }} | |
dockerfile: Dockerfile | |
image_tag: testing | |
build_extra_args: "--build-arg=COMMIT_HASH --build-arg=COMMIT_HASH_SHORT" | |
- name: Notify us about failure | |
if: ${{ failure() }} | |
env: | |
TELEGRAM_TEST_TOKEN: ${{ secrets.TELEGRAM_TEST_TOKEN }} | |
TELEGRAM_ERROR_CHAT_ID: ${{ secrets.TELEGRAM_ERROR_CHAT_ID }} | |
run: | | |
curl -X POST \ | |
-H 'Content-Type: application/json' \ | |
-d '{"parse_mode": "markdown", "chat_id": "${{ env.TELEGRAM_ERROR_CHAT_ID }}", "text": "[github CI] build [failed](https://github.com/sysblok/sysblokbot/actions/runs/${{github.run_id}})" \ | |
}' \ | |
https://api.telegram.org/bot${{env.TELEGRAM_TEST_TOKEN}}/sendMessage | |
- name: Deploy package to digitalocean | |
uses: appleboy/ssh-action@master | |
env: | |
GITHUB_USERNAME: sysblok | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
IMAGE_NAME: ${{ env.IMAGE_NAME }} | |
ROOT_DIR: /home/${{ secrets.MASTER_DO_USER }}/testing | |
TELEGRAM_TEST_TOKEN: ${{ secrets.TELEGRAM_TEST_TOKEN }} | |
TELEGRAM_ERROR_CHAT_ID: ${{ secrets.TELEGRAM_ERROR_CHAT_ID }} | |
with: | |
host: ${{ secrets.MASTER_HOST }} | |
username: ${{ secrets.MASTER_DO_USER }} | |
passphrase: ${{ secrets.MASTER_DO_SSH_KEY_PASSWORD }} | |
key: ${{ secrets.MASTER_DO_SSH_KEY }} | |
port: ${{ secrets.MASTER_PORT }} | |
envs: GITHUB_USERNAME, GITHUB_TOKEN, IMAGE_NAME, ROOT_DIR, TELEGRAM_TEST_TOKEN, TELEGRAM_ERROR_CHAT_ID | |
script: | | |
export CONTAINER_ID=$(docker ps -aq --filter name=testing) | |
export IMAGE_ID=$(docker images -aq --filter reference='docker.pkg.github.com/sysblok/sysblokbot/sysblokbot:testing') | |
docker stop --time=30 $CONTAINER_ID | |
docker rm $CONTAINER_ID | |
docker rmi $IMAGE_ID | |
docker login docker.pkg.github.com -u $GITHUB_USERNAME -p $GITHUB_TOKEN | |
touch ${{ env.ROOT_DIR }}/sysblokbot.sqlite | |
touch ${{ env.ROOT_DIR }}/strings.sqlite | |
touch ${{ env.ROOT_DIR }}/board_credentials.json | |
docker run -dit --name sysblokbot-testing \ | |
--env APP_SOURCE="github CI" --restart unless-stopped \ | |
--env TELEGRAM_ERROR_CHAT_ID="${{ env.TELEGRAM_ERROR_CHAT_ID }}" \ | |
--env TELEGRAM_TOKEN="${{ env.TELEGRAM_TEST_TOKEN }}" \ | |
-v ${{ env.ROOT_DIR }}/config_override.json:/app/config_override.json \ | |
-v ${{ env.ROOT_DIR }}/config_gs.json:/app/config_gs.json \ | |
-v ${{ env.ROOT_DIR }}/sysblokbot.sqlite:/app/sysblokbot.sqlite \ | |
-v ${{ env.ROOT_DIR }}/strings.sqlite:/app/strings.sqlite \ | |
-v ${{ env.ROOT_DIR }}/persistent_storage.pickle:/app/persistent_storage.pickle \ | |
-v ${{ env.ROOT_DIR }}/board_credentials.json:/app/board_credentials.json \ | |
docker.pkg.github.com/sysblok/sysblokbot/${{ env.IMAGE_NAME }}:testing | |
- name: Notify us about failure | |
if: ${{ failure() }} | |
env: | |
TELEGRAM_TEST_TOKEN: ${{ secrets.TELEGRAM_TEST_TOKEN }} | |
TELEGRAM_ERROR_CHAT_ID: ${{ secrets.TELEGRAM_ERROR_CHAT_ID }} | |
run: | | |
curl -X POST \ | |
-H 'Content-Type: application/json' \ | |
-d '{"parse_mode": "markdown", "chat_id": "${{ env.TELEGRAM_ERROR_CHAT_ID }}", "text": "[github CI] deploy [failed](https://github.com/sysblok/sysblokbot/actions/runs/${{github.run_id}})" \ | |
}' \ | |
https://api.telegram.org/bot${{env.TELEGRAM_TEST_TOKEN}}/sendMessage | |
# integration_tests: | |
# needs: push | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v2 | |
# with: | |
# ref: dev | |
# - name: Integration tests | |
# uses: fylein/python-pytest-github-action@v2 | |
# env: | |
# CONFIG_OVERRIDE: ${{ secrets.CONFIG_OVERRIDE_TESTING }} | |
# with: | |
# args: | | |
# apt-get update && apt-get install -y git && \ | |
# pip3 install -e . && pip3 install -r requirements.txt && \ | |
# pytest tests/integration -vs |