| 
 | 1 | +name: Tests  | 
 | 2 | + | 
 | 3 | +on:  | 
 | 4 | +  push:  | 
 | 5 | +    paths-ignore:  | 
 | 6 | +    - 'docs/**'  | 
 | 7 | +    - '*.md'  | 
 | 8 | +  pull_request:  | 
 | 9 | +    paths-ignore:  | 
 | 10 | +    - 'docs/**'  | 
 | 11 | +    - '*.md'  | 
 | 12 | + | 
 | 13 | + | 
 | 14 | +env:  | 
 | 15 | +  DOCKER_GEN_CONTAINER_NAME: nginx-proxy-gen  | 
 | 16 | +  IMAGE: jrcs/letsencrypt-nginx-proxy-companion  | 
 | 17 | +  NGINX_CONTAINER_NAME: nginx-proxy  | 
 | 18 | +  TEST_DOMAINS: le1.wtf,le2.wtf,le3.wtf  | 
 | 19 | + | 
 | 20 | +jobs:  | 
 | 21 | +  companion-build:  | 
 | 22 | +    runs-on: ubuntu-latest  | 
 | 23 | + | 
 | 24 | +    steps:  | 
 | 25 | +      - name: Checkout Code  | 
 | 26 | +        uses: actions/checkout@v2  | 
 | 27 | +      - name: Patch the Dockerfile's docker-gen  | 
 | 28 | +        run: |  | 
 | 29 | +          sed -i 's#DOCKER_GEN_VERSION=.*$#DOCKER_GEN_VERSION=fix-current-container-id#g' Dockerfile  | 
 | 30 | +          sed -i 's#go get github.com/jwilder/docker-gen#go get github.com/buchdag/docker-gen \&\& mv /go/src/github.com/buchdag /go/src/github.com/jwilder#g' Dockerfile  | 
 | 31 | +      - name: Build Image  | 
 | 32 | +        run: docker build -t "$IMAGE" .  | 
 | 33 | +      - name: Inspect Image  | 
 | 34 | +        run: docker inspect "$IMAGE"  | 
 | 35 | +      - name: Get acme.sh Version  | 
 | 36 | +        run: docker run --rm "$IMAGE" acme.sh --version  | 
 | 37 | +      - name: List Docker Images  | 
 | 38 | +        run: docker images  | 
 | 39 | +      - name: Export Image Artifact  | 
 | 40 | +        run: docker save $IMAGE > companion.tar  | 
 | 41 | +      - name: Upload Image Artifact  | 
 | 42 | +        uses: actions/upload-artifact@v2  | 
 | 43 | +        with:  | 
 | 44 | +          name: companion.tar  | 
 | 45 | +          path: companion.tar  | 
 | 46 | + | 
 | 47 | +  nginx-proxy-build:  | 
 | 48 | +    runs-on: ubuntu-latest  | 
 | 49 | + | 
 | 50 | +    steps:  | 
 | 51 | +      - name: Checkout Code  | 
 | 52 | +        uses: actions/checkout@v2  | 
 | 53 | +      - name: Build patched nginx-proxy Image  | 
 | 54 | +        run: docker build -t "jwilder/nginx-proxy:latest" ./test/setup/nginx-proxy  | 
 | 55 | +      - name: Build patched docker-gen Image  | 
 | 56 | +        run: docker build -t "jwilder/docker-gen:latest" ./test/setup/docker-gen  | 
 | 57 | +      - name: List Docker Images  | 
 | 58 | +        run: docker images  | 
 | 59 | +      - name: Export Images Artifacts  | 
 | 60 | +        run: |  | 
 | 61 | +          docker save jwilder/nginx-proxy:latest > nginx-proxy.tar  | 
 | 62 | +          docker save jwilder/docker-gen:latest > docker-gen.tar  | 
 | 63 | +      - name: Upload nginx-proxy Image Artifact  | 
 | 64 | +        uses: actions/upload-artifact@v2  | 
 | 65 | +        with:  | 
 | 66 | +          name: nginx-proxy.tar  | 
 | 67 | +          path: nginx-proxy.tar  | 
 | 68 | +      - name: Upload docker-gen Image Artifact  | 
 | 69 | +        uses: actions/upload-artifact@v2  | 
 | 70 | +        with:  | 
 | 71 | +          name: docker-gen.tar  | 
 | 72 | +          path: docker-gen.tar  | 
 | 73 | + | 
 | 74 | +  docker-specs-testing:  | 
 | 75 | +    needs: companion-build  | 
 | 76 | +    runs-on: ubuntu-latest  | 
 | 77 | + | 
 | 78 | +    steps:  | 
 | 79 | +      - name: Checkout Code  | 
 | 80 | +        uses: actions/checkout@v2  | 
 | 81 | +        with:  | 
 | 82 | +          repository: docker-library/official-images  | 
 | 83 | +          path: official-images  | 
 | 84 | +      - name: Download Builded Image  | 
 | 85 | +        uses: actions/download-artifact@v2  | 
 | 86 | +        with:  | 
 | 87 | +          name: companion.tar  | 
 | 88 | +      - name: Import Builded Image  | 
 | 89 | +        run: docker load < companion.tar  | 
 | 90 | +      - name: Docker Specifications Testing  | 
 | 91 | +        run: official-images/test/run.sh "$IMAGE"  | 
 | 92 | +      - if: ${{ failure() }}  | 
 | 93 | +        run: test/github_actions/containers-logs.sh  | 
 | 94 | + | 
 | 95 | +  integration-testing:  | 
 | 96 | +    needs:   | 
 | 97 | +      - companion-build  | 
 | 98 | +      - nginx-proxy-build  | 
 | 99 | +    strategy:  | 
 | 100 | +      fail-fast: false  | 
 | 101 | +      matrix:  | 
 | 102 | +        setup: [2containers, 3containers]  | 
 | 103 | +        test-name:  | 
 | 104 | +          [  | 
 | 105 | +            docker_api,  | 
 | 106 | +            location_config,  | 
 | 107 | +            default_cert,  | 
 | 108 | +            certs_single,  | 
 | 109 | +            certs_san,  | 
 | 110 | +            certs_single_domain,  | 
 | 111 | +            certs_standalone,  | 
 | 112 | +            force_renew,  | 
 | 113 | +            acme_accounts,  | 
 | 114 | +            private_keys,  | 
 | 115 | +            container_restart,  | 
 | 116 | +            permissions_default,  | 
 | 117 | +            permissions_custom,  | 
 | 118 | +            symlinks,  | 
 | 119 | +          ]  | 
 | 120 | +    runs-on: ubuntu-latest  | 
 | 121 | + | 
 | 122 | +    steps:  | 
 | 123 | +      - name: Checkout Code  | 
 | 124 | +        uses: actions/checkout@v2  | 
 | 125 | +      # PREPARE RUNNER ENV  | 
 | 126 | +      - name: Add Test Domains in /etc/hosts  | 
 | 127 | +        run: |  | 
 | 128 | +          test_domains=$(echo $TEST_DOMAINS | tr "," "\n")  | 
 | 129 | +          for domain in $test_domains  | 
 | 130 | +          do  | 
 | 131 | +              echo "127.0.0.1 $domain" | sudo tee -a /etc/hosts  | 
 | 132 | +          done  | 
 | 133 | +      - name: Setup Boulder  | 
 | 134 | +        run: test/setup/setup-boulder.sh  | 
 | 135 | +      - name: Download nginx-proxy Patched Image  | 
 | 136 | +        uses: actions/download-artifact@v2  | 
 | 137 | +        with:  | 
 | 138 | +          name: nginx-proxy.tar  | 
 | 139 | +      - name: Download docker-gen Patched Image  | 
 | 140 | +        uses: actions/download-artifact@v2  | 
 | 141 | +        with:  | 
 | 142 | +          name: docker-gen.tar  | 
 | 143 | +      - name: Import nginx-proxy patched Images  | 
 | 144 | +        run: |  | 
 | 145 | +          docker load < nginx-proxy.tar  | 
 | 146 | +          docker load < docker-gen.tar  | 
 | 147 | +      - name: Setup NGINX Proxy  | 
 | 148 | +        env:  | 
 | 149 | +          SETUP: ${{ matrix.setup }}  | 
 | 150 | +        run: test/setup/setup-nginx-proxy.sh  | 
 | 151 | +      # ADD BUILDED IMAGE  | 
 | 152 | +      - name: Download Builded Image  | 
 | 153 | +        uses: actions/download-artifact@v2  | 
 | 154 | +        with:  | 
 | 155 | +          name: companion.tar  | 
 | 156 | +      - name: Import Builded Image  | 
 | 157 | +        run: docker load < companion.tar  | 
 | 158 | +      # TEST  | 
 | 159 | +      - name: Integration Testing  | 
 | 160 | +        env:  | 
 | 161 | +          SETUP: ${{ matrix.setup }}  | 
 | 162 | +        run: test/run.sh -t ${{ matrix.test-name }} "$IMAGE"  | 
 | 163 | +      - if: ${{ failure() }}  | 
 | 164 | +        run: test/github_actions/containers-logs.sh  | 
0 commit comments