1
0
Fork 0
docker-letsencrypt-nginx-pr.../.github/workflows/test.yml

174 lines
4.4 KiB
YAML

name: Tests
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- "docs/**"
- "*.md"
pull_request:
paths-ignore:
- "docs/**"
- "*.md"
env:
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@v3
- 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@v3
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@v3
with:
repository: docker-library/official-images
path: official-images
- name: Download Builded Image
uses: actions/download-artifact@v3
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,
]
setup: [2containers, 3containers]
acme-ca: [pebble]
pebble-config: [pebble-config.json]
include:
- test-name: acme_eab
setup: 2containers
acme-ca: pebble
pebble-config: pebble-config-eab.json
- test-name: acme_eab
setup: 3containers
acme-ca: pebble
pebble-config: pebble-config-eab.json
- test-name: ocsp_must_staple
setup: 2containers
acme-ca: boulder
- test-name: ocsp_must_staple
setup: 3containers
acme-ca: boulder
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
# 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
if: ${{ matrix.acme-ca == 'pebble' }}
env:
PEBBLE_CONFIG: ${{ matrix.pebble-config }}
run: test/setup/pebble/setup-pebble.sh
- name: Setup Boulder
if: ${{ matrix.acme-ca == 'boulder' }}
run: test/setup/setup-boulder.sh
- name: Setup nginx-proxy
env:
SETUP: ${{ matrix.setup }}
ACME_CA: ${{ matrix.acme-ca }}
run: test/setup/setup-nginx-proxy.sh
# ADD BUILT IMAGE
- name: Download Built Image
uses: actions/download-artifact@v3
with:
name: companion.tar
- name: Import Built Image
run: docker load < companion.tar
# TEST
- name: Integration Testing
env:
SETUP: ${{ matrix.setup }}
ACME_CA: ${{ matrix.acme-ca }}
PEBBLE_CONFIG: ${{ matrix.pebble-config }}
run: test/run.sh -t ${{ matrix.test-name }} "$IMAGE"
- name: Display containers logs
if: ${{ failure() }}
env:
SETUP: ${{ matrix.setup }}
ACME_CA: ${{ matrix.acme-ca }}
run: test/github_actions/containers-logs.sh