Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 59 additions & 59 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,65 +35,65 @@ jobs:
INTERCOM_APP_ID: ${{ secrets.INTERCOM_APP_ID }}
SEGMENT_TOKEN: ${{ secrets.SEGMENT_TOKEN }}

- name: Install Nginx
run: |
sudo apt-get update
sudo apt-get install -y nginx

- name: Start Docusaurus server
run: |
nohup npx docusaurus serve --port 3000 --no-open &
sleep 5
curl -f http://localhost:3000 > /dev/null

- name: Start Nginx with project config
run: |
cat > default.conf <<EOF
worker_processes auto;
error_log $(pwd)/logs/error.log;
pid $(pwd)/logs/nginx.pid;
events {}
http {
access_log $(pwd)/logs/access.log;
include $(pwd)/nginx.conf;
}
EOF
sed -i 's|https://apify.github.io/apify-docs|http://localhost:3000|g' default.conf
mkdir -p $(pwd)/logs
nginx -c $(pwd)/default.conf
sleep 1

- name: Run header assertions
run: |
set -euo pipefail
function assert_header() {
url=$1
header=$2
expected=$3
shift 3
extra_args=("$@")
actual=$(curl -s -D - -o /dev/null "${extra_args[@]}" "$url" | grep -i "^$header" | tr -d '\r' || true)
echo "→ $url → $actual"
echo "$actual" | grep -q "$expected" || (echo "❌ Expected '$expected' in '$header' for $url" && exit 1)
}

echo "🧪 Checking Nginx responses..."

assert_header "http://localhost:8080/" "Content-Type" "text/html"
assert_header "http://localhost:8080/" "Content-Type" "text/markdown" -H "Accept: text/markdown"
assert_header "http://localhost:8080/platform/proxy/usage" "Content-Type" "text/html"
assert_header "http://localhost:8080/platform/proxy/usage.md" "Content-Type" "text/markdown"
assert_header "http://localhost:8080/platform/proxy/usage" "Content-Type" "text/markdown" -H "Accept: text/markdown"
assert_header "http://localhost:8080/img/docs-og.png" "Content-Type" "image/png"
assert_header "http://localhost:8080/img/javascript-40x40.svg" "Content-Type" "image/svg"
assert_header "http://localhost:8080/llms.txt" "Content-Type" "text/markdown"
assert_header "http://localhost:8080/llms-full.txt" "Content-Type" "text/markdown"

echo "✅ All Nginx header checks passed."

- name: Stop Nginx
if: always()
run: nginx -c $(pwd)/default.conf -s stop
# - name: Install Nginx
# run: |
# sudo apt-get update
# sudo apt-get install -y nginx
#
# - name: Start Docusaurus server
# run: |
# nohup npx docusaurus serve --port 3000 --no-open &
# sleep 5
# curl -f http://localhost:3000 > /dev/null
#
# - name: Start Nginx with project config
# run: |
# cat > default.conf <<EOF
# worker_processes auto;
# error_log $(pwd)/logs/error.log;
# pid $(pwd)/logs/nginx.pid;
# events {}
# http {
# access_log $(pwd)/logs/access.log;
# include $(pwd)/nginx.conf;
# }
# EOF
# sed -i 's|https://apify.github.io/apify-docs|http://localhost:3000|g' default.conf
# mkdir -p $(pwd)/logs
# nginx -c $(pwd)/default.conf
# sleep 1
#
# - name: Run header assertions
# run: |
# set -euo pipefail
# function assert_header() {
# url=$1
# header=$2
# expected=$3
# shift 3
# extra_args=("$@")
# actual=$(curl -s -D - -o /dev/null "${extra_args[@]}" "$url" | grep -i "^$header" | tr -d '\r' || true)
# echo "→ $url → $actual"
# echo "$actual" | grep -q "$expected" || (echo "❌ Expected '$expected' in '$header' for $url" && exit 1)
# }
#
# echo "🧪 Checking Nginx responses..."
#
# assert_header "http://localhost:8080/" "Content-Type" "text/html"
# assert_header "http://localhost:8080/" "Content-Type" "text/markdown" -H "Accept: text/markdown"
# assert_header "http://localhost:8080/platform/proxy/usage" "Content-Type" "text/html"
# assert_header "http://localhost:8080/platform/proxy/usage.md" "Content-Type" "text/markdown"
# assert_header "http://localhost:8080/platform/proxy/usage" "Content-Type" "text/markdown" -H "Accept: text/markdown"
# assert_header "http://localhost:8080/img/docs-og.png" "Content-Type" "image/png"
# assert_header "http://localhost:8080/img/javascript-40x40.svg" "Content-Type" "image/svg"
# assert_header "http://localhost:8080/llms.txt" "Content-Type" "text/markdown"
# assert_header "http://localhost:8080/llms-full.txt" "Content-Type" "text/markdown"
#
# echo "✅ All Nginx header checks passed."
#
# - name: Stop Nginx
# if: always()
# run: nginx -c $(pwd)/default.conf -s stop

lint_content:
name: Lint markdown content
Expand Down