mirror of
https://github.com/simple-login/app.git
synced 2024-09-20 15:05:59 +08:00
Apply github action on PR, upgrade to action v2 and use cache
This commit is contained in:
parent
2c1daf5bb1
commit
88b957fe8b
22
.github/workflows/main.yml
vendored
22
.github/workflows/main.yml
vendored
|
@ -1,6 +1,6 @@
|
||||||
name: Run tests & Public to Docker Registry
|
name: Run tests & Public to Docker Registry
|
||||||
|
|
||||||
on: [push]
|
on: [push, pull_request]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
@ -12,12 +12,21 @@ jobs:
|
||||||
python-version: [3.7]
|
python-version: [3.7]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
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
|
- name: Test formatting
|
||||||
run: |
|
run: |
|
||||||
pip install black
|
pip install black
|
||||||
|
@ -34,15 +43,18 @@ jobs:
|
||||||
pytest
|
pytest
|
||||||
|
|
||||||
- name: Publish to Docker Registry
|
- name: Publish to Docker Registry
|
||||||
uses: elgohr/Publish-Docker-Github-Action@master
|
if: github.event_name == 'push'
|
||||||
|
uses: docker/build-push-action@v1
|
||||||
with:
|
with:
|
||||||
name: simplelogin/app-ci
|
name: simplelogin/app-ci
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
tag_with_ref: true
|
||||||
|
|
||||||
- name: Send Telegram message
|
- name: Send Telegram message
|
||||||
|
if: github.event_name == 'push'
|
||||||
uses: appleboy/telegram-action@master
|
uses: appleboy/telegram-action@master
|
||||||
with:
|
with:
|
||||||
to: ${{ secrets.TELEGRAM_TO }}
|
to: ${{ secrets.TELEGRAM_TO }}
|
||||||
token: ${{ secrets.TELEGRAM_TOKEN }}
|
token: ${{ secrets.TELEGRAM_TOKEN }}
|
||||||
args: Docker image pushed on ${{ github.ref }}
|
args: Docker image pushed on ${{ github.ref }}
|
Loading…
Reference in a new issue