-
Notifications
You must be signed in to change notification settings - Fork 4
114 lines (96 loc) · 3.09 KB
/
main.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
---
# yamllint disable rule:truthy rule:truthy rule:line-length
name: "CI"
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
jobs:
files-changed:
name: Detect which file has changed
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
yaml: ${{ steps.changes.outputs.yaml_all }}
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: Check for file changes
uses: dorny/paths-filter@v3
id: changes
with:
token: ${{ github.token }}
filters: .github/file-filters.yml
yaml-lint:
if: needs.files-changed.outputs.yaml == 'true'
needs: ["files-changed"]
runs-on: "ubuntu-latest"
timeout-minutes: 5
steps:
- name: "Check out repository code"
uses: "actions/checkout@v4"
- name: "Setup environment"
run: "pip install yamllint==1.35.1"
- name: "Linting: yamllint"
run: "yamllint -s ."
E2E-testing-invoke-start:
needs:
- files-changed
- yaml-lint
if: |
always() && !cancelled() &&
!contains(needs.*.result, 'failure') &&
!contains(needs.*.result, 'cancelled')
runs-on:
group: huge-runners
steps:
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Invoke
run: |
pip install toml invoke
- name: Set job name
run: echo JOB_NAME="$GITHUB_JOB" >> $GITHUB_ENV
- name: "Set environment variables"
run: echo INFRAHUB_BUILD_NAME=infrahub-${{ runner.name }} >> $GITHUB_ENV
- name: "Clear docker environment"
run: docker compose -p $INFRAHUB_BUILD_NAME down -v --remove-orphans --rmi local
- name: "Store start time"
run: echo TEST_START_TIME=$(date +%s)000 >> $GITHUB_ENV
- name: Run 'invoke start'
run: |
unset INFRAHUB_IMAGE_VER
invoke start load_schema
- name: Display server logs
if: always()
run: docker logs "${INFRAHUB_BUILD_NAME}-server-1"
- name: Display task worker 1 logs
if: always()
run: docker logs "${INFRAHUB_BUILD_NAME}-infrahub-git-1"
- name: Display task worker 2 logs
if: always()
run: docker logs "${INFRAHUB_BUILD_NAME}-infrahub-git-2"
- name: Display task manager logs
if: always()
run: docker logs "${INFRAHUB_BUILD_NAME}-task-manager-1"
- name: Display database logs
if: always()
run: docker logs "${INFRAHUB_BUILD_NAME}-database-1"
- name: Display message-queue logs
if: always()
run: docker logs "${INFRAHUB_BUILD_NAME}-message-queue-1"
- name: "Clear docker environment and force vmagent to stop"
if: always()
run: docker compose -p $INFRAHUB_BUILD_NAME down -v --remove-orphans --rmi local