Merge pull request #169 from simple-login/github-action

Apply github action on PR, upgrade to action v2 and use cache
This commit is contained in:
Son Nguyen Kim 2020-05-09 09:06:54 +02:00 committed by GitHub
commit 8417bb5ed8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 6 deletions

View File

@ -1,6 +1,6 @@
name: Run tests & Public to Docker Registry
on: [push]
on: [push, pull_request]
jobs:
build:
@ -12,12 +12,21 @@ jobs:
python-version: [3.7]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Test formatting
run: |
pip install black
@ -34,15 +43,18 @@ jobs:
pytest
- name: Publish to Docker Registry
uses: elgohr/Publish-Docker-Github-Action@master
if: github.event_name == 'push'
uses: docker/build-push-action@v1
with:
name: simplelogin/app-ci
repository: simplelogin/app-ci
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
tag_with_ref: true
- name: Send Telegram message
if: github.event_name == 'push'
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
args: Docker image pushed on ${{ github.ref }}
args: Docker image pushed on ${{ github.ref }}