From 3887c773da3a45659dca28c0971dc016dd4f8f20 Mon Sep 17 00:00:00 2001 From: Joaquim Neto Date: Fri, 23 Apr 2021 18:47:03 -0300 Subject: [PATCH] ci: :construction_worker: Added Codacy and change docs --- .github/ISSUE_TEMPLATE/bug_report.md | 27 ++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 19 ++++++ .github/PULL_REQUEST_TEMPLATE.md | 5 ++ .github/dependabot.yml | 13 ++++ .github/workflows/codacy-analysis.yml | 36 +++++++++++ CODE_OF_CONDUCT.md | 76 +++++++++++++++++++++++ README.md | 1 + cloud_config/scheduler_sample.json | 6 +- megalist_dataflow/uploaders/utils.py | 2 +- run_cloud.sh | 2 +- 10 files changed, 182 insertions(+), 5 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/codacy-analysis.yml create mode 100644 CODE_OF_CONDUCT.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..7955b54b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,27 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '[BUG]' +labels: bug +assignees: '' +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: + +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..9383cc48 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,19 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '[NEW]' +labels: enhancement +assignees: '' +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 00000000..69fd1516 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,5 @@ +**What issue does this pull request resolve?** + +**What changes did you make?** + +**Is there anything that requires more attention while reviewing?** diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..f7628b26 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: 'github-actions' + directory: '/' + schedule: + interval: 'weekly' + + # Maintain dependencies for npm + - package-ecosystem: 'pip' + directory: '/megalist_dataflow' + schedule: + interval: 'weekly' diff --git a/.github/workflows/codacy-analysis.yml b/.github/workflows/codacy-analysis.yml new file mode 100644 index 00000000..7e62010d --- /dev/null +++ b/.github/workflows/codacy-analysis.yml @@ -0,0 +1,36 @@ +# This workflow checks out code, performs a Codacy security scan +# and integrates the results with the +# GitHub Advanced Security code scanning feature. For more information on +# the Codacy security scan action usage and parameters, see +# https://github.com/codacy/codacy-analysis-cli-action. +# For more information on Codacy Analysis CLI in general, see +# https://github.com/codacy/codacy-analysis-cli. + +name: Codacy + +on: ['push'] + +jobs: + codacy-security-scan: + name: Codacy Analysis + runs-on: ubuntu-latest + steps: + # Checkout the repository to the GitHub Actions runner + - name: Checkout code + uses: actions/checkout@v2 + + # Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis + - name: Run Codacy Analysis CLI + uses: codacy/codacy-analysis-cli-action@3.0.0 + with: + # Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository + # You can also omit the token and run the tools that support default configurations + project-token: ${{ secrets.CODACY_PROJECT_TOKEN }} + verbose: true + output: results.sarif + format: sarif + # Adjust severity of non-security issues + gh-code-scanning-compat: true + # Force 0 exit code to allow SARIF file generation + # This will handover control about PR rejection to the GitHub side + max-allowed-issues: 2147483647 diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..51db4fdd --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to make participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +- The use of sexualized language or imagery and unwelcome sexual attention or + advances +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic + address, without explicit permission +- Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies within all project spaces, and it also applies when +an individual is representing the project or its community in public spaces. +Examples of representing a project or community include using an official +project e-mail address, posting via an official social media account, or acting +as an appointed representative at an online or offline event. Representation of +a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at koopas@dp6.com.br. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/README.md b/README.md index c9fd8a2a..8844568f 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ Solution based on the [Google Megalista project](https://github.com/google/megal Code quality +

Sample integration code for onboarding offline/CRM data from BigQuery as custom audiences or offline conversions in Google Ads, Google Analytics 360, Google Display & Video 360, Google Campaign Manager and Facebook Ads. diff --git a/cloud_config/scheduler_sample.json b/cloud_config/scheduler_sample.json index cc6e5393..b653367a 100644 --- a/cloud_config/scheduler_sample.json +++ b/cloud_config/scheduler_sample.json @@ -1,5 +1,5 @@ { - "jobName": "megalist_daily", + "jobName": "mds_daily", "parameters": { "developer_token": "Google Ads Developer Token", "client_id": "GCP OAuth Client id", @@ -7,11 +7,11 @@ "access_token": "GCP OAuth access token", "refresh_token": "GCP OAuth refresh token", "setup_sheet_id": "Setup Google Sheets Id", - "bq_ops_dataset": "Auxliary bigquery dataset used for Megalista operations", + "bq_ops_dataset": "Auxliary bigquery dataset used for MDS operations", "appsflyer_dev_key": "Apps flyer dev key" }, "environment": { - "tempLocation": "gs://megalist-data/temp", + "tempLocation": "gs://bucket-name/temp", "zone": "us-central1-f" } } diff --git a/megalist_dataflow/uploaders/utils.py b/megalist_dataflow/uploaders/utils.py index 9e2724e6..c458685a 100644 --- a/megalist_dataflow/uploaders/utils.py +++ b/megalist_dataflow/uploaders/utils.py @@ -32,7 +32,7 @@ def get_ads_service(service_name, version, oauth_credentials, developer_token, client = adwords.AdWordsClient( developer_token, oauth2_client, - 'MegaList Dataflow', + 'Mds Dataflow', client_customer_id=customer_id) return client.GetService(service_name, version=version) diff --git a/run_cloud.sh b/run_cloud.sh index db709d44..d2b53ed0 100755 --- a/run_cloud.sh +++ b/run_cloud.sh @@ -21,4 +21,4 @@ fi gcloud config set project $1 token=$(gcloud auth application-default print-access-token) -curl -H "Authorization: Bearer $token" -H "Content-Type:application/json" "https://dataflow.googleapis.com/v1b3/projects/$1/locations/$3/templates:launch?gcsPath=gs://$2/templates/megalist" --data-binary "@cloud_config/scheduler.json" +curl -H "Authorization: Bearer $token" -H "Content-Type:application/json" "https://dataflow.googleapis.com/v1b3/projects/$1/locations/$3/templates:launch?gcsPath=gs://$2/templates/mds" --data-binary "@cloud_config/scheduler.json"