Skip to content

Commit

Permalink
verify executable on CI build
Browse files Browse the repository at this point in the history
  • Loading branch information
danthe1st committed Feb 28, 2024
1 parent f8fa2d0 commit 040e082
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
26 changes: 26 additions & 0 deletions .github/scripts/verifyExecutable.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -e

./certs.sh

./target/https-intercept > intercept.log 2>&1 &
sleep 1
interceptPID="$!"

curl_result="$(curl --connect-to example.com:1337:127.0.0.1 https://example.com:1337 --cacert root.pem -i)"

kill "$interceptPID"

statusCode="$(echo "$curl_result" | head -n 1 | cut -d' ' -f2)"

# assert successful response
if [ "$statusCode" -ne 200 ]; then
echo "status code does not match!"
exit 1
fi

# assert text Example Domain in response
echo "$curl_result" | grep "Example Domain"

cat intercept.log
rm intercept.log
5 changes: 3 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ jobs:
with:
distribution: 'graalvm'
java-version: '21'
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
- name: Build image
run: mvn -Pnative package
- uses: actions/upload-artifact@v4
with:
path: target/https-intercept
if-no-files-found: error
if-no-files-found: error
- name: verify executable
run: ./.github/scripts/verifyExecutable.sh

0 comments on commit 040e082

Please sign in to comment.