-
Notifications
You must be signed in to change notification settings - Fork 6
143 lines (120 loc) · 4.69 KB
/
main.yml
File metadata and controls
143 lines (120 loc) · 4.69 KB
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
# Run test file with command:
# act pull_request -e testdata/act/pull-request.json
name: Test and Generate Docs
on: pull_request
jobs:
go-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Set up Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f
with:
node-version: '18.x'
- name: Install datadog-ci
run: npm install -g @datadog/datadog-ci
- name: Set up Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548
with:
python-version: '3.x'
- name: Set up Go
uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00
with:
go-version-file: go.mod
- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Run pre-commit hooks
run: pre-commit run --all-files
- name: Install dependencies
run: go mod tidy
- name: Install gotestsum
run: go install gotest.tools/gotestsum@latest
- name: Run tests with gotestsum
run: |
mkdir -p ${{ github.workspace }}/artifacts
mkdir -p ${{ github.workspace }}/reports
GONFALON_MODE=test \
gotestsum --packages="./..." \
--junitfile ${{ github.workspace }}/reports/go-test_go_tests.xml \
--jsonfile ${{ github.workspace }}/artifacts/go-test_go_tests.json \
--rerun-fails=2 \
--rerun-fails-max-failures=10 \
--rerun-fails-report ${{ github.workspace }}/artifacts/rerun_tests_go_tests.txt \
-- -tags=launchdarkly_easyjson -p=1
- name: Publish JUnit Tests
uses: ./.github/actions/publish-junit
env:
DD_API_KEY: ${{ secrets.DATADOG_API_KEY }}
with:
files: ${{ github.workspace }}/reports/go-test_go_tests.xml
name: find-code-references-in-pull-request
datadog: 'true'
github: 'true'
e2e-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Find LaunchDarkly feature flags in diff
uses: ./ # Uses an action in the root directory
id: find-flags
with:
project-key: demo-dan-042021-2
environment-key: development
access-token: ${{ secrets.LD_ACCESS_TOKEN_WRITER }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
base-uri: https://app.launchdarkly.com
max-flags: 200
create-flag-links: true
- name: Find flags summary
run: |
echo "flags addded or modified ${{ steps.find-flags.outputs.modified-flags-count }}"
echo "flags removed ${{ steps.find-flags.outputs.removed-flags-count }}"
- name: Added or modified flags
if: steps.find-flags.outputs.any-modified == 'true'
run: |
for flag in ${{ steps.find-flags.outputs.modified-flags }}; do
echo "$flag was added or modified"
done
- name: Removed flags
if: steps.find-flags.outputs.any-removed == 'true'
run: |
for flag in ${{ steps.find-flags.outputs.removed-flags }}; do
echo "$flag was removed"
done
- name: Add label
if: ${{ steps.find-flags.outputs.any-changed == 'true' && github.actor != 'dependabot[bot]' }}
run: gh pr edit $PR_NUMBER --add-label ld-flags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
- name: Remove label
if: ${{ steps.find-flags.outputs.any-changed == 'false' && github.actor != 'dependabot[bot]' }}
run: gh pr edit $PR_NUMBER --remove-label ld-flags
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
generate-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
- name: Set up Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548
with:
python-version: '3.x'
- name: Install pre-commit
run: |
python -m pip install --upgrade pip
pip install pre-commit
- name: Set up Node.js
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f
with:
node-version: '18.8.0'
- name: Install action-docs
run: npm install action-docs
- name: Run pre-commit for GitHub Actions Docs
run: pre-commit run -a github-action-docs