Skip to content

Commit

Permalink
Merge pull request #1190 from indexa-git/update-test_action-bot
Browse files Browse the repository at this point in the history
Fix Unit Test Workflow in $16.0
  • Loading branch information
ivan-pcg authored Nov 28, 2024
2 parents 2446d4e + 0a339a5 commit 48c6ae5
Showing 1 changed file with 26 additions and 41 deletions.
67 changes: 26 additions & 41 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
test:
name: Test Modules
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
outputs:
get_modules: ${{ steps.get_modules.outputs.modules }}
services:
Expand All @@ -46,7 +49,7 @@ jobs:
uses: rlespinasse/[email protected]

- name: INDEXA ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: ${{ env.GITHUB_REPOSITORY_SLUG_URL }}

Expand All @@ -63,12 +66,31 @@ jobs:
if: ${{ github.event.label.name == 'test all' }}
run: |
echo "WITHOUT_TEST_TAGS=1" >> $GITHUB_ENV
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/[email protected]
with:
project_id: '${{ vars.ITERATIVO_GCP_PROJECT }}'
workload_identity_provider: '${{ vars.ITERATIVO_GCP_WORKLOAD_IDENTITY }}'
service_account: '${{ vars.ITERATIVO_GCP_ARTIFACTS_SA }}'
token_format: access_token


- name: Login to Google Artifact Registry
uses: docker/[email protected]
with:
registry: gcr.io
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}

- name: Run Odoo tests
run: |
docker pull gcr.io/iterativo/dockerdoo:${{ env.GITHUB_BASE_REF_SLUG || env.GITHUB_REF_SLUG }}
docker pull gcr.io/${{ vars.ITERATIVO_GCP_PROJECT }}/iterativo/dockerdoo:${{ env.GITHUB_BASE_REF_SLUG || env.GITHUB_REF_SLUG }}
docker run -e RUN_TESTS -e WITHOUT_TEST_TAGS -e PIP_AUTO_INSTALL -e LOG_LEVEL -e WITHOUT_DEMO -e EXTRA_MODULES -e ODOO_EXTRA_ADDONS -e PGHOST \
-v $GITHUB_WORKSPACE:/github/workspace \
--network="host" --name odoo -t gcr.io/iterativo/dockerdoo:${{ env.GITHUB_BASE_REF_SLUG || env.GITHUB_REF_SLUG }}
--network="host" --name odoo -t gcr.io/${{ vars.ITERATIVO_GCP_PROJECT }}/iterativo/dockerdoo:${{ env.GITHUB_BASE_REF_SLUG || env.GITHUB_REF_SLUG }}
env:
RUN_TESTS: '1'
WITHOUT_TEST_TAGS: ${{ env.WITHOUT_TEST_TAGS }}
Expand All @@ -78,41 +100,4 @@ jobs:
EXTRA_MODULES: ${{ steps.get_modules.outputs.modules }},${{ env.REQUIRED_MODULES }}
ODOO_EXTRA_ADDONS: /github/workspace
PGHOST: localhost

- name: Zip modules for upload
run: sudo apt-get update && sudo apt-get install -y zip && zip -r modules.zip .

- name: Upload repository results
uses: actions/upload-artifact@v2
with:
name: modules
path: modules.zip
retention-days: 1

build-gcp:
name: Build & Push to GCR
needs: ['test']
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' }}

steps:
- name: Download repository results
uses: actions/download-artifact@v2
with:
name: modules

- run: unzip modules.zip

- name: Inject slug/short variables
uses: rlespinasse/[email protected]

- name: Push to Google Cloud Registry
uses: docker/build-push-action@v1
with:
dockerfile: ${{ env.GITHUB_REPOSITORY_SLUG_URL }}/Dockerfile
cache_froms: docker.pkg.github.com/${{ github.repository }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}:${{ env.GITHUB_HEAD_REF_SLUG_URL }}
username: _json_key
password: ${{ secrets.GKE_SA_KEY }}
registry: gcr.io
repository: ${{ secrets.GKE_PROJECT }}/${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}
tags: ${{ env.GITHUB_SHA_SHORT }}

0 comments on commit 48c6ae5

Please sign in to comment.