-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (47 loc) · 1.61 KB
/
ci.yaml
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
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: pip install -r requirements.txt
- name: Run tests
run: py.test --flake8 --cov=app
build:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v2
- name: Define the Docker tag
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF} | sed -E 's,refs/(heads|tags)/,,' | sed -E 's,/,-,g')
- name: Print the tag
id: print
run: echo ${{steps.vars.outputs.tag}}
- name: Log into Docker Hub
if: ${{ github.event_name == 'push' }}
run: echo ${{ secrets.DOCKER_TOKEN }} | docker login --username ${{ secrets.DOCKER_USERNAME }} --password-stdin
- name: Read .nvmrc
id: node_version
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
- name: Set up node
uses: actions/setup-node@v2
with:
node-version: ${{ steps.node_version.outputs.NODE_VERSION }}
- name: Install npm packages
run: npm install .
- name: Create assets
run: gulp assets --env=deploy
- name: Build the runtime Docker image
run: |
docker build --tag lsstsqre/ltd-dasher:${{steps.vars.outputs.tag}} .
- name: Push Docker images
if: ${{ github.event_name == 'push' }}
run: |
docker push lsstsqre/ltd-dasher:${{steps.vars.outputs.tag}}