-
Notifications
You must be signed in to change notification settings - Fork 103
211 lines (202 loc) · 7.25 KB
/
test.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
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: CI
on: [push]
jobs:
test:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
# https://github.com/mvdan/github-actions-golang#how-do-i-set-up-caching-between-builds
- uses: actions/cache@v2
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
%LocalAppData%\go-build
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: "1.22.1"
- name: Build All Platforms
run: make ci-cli-all-platforms
# Upload the built binaries to use in later tests on each platform
- uses: actions/upload-artifact@v3
with:
name: go-binaries-linux
path: ./bin/linux/
- uses: actions/upload-artifact@v3
with:
name: go-binaries-macos
path: ./bin/macos/
- uses: actions/upload-artifact@v3
with:
name: go-binaries-windows
path: ./bin/windows/
- name: Lint
run: go vet ./...
- name: Test
run: go test ./...
golangci-lint:
name: Go Lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.22.1
- uses: actions/checkout@v2
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
timeout-minutes: 5
with:
version: latest
args: --timeout 5m
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run ShellCheck
uses: ludeeus/action-shellcheck@94e0aab03ca135d11a35e5bfc14e6746dc56e7e9
# linux-installs:
# needs: test
# name: Smoke Test (Linux)
# env:
# TEST_ACCESS_KEY_ID: 1234578910abcdefghij
# TEST_ACCESS_KEY: 1234578910abcdefghijklmnopqrstuvwxyz1234
# TEST_REGION: ap-southeast-2
# runs-on: ubuntu-latest
# steps:
# - uses: actions/download-artifact@v3
# with:
# name: go-binaries-linux
# - name: move binaries
# run: |
# chmod +x ./dassumego && mv ./dassumego /usr/local/bin/
# chmod +x ./dgranted && mv ./dgranted /usr/local/bin/
# chmod +x ./tbrowser && mv ./tbrowser /usr/local/bin/
# chmod +x ./tcreds && mv ./tcreds /usr/local/bin/
# chmod +x ./dassume && mv ./dassume /usr/local/bin/
# chmod +x ./dassume.fish && mv ./dassume.fish /usr/local/bin/
# - name: set default browser
# # configures granted to use the test browser binary
# run: dgranted browser set -b chrome -p /usr/local/bin/tbrowser
# - name: setup aws config files
# run: mkdir ~/.aws; touch ~/.aws/config; touch ~/.aws/credentials;
# - name: setup fake aws profile
# run: |
# cat << EOF >> ~/.aws/config
# [profile test]
# region = ${TEST_REGION}
# EOF
# - name: setup fake aws profile credentials
# run: |
# cat << EOF >> ~/.aws/credentials
# [test]
# aws_access_key_id=${TEST_ACCESS_KEY_ID}
# aws_secret_access_key=${TEST_ACCESS_KEY}
# EOF
# - name: bash
# run: dassume -auto-configure-shell
# # it seems not possible to reload the bash_profile in github actions here, so we will have to skip this test
# # the below does not work
# # - name: assume bash
# # run: |
# # source ~/.bash_profile
# # bash dassume test
# # ./bin/tcreds -aws-access-key-id $TEST_ACCESS_KEY_ID -aws-secret-key $TEST_ACCESS_KEY -aws-region $TEST_REGION
# # shell: bash
# - name: Install zsh
# run: sudo apt-get update; sudo apt-get install zsh
# - name: zsh
# run: dassume -auto-configure-shell
# shell: zsh {0}
# - name: assume zsh
# run: |
# dassume test
# tcreds -aws-access-key-id $TEST_ACCESS_KEY_ID -aws-secret-key $TEST_ACCESS_KEY -aws-region $TEST_REGION
# shell: zsh {0}
# - name: install fish
# run: sudo apt-add-repository ppa:fish-shell/release-3; sudo apt update; sudo apt install fish
# - name: fish
# run: SHELL=fish dassume -auto-configure-shell
# shell: fish {0}
# - name: assume zsh
# run: |
# SHELL=fish dassume test
# tcreds -aws-access-key-id $TEST_ACCESS_KEY_ID -aws-secret-key $TEST_ACCESS_KEY -aws-region $TEST_REGION
# shell: fish {0}
# osx-installs:
# needs: test
# name: Smoke Test (MacOS)
# runs-on: macos-11
# env:
# TEST_ACCESS_KEY_ID: 1234578910abcdefghij
# TEST_ACCESS_KEY: 1234578910abcdefghijklmnopqrstuvwxyz1234
# TEST_REGION: ap-southeast-2
# steps:
# - uses: actions/download-artifact@v3
# with:
# name: go-binaries-macos
# - name: move binaries
# run: |
# chmod +x ./dassumego && mv ./dassumego /usr/local/bin/
# chmod +x ./dgranted && mv ./dgranted /usr/local/bin/
# chmod +x ./tbrowser && mv ./tbrowser /usr/local/bin/
# chmod +x ./tcreds && mv ./tcreds /usr/local/bin/
# chmod +x ./dassume && mv ./dassume /usr/local/bin/
# chmod +x ./dassume.fish && mv ./dassume.fish /usr/local/bin/
# - name: set default browser
# # configures granted to use the test browser binary
# run: dgranted browser set -b chrome -p /usr/local/bin/tbrowser
# - name: setup aws config files
# run: mkdir ~/.aws; touch ~/.aws/config; touch ~/.aws/credentials;
# - name: setup fake aws profile
# run: |
# cat << EOF >> ~/.aws/config
# [profile test]
# region = ${TEST_REGION}
# EOF
# - name: setup fake aws profile credentials
# run: |
# cat << EOF >> ~/.aws/credentials
# [test]
# aws_access_key_id=${TEST_ACCESS_KEY_ID}
# aws_secret_access_key=${TEST_ACCESS_KEY}
# EOF
# - name: bash
# run: dassume -auto-configure-shell
# shell: bash {0}
# # bash doesn't work in github actions
# # - name: assume bash
# # run: |
# # dassume test
# # ./bin/tcreds -aws-access-key-id $TEST_ACCESS_KEY_ID -aws-secret-key $TEST_ACCESS_KEY -aws-region $TEST_REGION
# # shell: bash -l {0}
# - name: zsh
# run: dassume -auto-configure-shell
# shell: zsh {0}
# - name: assume zsh
# run: |
# dassume test
# /usr/local/bin/tcreds -aws-access-key-id $TEST_ACCESS_KEY_ID -aws-secret-key $TEST_ACCESS_KEY -aws-region $TEST_REGION
# shell: zsh {0}
# - name: install fish
# run: brew install fish
# - name: fish
# run: dassume -auto-configure-shell
# shell: fish {0}
# - name: assume fish
# run: |
# dassume test
# tcreds -aws-access-key-id $TEST_ACCESS_KEY_ID -aws-secret-key $TEST_ACCESS_KEY -aws-region $TEST_REGION
# shell: fish {0}