Skip to content

Move Copilot setup workflow to workflows directory and fix compile warnings #7

Move Copilot setup workflow to workflows directory and fix compile warnings

Move Copilot setup workflow to workflows directory and fix compile warnings #7

name: "Copilot Setup Steps"
on:
workflow_dispatch:
push:
paths:
- .github/workflows/copilot-setup-steps.yml
pull_request:
paths:
- .github/workflows/copilot-setup-steps.yml
permissions:
contents: read
jobs:
copilot-setup-steps:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Install SBT using apt
run: |
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
echo "deb https://repo.scala-sbt.org/scalasbt/debian /" | sudo tee /etc/apt/sources.list.d/sbt_old.list
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
sudo apt-get update
sudo apt-get install -y sbt
sbt --version
- name: Start Docker Compose Services
run: |
cd "${GITHUB_WORKSPACE:-$(pwd)}"
# Create plugins directory before starting Docker to avoid permission issues
mkdir -p docker/plugins
# Start GitBucket and PostgreSQL containers
docker compose up -d
# Wait for GitBucket to be ready
echo "Waiting for GitBucket to start..."
for i in {1..60}; do
if curl -f http://localhost:8080 > /dev/null 2>&1; then
echo "GitBucket is ready!"
break
fi
echo "Attempt $i/60..."
sleep 5
done
# Explicitly fail if GitBucket is not up after 60 attempts
if ! curl -f http://localhost:8080 > /dev/null 2>&1; then
echo "GitBucket failed to start"
exit 1
fi
- name: Setup Environment Variables
run: |
cd "${GITHUB_WORKSPACE:-$(pwd)}"
# Set GITBUCKET_HOME environment variable
echo "export GITBUCKET_HOME=$(pwd)/docker" >> ~/.bashrc
export GITBUCKET_HOME=$(pwd)/docker
- name: Install E2E Test Dependencies
run: |
cd "${GITHUB_WORKSPACE:-$(pwd)}/e2e"
# Install Node.js dependencies
npm install
# Install Playwright browsers
npx playwright install chromium --with-deps
- name: Build and Install Plugin
run: |
cd "${GITHUB_WORKSPACE:-$(pwd)}"
export GITBUCKET_HOME=$(pwd)/docker
# Build the plugin
sbt assembly
# Copy plugin to GitBucket plugins directory
cp target/scala-2.13/gitbucket-navlink-plugin-*.jar docker/plugins/
# Restart GitBucket to load the plugin
docker compose restart gitbucket
# Wait for GitBucket to restart
echo "Waiting for GitBucket to restart..."
for i in {1..60}; do
if curl -f http://localhost:8080 > /dev/null 2>&1; then
echo "GitBucket restarted successfully!"
break
fi
sleep 5
done
if ! curl -f http://localhost:8080 > /dev/null 2>&1; then
echo "Error: GitBucket failed to restart after 60 attempts." >&2
exit 1
fi