mirror of
https://github.com/nginx-proxy/docker-letsencrypt-nginx-proxy-companion
synced 2025-02-22 13:51:09 +01:00
159 lines
3.9 KiB
YAML
159 lines
3.9 KiB
YAML
name: Tests
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
paths-ignore:
|
|
- "docs/**"
|
|
- "*.md"
|
|
pull_request:
|
|
paths-ignore:
|
|
- "docs/**"
|
|
- "*.md"
|
|
|
|
env:
|
|
ACME_CA: pebble
|
|
DOCKER_GEN_CONTAINER_NAME: nginx-proxy-gen
|
|
IMAGE: nginxproxy/acme-companion
|
|
NGINX_CONTAINER_NAME: nginx-proxy
|
|
TEST_DOMAINS: le1.wtf,le2.wtf,le3.wtf
|
|
|
|
jobs:
|
|
companion-build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Build Image
|
|
run: docker build -t "$IMAGE" .
|
|
|
|
- name: Inspect Image
|
|
run: docker inspect "$IMAGE"
|
|
|
|
- name: Get acme.sh Version
|
|
run: docker run --rm "$IMAGE" acme.sh --version
|
|
|
|
- name: List Docker Images
|
|
run: docker images
|
|
|
|
- name: Export Image Artifact
|
|
run: docker save $IMAGE > companion.tar
|
|
|
|
- name: Upload Image Artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: companion.tar
|
|
path: companion.tar
|
|
|
|
docker-specs-tests:
|
|
needs: companion-build
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Docker official images tests
|
|
uses: actions/checkout@v4
|
|
with:
|
|
repository: docker-library/official-images
|
|
path: official-images
|
|
|
|
- name: Download Builded Image
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: companion.tar
|
|
|
|
- name: Import Builded Image
|
|
run: docker load < companion.tar
|
|
|
|
- name: Docker Specifications Testing
|
|
run: official-images/test/run.sh "$IMAGE"
|
|
|
|
- name: Display containers logs
|
|
if: ${{ failure() }}
|
|
run: test/github_actions/containers-logs.sh
|
|
|
|
integration-tests:
|
|
needs:
|
|
- companion-build
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
test-name:
|
|
[
|
|
docker_api,
|
|
docker_api_legacy,
|
|
location_config,
|
|
certs_single,
|
|
certs_san,
|
|
certs_single_domain,
|
|
certs_standalone,
|
|
force_renew,
|
|
acme_accounts,
|
|
private_keys,
|
|
container_restart,
|
|
permissions_default,
|
|
permissions_custom,
|
|
symlinks,
|
|
acme_hooks,
|
|
ocsp_must_staple,
|
|
]
|
|
setup: [2containers, 3containers]
|
|
pebble-config: [pebble-config.json]
|
|
include:
|
|
- test-name: acme_eab
|
|
setup: 2containers
|
|
pebble-config: pebble-config-eab.json
|
|
- test-name: acme_eab
|
|
setup: 3containers
|
|
pebble-config: pebble-config-eab.json
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
# PREPARE RUNNER ENV
|
|
- name: Add Test Domains in /etc/hosts
|
|
run: |
|
|
IFS=',' read -r -a test_domains <<< "$TEST_DOMAINS"
|
|
test_domains+=(pebble pebble-challtestsrv)
|
|
for domain in "${test_domains[@]}"
|
|
do
|
|
echo "127.0.0.1 $domain" | sudo tee -a /etc/hosts
|
|
done
|
|
|
|
- name: Setup Pebble
|
|
env:
|
|
PEBBLE_CONFIG: ${{ matrix.pebble-config }}
|
|
run: test/setup/pebble/setup-pebble.sh
|
|
|
|
- name: Setup nginx-proxy
|
|
env:
|
|
SETUP: ${{ matrix.setup }}
|
|
run: test/setup/setup-nginx-proxy.sh
|
|
|
|
# ADD BUILT IMAGE
|
|
- name: Download Built Image
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: companion.tar
|
|
|
|
- name: Import Built Image
|
|
run: docker load < companion.tar
|
|
|
|
# TEST
|
|
- name: Integration Testing
|
|
env:
|
|
SETUP: ${{ matrix.setup }}
|
|
PEBBLE_CONFIG: ${{ matrix.pebble-config }}
|
|
run: test/run.sh -t ${{ matrix.test-name }} "$IMAGE"
|
|
|
|
- name: Display containers logs
|
|
if: ${{ failure() }}
|
|
env:
|
|
SETUP: ${{ matrix.setup }}
|
|
run: test/github_actions/containers-logs.sh
|