diff --git a/.forgejo/workflows/example-docker-compose-envs.yml b/.forgejo/workflows/example-docker-compose-envs.yml deleted file mode 100644 index 52896e6..0000000 --- a/.forgejo/workflows/example-docker-compose-envs.yml +++ /dev/null @@ -1,66 +0,0 @@ -# SPDX-License-Identifier: MIT -on: - push: - branches: - - 'main' - pull_request: - -jobs: - example-docker-compose: - if: github.repository_owner != 'forgejo-integration' && github.repository_owner != 'forgejo-experimental' && github.repository_owner != 'forgejo-release' - runs-on: lxc-bookworm - 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 "$([ -n "$VERSION_CODENAME" ] && 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 - docker version - docker compose version - - - name: Test Environment Example - run: | - set -x - cd examples/docker-compose - secret=$(openssl rand -hex 20) - sed -i -e "s/{SHARED_SECRET}/$secret/" compose-forgejo-and-runner-with-envs.yml - cli="docker compose --progress quiet -f compose-forgejo-and-runner-with-envs.yml" - # Launch Forgejo & the runner - # - $cli up -d - for delay in $(seq 60) ; do test -f /srv/runner-data/.runner && break ; sleep 30 ; done - test -f /srv/runner-data/.runner - # - # Run the demo workflow - # - cli="$cli -f compose-demo-workflow.yml" - $cli up -d demo-workflow - # - # 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 - $cli logs --tail=20 runner-daemon demo-workflow - sleep 30 - done - grep --quiet "$success" /tmp/out - $cli logs runner-daemon > /tmp/runner.log - grep --quiet 'Start image=code.forgejo.org/oci/node:20-bookworm' /tmp/runner.log - - - name: full docker compose logs - if: always() - run: | - cd examples/docker-compose - docker compose -f compose-forgejo-and-runner.yml -f compose-demo-workflow.yml logs diff --git a/.forgejo/workflows/example-docker-compose.yml b/.forgejo/workflows/example-docker-compose.yml index 6e017db..c628d43 100644 --- a/.forgejo/workflows/example-docker-compose.yml +++ b/.forgejo/workflows/example-docker-compose.yml @@ -25,7 +25,7 @@ jobs: docker version docker compose version - - name: run the example + - name: Test the Base Example run: | set -x cd examples/docker-compose @@ -60,8 +60,42 @@ jobs: $cli logs runner-daemon > /tmp/runner.log grep --quiet 'Start image=code.forgejo.org/oci/node:20-bookworm' /tmp/runner.log + - name: Test the Environment Example + run: | + set -x + cd examples/docker-compose + secret=$(openssl rand -hex 20) + sed -i -e "s/{SHARED_SECRET}/$secret/" compose-forgejo-and-runner-with-envs.yml + cli="docker compose --progress quiet -f compose-forgejo-and-runner-with-envs.yml" + # Launch Forgejo & the runner + # + $cli up -d + for delay in $(seq 60) ; do test -f /srv/runner-data/.runner && break ; sleep 30 ; done + test -f /srv/runner-data/.runner + # + # Run the demo workflow + # + cli="$cli -f compose-demo-workflow.yml" + $cli up -d demo-workflow + # + # 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 + $cli logs --tail=20 runner-daemon demo-workflow + sleep 30 + done + grep --quiet "$success" /tmp/out + $cli logs runner-daemon > /tmp/runner.log + grep --quiet 'Start image=code.forgejo.org/oci/node:20-bookworm' /tmp/runner.log + - name: full docker compose logs if: always() run: | cd examples/docker-compose - docker compose -f compose-forgejo-and-runner.yml -f compose-demo-workflow.yml logs + docker compose -f compose-forgejo-and-runner.yml -f compose-forgejo-and-runner.yml -f compose-demo-workflow.yml logs