Skip to content

Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows #1413

Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows

Bump actions/download-artifact from 2 to 4.1.7 in /.github/workflows #1413

Workflow file for this run

name: Unit Tests
on:
push:
branches:
- '[0-9]+.0'
paths:
- '**/workflows/**'
- '**/src/**'
- '**/i18n/**'
- '**.py'
- '**.xml'
pull_request:
branches:
- '[0-9]+.0'
types: [ opened, synchronize, reopened, labeled ]
env:
REQUIRED_MODULES: 'l10n_do' # list of addional addons to install separated by comma
TEST_TAGS: '0'
jobs:
test:
name: Test Modules
runs-on: ubuntu-latest
outputs:
get_modules: ${{ steps.get_modules.outputs.modules }}
services:
db:
image: postgres:13
env:
POSTGRES_DB: postgres
POSTGRES_USER: odoo
POSTGRES_PASSWORD: odoo
# needed because the postgres container does not provide a healthcheck
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Inject slug/short variables
uses: rlespinasse/[email protected]
- name: INDEXA ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}
uses: actions/checkout@v3
with:
path: ${{ env.GITHUB_REPOSITORY_SLUG_URL }}
- name: Download python addons script
run: curl https://raw.githubusercontent.com/iterativo-git/dockerdoo/${{ env.GITHUB_BASE_REF_SLUG || env.GITHUB_REF_SLUG }}/resources/getaddons.py -o getaddons.py
- name: Select Odoo modules to install
id: get_modules
run: |
output=$(python -c "from getaddons import get_modules; print(','.join(get_modules('$GITHUB_WORKSPACE/${{ env.GITHUB_REPOSITORY_SLUG_URL }}', depth=3)))")
echo $output
echo "::set-output name=modules::$output"
- name: Set test all tag
if: ${{ github.event.label.name == 'test all' }}
run: |
echo "WITHOUT_TEST_TAGS=1" >> $GITHUB_ENV
- name: Run Odoo tests
run: |
docker pull gcr.io/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 }}
env:
RUN_TESTS: '1'
WITHOUT_TEST_TAGS: ${{ env.WITHOUT_TEST_TAGS }}
PIP_AUTO_INSTALL: '1'
LOG_LEVEL: test
WITHOUT_DEMO: 'False'
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/[email protected]
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 }}