generated from ShahradR/git-template
-
Notifications
You must be signed in to change notification settings - Fork 2
148 lines (138 loc) · 4.9 KB
/
main.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
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: CI workflow
on: [push, pull_request, workflow_dispatch]
permissions:
checks: write
issues: write
contents: write
jobs:
pre-commit:
name: Run pre-commit checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v2.0.3
tests:
name: Jest tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install nektos/act
run: curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash -s -- -b /usr/local/bin/ v0.2.20
- uses: actions/setup-node@v3
with:
node-version: 14
- run: npm install
- name: Run Jest tests
run: npm test
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Upload coverage information
uses: actions/upload-artifact@v3
with:
name: coverage
path: coverage/
sonarcloud:
runs-on: ubuntu-latest
name: SonarCloud
needs: [tests]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download coverage information
uses: actions/download-artifact@v3
with:
name: coverage
path: coverage/
- name: SonarCloud Scan
uses: sonarsource/sonarcloud-github-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
e2e-default:
name: End-to-end tests - default
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
id: aws-credentials
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ca-central-1
- name: Invoke "taskcat test run"
uses: ./
with:
commands: test run --lint-disable --project-root ./e2e/resources/default
e2e-update:
name: End-to-end tests - update taskcat
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ca-central-1
- name: Invoke "taskcat test run"
uses: ./
with:
commands: test run --lint-disable --project-root ./e2e/resources/default
update_taskcat: true
e2e-lint-update:
name: End-to-end tests - update taskcat
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ca-central-1
- name: Invoke "taskcat test run"
uses: ./
with:
commands: test run --lint-disable --project-root ./e2e/resources/default
update_taskcat: true
update_cfn_lint: true
vale:
name: Run Vale
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: errata-ai/vale-action@v2.1.1
with:
debug: true
files: '[ "README.md", "vale/README.md", "src/", "e2e/", "docs/", "__tests__/" ]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
release:
name: Create release
runs-on: ubuntu-latest
needs: [pre-commit, tests, e2e-default, e2e-update, e2e-lint-update, vale]
if: ${{ needs.pre-commit.result == 'success' && needs.tests.result == 'success' && needs.e2e-default.result == 'success' && needs.e2e-update.result == 'success' && needs.e2e-lint-update.result == 'success' && needs.e2e-v1-default.result == 'success' && needs.e2e-v1-update.result == 'success' && needs.e2e-v1-lint-update.result == 'success' && needs.vale.result == 'success' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12
- name: Release
uses: cycjimmy/semantic-release-action@v2
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update v1 branch reference
if: steps.semantic.outputs.new_release_published == 'true'
run: "git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:refs/heads/v${{steps.semantic.outputs.new_release_major_version}}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}