-
Notifications
You must be signed in to change notification settings - Fork 59
72 lines (68 loc) · 2.37 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: memorious
on: [push, pull_request]
permissions:
packages: write
jobs:
python:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Show ref
run: |
echo "$GITHUB_REF"
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: "3.x"
- name: Install dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get install -y -qq p7zip-full libicu-dev
python -m pip install -U pip setuptools pyicu twine wheel
pip install pytest pytest-env pytest-cov pytest-mock
pip install -e .
- name: Bring up services for test
run: make services
- name: Run the tests
env:
HTTPBIN: https://localhost:443
run: |
pytest --cov=memorious --cov-report term-missing
- name: Test run memorious
run: |
memorious list
- name: Build a distribution
run: |
python setup.py sdist bdist_wheel
- name: Publish a Python distribution to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.pypi_password }}
docker:
runs-on: ubuntu-latest
needs: python
steps:
- uses: actions/checkout@v1
- name: Show ref
run: |
echo "$GITHUB_REF"
- name: Build docker image
run: |
docker build -t ghcr.io/alephdata/memorious:${GITHUB_SHA} .
- name: Push docker image for hash
env:
GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
if: env.GITHUB_PASSWORD != null
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
docker push ghcr.io/alephdata/memorious:${GITHUB_SHA}
- name: Push docker image for tags
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: |
docker tag ghcr.io/alephdata/memorious:${GITHUB_SHA} ghcr.io/alephdata/memorious:${GITHUB_REF/refs\/tags\//}
docker push ghcr.io/alephdata/memorious:${GITHUB_REF/refs\/tags\//}
docker tag ghcr.io/alephdata/memorious:${GITHUB_SHA} ghcr.io/alephdata/memorious:latest
docker push ghcr.io/alephdata/memorious:latest