diff --git a/.github/workflows/_cypress.yml b/.github/workflows/_cypress.yml index 1b0e7da..cd7ff50 100644 --- a/.github/workflows/_cypress.yml +++ b/.github/workflows/_cypress.yml @@ -3,6 +3,12 @@ name: End-to-end Tests on: workflow_call: inputs: + image: + type: string + required: true + application-image: + type: string + required: true pattern: type: string required: true @@ -15,7 +21,7 @@ jobs: name: "End-to-end - ${{ inputs.name }} (${{ matrix.browser }})" runs-on: ubuntu-20.04 container: - image: gmmcal/gmmcal:cypress + image: ${{ inputs.image }} env: CYPRESS_BASE_URL: http://web:3000 CYPRESS_SPEC_PATTERN: ${{ inputs.pattern }} @@ -36,7 +42,7 @@ jobs: options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 web: - image: gmmcal/gmmcal:test + image: ${{ inputs.application-image }} env: DATABASE_URL: postgres://postgres:postgres@postgres:5432/gmmcalcombr_test ON_CYPRESS: true diff --git a/.github/workflows/_docker.yml b/.github/workflows/_docker.yml index bf0b35b..de8838a 100644 --- a/.github/workflows/_docker.yml +++ b/.github/workflows/_docker.yml @@ -6,10 +6,9 @@ on: name: type: string required: true - tag-name: + image: type: string - required: false - default: "gmmcal/gmmcal:test" + required: true target: type: string required: false @@ -48,6 +47,6 @@ jobs: push: ${{ inputs.publish }} context: . target: ${{ inputs.target }} - tags: ${{ inputs.tag-name }} - cache-from: type=registry,ref=gmmcal/gmmcal:buildcache${{ inputs.target }} - cache-to: type=registry,ref=gmmcal/gmmcal:buildcache${{ inputs.target }},mode=max + tags: ${{ inputs.image }} + cache-from: type=registry,ref=gmmcal/${{ github.event.repository.name }}:${{ inputs.target }}cache + cache-to: type=registry,ref=gmmcal/${{ github.event.repository.name }}:${{ inputs.target }}cache,mode=max diff --git a/.github/workflows/_lint.yml b/.github/workflows/_lint.yml index bec5355..67076b8 100644 --- a/.github/workflows/_lint.yml +++ b/.github/workflows/_lint.yml @@ -3,16 +3,15 @@ name: Lint on: workflow_call: inputs: + image: + type: string + required: true name: type: string required: true command: type: string required: true - image: - type: string - required: false - default: gmmcal/gmmcal:test jobs: lint: diff --git a/.github/workflows/_preview.yml b/.github/workflows/_preview.yml index d8f4f06..a364da7 100644 --- a/.github/workflows/_preview.yml +++ b/.github/workflows/_preview.yml @@ -3,7 +3,7 @@ name: Deploy preview image on: workflow_call: inputs: - tag-name: + image: type: string required: true @@ -18,5 +18,5 @@ jobs: - name: Create Render service preview id: result run: | - curl -X POST https://api.render.com/v1/services/srv-${{ secrets.DEPLOY_SERVICE }}/preview -H 'Authorization: Bearer ${{ secrets.RENDER_API_KEY }}' -H 'Accept: application/json' -d '{"imagePath": "docker.io/${{ inputs.tag-name }}", "name": "gustavocunha-preview-pr-${{ github.event.number }}-${{ github.run_number }}"}' > result.json + curl -X POST https://api.render.com/v1/services/srv-${{ secrets.DEPLOY_SERVICE }}/preview -H 'Authorization: Bearer ${{ secrets.RENDER_API_KEY }}' -H 'Accept: application/json' -d '{"imagePath": "docker.io/${{ inputs.image }}", "name": "gustavocunha-preview-pr-${{ github.event.number }}-${{ github.run_number }}"}' > result.json echo "url=$(jq -r '.service.serviceDetails.url' result.json)" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/_tests.yml b/.github/workflows/_tests.yml index c52c811..62a9da4 100644 --- a/.github/workflows/_tests.yml +++ b/.github/workflows/_tests.yml @@ -3,6 +3,9 @@ name: Backend Tests on: workflow_call: inputs: + image: + type: string + required: true command: type: string required: true @@ -12,7 +15,7 @@ jobs: name: Backend runs-on: ubuntu-20.04 container: - image: gmmcal/gmmcal:test + image: ${{ inputs.image }} env: DATABASE_URL: postgres://postgres:postgres@postgres:5432/gmmcalcombr_test DATABASE_CLEANER_ALLOW_REMOTE_DATABASE_URL: true