-
Notifications
You must be signed in to change notification settings - Fork 4
85 lines (80 loc) · 2.63 KB
/
test-push-release.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
73
74
75
76
77
78
79
80
81
82
83
84
85
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Run tests and build docker iamges
on:
push:
branches: [ develop, master, skip_es ]
tags:
- "*.*.*"
pull_request_target:
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: "${{ github.event.pull_request.head.sha }}"
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Pip installation
run: python -m pip install --upgrade pip poetry
- name: Poetry installation
run: poetry install
- name: Run tests
run: scripts/run_unit_tests
env:
WORKSPACE_TOKEN: ${{ secrets.WORKSPACE_TOKEN }}
RE_API_TOKEN: ${{ secrets.RE_API_TOKEN }}
build:
# Build and Push (if we get here)
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: "${{ github.event.pull_request.head.sha }}"
- uses: FranzDiebold/github-env-vars-action@v2
- name: Get current date
id: date
run: echo "::set-output name=date::$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry (GHCR)
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
pull: true
push: true
build-args: |
BUILD_CONFIG=ci
BUILD_DATE=${{ steps.date.outputs.date }}
VCS_REF=${{ github.sha }}
BRANCH=${{ github.ref }}
TAG=${{ github.ref }}
tags: ghcr.io/${{ github.repository_owner }}/index_runner:${{ env.CI_ACTION_REF_NAME }}
# release:
# runs-on: ubuntu-latest
# needs: test
# # Only run for pushes to develop/master
# # Skip release by putting "skip_docker_build" in the commit message
# if: |
# (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')
# && github.event_name == 'push'
# && !contains(github.event.head_commit.message, 'skip_docker_build')
# steps:
# - name: Docker build and deploy
# run: scripts/docker_deploy