Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding git workflows with test matrix and common workflows #363

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 5
# Issues with these labels will never be considered stale
exemptLabels:
- locked
- must
- roadmap
- should
- keep
# Label to use when marking an issue as stale
staleLabel: stale
markComment: >
We're closing this issue because it hasn't been updated in a while.
This isn't a judgement on the merit of the issue in any way.
It's just a way of keeping the issues clean.
This issue is stale because it has been open 30 days with no activity.
Remove stale label or comment or this will be closed in 5 days
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: true
88 changes: 88 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: BuildAndTest

on:
push:
branches:
- master
- '!release*'
pull_request:
branches:
- master
- '!release*'
jobs:
build:
name: "Build Deequ with JDK ${{ matrix.java }}, Hadoop ${{ matrix.hadoop }}, Spark ${{ matrix.spark-version }}"
# os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
hadoop: [2.7, 3.2]
java: [11]
spark-version: [2.4.7, 3.0.2] # 3.1.1 - not supported yet
scala-version: [2.12]
env:
GITHUB_PREV_SHA: ${{ github.event.before }}
SPARK_VERSION: ${{ matrix.spark-version }}
timeout-minutes: 60
steps:
- name: Checkout Spark repository
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'

# Install spark from apache-mirror: https://apachemirror.wuchna.com/spark/
- name: Run setup-spark ${{ matrix.spark-version }}
uses: vemonet/setup-spark@v1
with:
spark-version: ${{ matrix.spark-version }}
hadoop-version: ${{ matrix.hadoop }}

- name: Check Java
run: java -version

- name: Check Spark
run: spark-submit --version

- name: Check Disk Size before Cache
run: |
df -hm

- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Check Maven-com Cache
uses: actions/cache@v2
with:
path: ~/.m2/repository/com
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-m2-

- name: Check Disk Size before Build
run: |
df -hm

- name: Build with Maven
run: mvn clean install

- name: Check Disk Size after Build
run: |
df -hm
# run: mvn --batch-mode --update-snapshots verify

# - run: mkdir staging && cp target/*.jar staging
# - uses: actions/upload-artifact@v2
# with:
# name: Package
# path: staging
20 changes: 20 additions & 0 deletions .github/workflows/cancel_duplicate_workflow_runs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Cancelling Duplicates Workflows
on:
workflow_run:
workflows:
- 'Build and test'
types: ['requested']

jobs:
# Cancel duplicate workflow runs
cancel-duplicate-workflow-runs:
name: "Cancel duplicate workflow runs"
runs-on: ubuntu-latest
steps:
- uses: potiuk/cancel-workflow-runs@8248bc1feff049e98c0e6a96889b147199c38203
name: "Cancel duplicate workflow runs"
with:
cancelMode: allDuplicates
token: ${{ secrets.GITHUB_TOKEN }}
sourceRunId: ${{ github.event.workflow_run.id }}
skipEventTypes: '["push", "schedule"]'
34 changes: 34 additions & 0 deletions .github/workflows/close_stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Mark and Close stale issues and pull requests

on:
schedule:
- cron: "30 0 * * *"

jobs:
# Mark and Close stale
stale:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-pr-message: >
We're closing this PR because it hasn't been updated in a while.
This isn't a judgement on the merit of the PR in any way. It's just
a way of keeping the PR queue manageable.
If you'd like to revive this PR, please reopen it and ask a
committer to remove the Stale tag!
stale-pr-label: 'no-pr-activity'
stale-issue-message: >
We're closing this issue because it hasn't been updated in a while.
This isn't a judgement on the merit of the issue in any way.
It's just a way of keeping the issues clean.
This issue is stale because it has been open 30 days with no activity.
Remove stale label or comment or this will be closed in 5 days
stale-issue-label: 'no-issue-activity'
exempt-issue-labels: 'blocked,must,should,keep'
days-before-stale: 30
days-before-close: 5
62 changes: 62 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: "CodeQL"

on:
push:
branches:
- master
- '!release*'
pull_request:
branches:
- master
- '!release*'
schedule:
- cron: '37 14 * * 3'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# - run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
17 changes: 17 additions & 0 deletions .github/workflows/delete_merged_branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Reference: https://github.com/SvanBoxel/delete-merged-branch
name: Delete Merged Branches
# The event that triggers the workflow
on:
pull_request:
types:
- closed
jobs:
delete_branch:
# The machine each job should run
runs-on: ubuntu-latest
# The tasks each job should run
steps:
- name: delete branch
uses: SvanBoxel/delete-merged-branch@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 16 additions & 0 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Greetings

on: [pull_request, issues]

jobs:
greeting:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: 'Message that will be displayed on users first issue'
pr-message: 'Message that will be displayed on users first pull request'
34 changes: 34 additions & 0 deletions .github/workflows/lint_commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Lint Commits

on:
pull_request_target:
types: ["opened", "reopened", "synchronize"]

jobs:
# lint commits
lint_commits:
runs-on: ubuntu-latest
steps:
- name: Lint commits
uses: actions-ecosystem/action-lint-commits@v1
id: lint-commits
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
regex: '.+' # ^\w+\(.+\): e.g.) "feat(api): Add /users/get" or `ci: Adds CI workflow`
format: markdown

- name: Post warning comment
uses: actions-ecosystem/action-create-comment@v1
if: ${{ steps.lint-commits.outputs.unmatched_commits != '' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
body: |
The following commits needs their message changes:

${{ steps.lint-commits.outputs.unmatched_commits }}

The format `<type>(<scope>): <subject>` (`'.+'`) is acceptable. e.g., `feat(api): Add /users/get` or `ci: Adds CI workflow`

- name: Soft exit (Fail) when commits don't pass lint
if: ${{ steps.lint-commits.outputs.unmatched_commits != '' }}
run: exit 0
18 changes: 18 additions & 0 deletions .github/workflows/on_review_requested.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Review requested
on:
pull_request_target:
types: [review_requested]
jobs:
review-label:
runs-on: ubuntu-latest
steps:
- uses: actions-ecosystem/action-add-labels@v1
if: github.event.review.state == 'changes_requested'
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
labels: todo
- uses: actions-ecosystem/action-add-labels@v1
if: github.event.review.state == 'approved'
with:
github_token: "${{ secrets.GITHUB_TOKEN }}"
labels: approved