-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (86 loc) · 2.69 KB
/
magla_ci.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
86
87
88
89
90
name: magla-CI
on:
push:
branches:
- development
- features/**
- bugs/**
pull_request:
tags:
- "auto-pull-request"
- "auto-merge"
- "!WIP"
- "!wip"
jobs:
build_and_test:
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.6]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install .[dev]
- name: Coverage and Test Reports
run: |
coverage run --source magla -m pytest -v
coverage report
env:
MAGLA_DB_DATA_DIR: ${{github.workspace}}/magla/db/data
MAGLA_DB_NAME: "magla_sqlite"
MAGLA_TEST_DIR: ${{github.workspace}}/tests
MAGLA_MACHINE_CONFIG_DIR: ${{github.workspace}}/tests/magla_machine
auto_pr:
needs: build_and_test
runs-on: ubuntu-latest
outputs:
# this output is accessible by other jobs
number: ${{ steps.create_pr.outputs.pull-request-url }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Reset ${{ github.head_ref }} Branch
run: |
git fetch origin ${{ github.head_ref }}:${{ github.head_ref }}
git reset --hard ${{ github.head_ref }}
- name: Create Auto-PR
id: create_pr
uses: peter-evans/create-pull-request@v3
with:
branch: ${{ github.ref }}
base: development
labels: |
auto-pull-request
auto-merge
title: Automated development update from ${{ github.actor }}
body: "This automated-pull request is part of `magla`'s continuous integration pipeline and aims to keep the development branch up-to-date with the `${{ github.ref }}` branch."
auto_merge:
runs-on: ubuntu-latest
needs: auto_pr
if: ${{ github.event_name }} == "pull_request"
env:
PR_NUM: ${{ needs.auto_pr.outputs.number }}
steps:
- name: Merge
uses: actions/github-script@v3.0.0
with:
script: |
var pr_url = "${{ env.PR_NUM }}"
var pr_num = pr_url.substr(pr_url.lastIndexOf('/') + 1)
github.pulls.merge({
owner: context.payload.repository.owner.login,
repo: context.payload.repository.name,
pull_number: pr_num
})
github-token: ${{ github.token }}