Skip to content

Commit

Permalink
test that docker container can resolve all supported files
Browse files Browse the repository at this point in the history
  • Loading branch information
emilwareus committed Oct 30, 2023
1 parent 087dbc9 commit 5f10b45
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,24 @@ jobs:
- 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 }}

docker-resolve:
name: Docker E2E Resolve
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Pull Image to cache from
run: docker pull debricked/cli:latest-resolution || true

- name: Build Docker image
run: docker build -f build/docker/alpine.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

- name: Test if resolved
run: bash test/checkFilesResolved.sh

golangci:
name: Lint
runs-on: ubuntu-latest
Expand Down
28 changes: 28 additions & 0 deletions test/checkFilesResolved.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
GREEN='\033[0;32m'
RED='\033[0;31m'

# This script checks if all files in the current directory exist
function check_files_exist() {
isOk=true
for file in "$@"; do
if test -f "$file"; then
echo -e "${GREEN}File $file OK${GREEN}"
else
echo -e "${RED}File $file does not exist!${RED}"
isOk=false
fi
done

if [ "$isOk" = false ]; then
exit 1
fi

}

check_files_exist "test/resolve/testdata/npm/yarn.lock" \
"test/resolve/testdata/pip/requirements.txt.pip.debricked.lock" \
"test/resolve/testdata/nuget/packagesconfig/packages.config.nuget.debricked.lock" \
"test/resolve/testdata/nuget/csproj/packages.lock.json" \
"test/resolve/testdata/gradle/gradle.debricked.lock" \
"test/resolve/testdata/gomod/gomod.debricked.lock"

0 comments on commit 5f10b45

Please sign in to comment.