-
Notifications
You must be signed in to change notification settings - Fork 14
175 lines (143 loc) · 5.04 KB
/
test.yml
File metadata and controls
175 lines (143 loc) · 5.04 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
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
name: Test
on:
push:
branches:
- main
pull_request:
jobs:
cli:
name: CLI
strategy:
matrix:
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ]
runs-on: ${{ matrix.os }}
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf input
git config --global core.eol lf
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.0'
- name: Install Bower
run: |
npm install --global bower
bower -v
- name: Install PHP & Composer (macOS)
if: runner.os == 'macOS'
shell: bash
run: |
set -e
echo "Installing PHP and Composer on macOS"
# Use the system PHP if available, otherwise install via Homebrew
if ! command -v php >/dev/null 2>&1; then
brew update
brew install php
fi
php -v
EXPECTED_SIGNATURE="$(curl -s https://composer.github.io/installer.sig)"
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then
>&2 echo 'ERROR: Invalid composer installer signature'
rm composer-setup.php
exit 1
fi
php composer-setup.php --install-dir=/usr/local/bin --filename=composer
rm composer-setup.php
composer --version
- name: Pull Supported Formats
run: |
cd cmd/debricked
go generate -v -x
- name: Build
run: go build -v ./...
- name: Test
run: bash scripts/test_cli.sh
env:
TEST_COVERAGE_THRESHOLD: 90
- name: Upload coverage report
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-latest' }}
with:
name: coverage.html
path: coverage.html
retention-days: 2
- name: E2E - resolve
if: ${{ matrix.os == 'ubuntu-latest' }}
run: bash scripts/test_e2e.sh resolver
- name: E2E - scan
run: go run cmd/debricked/main.go scan internal/file/testdata/misc -e requirements.txt -t ${{ secrets.DEBRICKED_TOKEN }} -r debricked/cli-test -c E2E-test-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }}
reach-analysis-e2e:
name: Reachability Analysis E2E
strategy:
matrix:
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
java: [11, 17, 20]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.23.0'
- name: Pull Supported Formats
run: |
cd cmd/debricked
go generate -v -x
- name: Build
run: go build -v ./...
- name: Set up Java ${{matrix.java}}
uses: actions/setup-java@v4
with:
java-version: ${{matrix.java}}
distribution: 'temurin'
- name: Install Debricked CLI
run: |
go install -ldflags "-X main.version=${{ secrets.DEBRICKED_VERSION }}" ./cmd/debricked
- name: Callgraph E2E
run: ./scripts/test_e2e_callgraph_java_version.sh ${{matrix.java}}
docker-resolve:
name: Docker E2E Resolve
runs-on: ubuntu-latest
strategy:
matrix:
docker-os: ['alpine', 'debian']
steps:
- uses: actions/checkout@v4
# Pull from debian and re-tag to match cache
- name: Pull Image; Debian
if: ${{ matrix.docker-os == 'debian' }}
run: docker pull debricked/cli:latest-resolution-debian || true
- name: Pull Image; Alpine
if: ${{ matrix.docker-os == 'alpine' }}
run: docker pull debricked/cli:latest-resolution || true
- name: Build Docker image
if: ${{ matrix.docker-os == 'debian' }}
run: docker build -f build/docker/${{ matrix.docker-os }}.Dockerfile -t debricked/cli:resolution-test --cache-from debricked/cli:latest-resolution-debian --target resolution .
- name: Build Docker image
if: ${{ matrix.docker-os == 'alpine' }}
run: docker build -f build/docker/${{ matrix.docker-os }}.Dockerfile -t debricked/cli:resolution-test --cache-from debricked/cli:latest-resolution --target resolution .
- name: Resolve with Docker
run: docker run -v $(pwd):/root debricked/cli:resolution-test debricked resolve test/resolve
- name: Test if resolved
run: bash test/checkFilesResolved.sh
golangci:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.23.0'
- name: Pull Supported Formats
run: |
cd cmd/debricked
go generate -v -x
- name: golangci-lint
uses: golangci/golangci-lint-action@v4
with:
version: v1.62