mirror of https://code.forgejo.org/forgejo/runner
63 lines
2.3 KiB
YAML
63 lines
2.3 KiB
YAML
# SPDX-License-Identifier: MIT
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
pull_request:
|
|
|
|
jobs:
|
|
example-docker-compose:
|
|
runs-on: self-hosted
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install docker
|
|
run: |
|
|
apt-get update -qq
|
|
export DEBIAN_FRONTEND=noninteractive
|
|
apt-get install -qq -y ca-certificates curl gnupg
|
|
install -m 0755 -d /etc/apt/keyrings
|
|
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
|
echo "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/debian "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
|
apt-get update -qq
|
|
apt-get install -qq -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin=2.20.2-1~debian.11~bullseye
|
|
docker version
|
|
#
|
|
# docker compose is prone to non backward compatible changes, pin it
|
|
#
|
|
apt-get install -qq -y docker-compose-plugin=2.20.2-1~debian.11~bullseye
|
|
docker compose version
|
|
|
|
- name: run the example
|
|
run: |
|
|
set -x
|
|
cd examples/docker-compose
|
|
secret=$(openssl rand -hex 20)
|
|
sed -i -e "s/{SHARED_SECRET}/$secret/" compose-forgejo-and-runner.yml
|
|
cli="docker compose --progress quiet -f compose-forgejo-and-runner.yml -f compose-demo-workflow.yml"
|
|
#
|
|
# Launch
|
|
#
|
|
$cli up -d
|
|
#
|
|
# Wait for the demo workflow to complete
|
|
#
|
|
success='DEMO WORKFLOW SUCCESS'
|
|
failure='DEMO WORKFLOW FAILURE'
|
|
for delay in $(seq 60) ; do
|
|
$cli logs demo-workflow > /tmp/out
|
|
grep --quiet "$success" /tmp/out && break
|
|
grep --quiet "$failure" /tmp/out && break
|
|
$cli ps --all
|
|
tail /tmp/out
|
|
sleep 10
|
|
done
|
|
tail /tmp/out
|
|
grep --quiet "$success" /tmp/out
|
|
|
|
- name: docker compose logs
|
|
if: always()
|
|
run: |
|
|
cd examples/docker-compose
|
|
docker compose -f compose-forgejo-and-runner.yml -f compose-demo-workflow.yml logs
|