name: Atomic plugin on: workflow_call: inputs: LOWER_NAME: required: true type: string CAPITALIZED_NAME: required: true type: string GO_VERSION: required: true type: string jobs: plugin-test: name: ${{ inputs.CAPITALIZED_NAME }} runs-on: ubuntu-latest env: GO_VERSION: ${{ inputs.GO_VERSION }} steps: - name: Add domain.com host to /etc/hosts run: | sudo echo "127.0.0.1 domain.com" | sudo tee -a /etc/hosts - name: Install Go uses: actions/setup-go@v3 with: go-version: ${{ inputs.GO_VERSION }} - name: Checkout code uses: actions/checkout@v4 - name: golangci-lint uses: golangci/golangci-lint-action@v8 with: version: latest working-directory: plugins/${{ inputs.LOWER_NAME }} args: -c ../../.golangci.yml if: ${{ ! startsWith(inputs.LOWER_NAME, 'traefik') }} - name: Run ${{ inputs.CAPITALIZED_NAME }} tests run: cd plugins/${{ inputs.LOWER_NAME }} && go test -v . - name: Build Souin as ${{ inputs.CAPITALIZED_NAME }} plugin run: make build-and-run-${{ inputs.LOWER_NAME }} env: GH_APP_TOKEN: ${{ secrets.GH_APP_TOKEN }} CURRENT_SHA: ${{ github.event.pull_request.head.sha }} - name: Wait for Souin is really loaded inside ${{ inputs.CAPITALIZED_NAME }} as middleware uses: jakejarvis/wait-action@master with: time: 80s - name: Set ${{ inputs.CAPITALIZED_NAME }} logs configuration result as environment variable run: cd plugins/${{ inputs.LOWER_NAME }} && echo "$(make load-checker)" >> $GITHUB_ENV - name: Check if the configuration is loaded to define if Souin is loaded too uses: nick-invision/assert-action@v1 with: expected: 'Souin configuration is now loaded.' actual: ${{ env.MIDDLEWARE_RESULT }} comparison: contains - name: Run ${{ inputs.CAPITALIZED_NAME }} E2E tests uses: matt-ball/newman-action@master with: collection: "docs/e2e/Souin E2E.postman_collection.json" folder: '["${{ inputs.CAPITALIZED_NAME }}"]' delayRequest: 5000