Skip to content

Commit

Permalink
Adding github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Amit3200 committed Jun 14, 2024
1 parent 0fd2c04 commit fe6374b
Show file tree
Hide file tree
Showing 11 changed files with 295 additions and 2 deletions.
55 changes: 55 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
name: Bug report
about: Create a report to help us fix the issue
title: ''
labels: ''
assignees: ''
---

<!--
## Have you read the "Debugging SDKs" doc yet?
There are common setup gotchas that happen with Percy's SDKs, it would be worth reading
the debugging document, which might already answer your question:
https://docs.percy.io/docs/debugging-sdk
## Reach out to Percy support instead?
If you’re having issues that _aren’t SDK bugs_, it would be best for you to
reach out to support instead: [email protected] or
https://www.browserstack.com/contact#technical-support
-->

## The problem

Briefly describe the issue you are experiencing (or the feature you want to see
added to Percy). Tell us what you were trying to do and what happened
instead. Remember, this is _not_ a place to ask questions. For that, go to
https://github.com/percy/cli/discussions/new

## Environment

- Node version:
- `@percy/cli` version:
- Version of Percy SDK you’re using:
- If needed, a build or snapshot ID:
- OS version:
- Type of shell command-line [interface]:

## Details

If necessary, describe the problem you have been experiencing in more detail.

## Debug logs

If you are reporting a bug, _always_ include logs! [Give the "Debugging SDKs"
document a quick read for how to gather logs](https://docs.percy.io/docs/debugging-sdks#debugging-sdks)

Please do not trim or edit these logs, often times there are hints in the full
logs that help debug what is going on.

## Code to reproduce issue

Given the nature of testing/environment bugs, it’s best to try and isolate the
issue in a reproducible repo. This will make it much easier for us to diagnose
and fix.
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: pip
directory: /
labels:
- ⬆️⬇️ dependencies
schedule:
interval: weekly
commit-message:
prefix: ⬆️
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
commit-message:
prefix: ⬆️👷
labels:
- ⬆️⬇️ dependencies
28 changes: 28 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name-template: 'v$RESOLVED_VERSION'
tag-template: 'v$RESOLVED_VERSION'
categories:
- title: '💥 Breaking Changes'
labels:
- 💥 breaking
- title: '✨ Enhancements'
labels:
- ✨ enhancement
- title: '🐛 Bug Fixes'
labels:
- 🐛 bug
- title: '🏗 Maintenance'
labels:
- 🧹 maintenance
- title: '⬆️⬇️ Dependency Updates'
labels:
- ⬆️⬇️ dependencies
change-title-escapes: '\<*_&#@'
version-resolver:
major:
labels:
- 💥 breaking
minor:
labels:
- ✨ enhancement
default: patch
template: '$CHANGES'
48 changes: 48 additions & 0 deletions .github/workflows/Semgrep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Name of this GitHub Actions workflow.
name: Semgrep

on:
# Scan changed files in PRs (diff-aware scanning):
# The branches below must be a subset of the branches above
pull_request:
branches: ["master", "main"]
push:
branches: ["master", "main"]
schedule:
- cron: '0 6 * * *'


permissions:
contents: read

jobs:
semgrep:
# User definable name of this GitHub Actions job.
permissions:
contents: read # for actions/checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
name: semgrep/ci
# If you are self-hosting, change the following `runs-on` value:
runs-on: ubuntu-latest

container:
# A Docker image with Semgrep installed. Do not change this.
image: returntocorp/semgrep

# Skip any PR created by dependabot to avoid permission issues:
if: (github.actor != 'dependabot[bot]')

steps:
# Fetch project source with GitHub Actions Checkout.
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
# Run the "semgrep ci" command on the command line of the docker image.
- run: semgrep ci --sarif --output=semgrep.sarif
env:
# Add the rules that Semgrep uses by setting the SEMGREP_RULES environment variable.
SEMGREP_RULES: p/default # more at semgrep.dev/explore

- name: Upload SARIF file for GitHub Advanced Security Dashboard
uses: github/codeql-action/upload-sarif@6c089f53dd51dc3fc7e599c3cb5356453a52ca9e # v2.20.0
with:
sarif_file: semgrep.sarif
if: always()
11 changes: 11 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Changelog
on:
push:
branches: [master]
jobs:
update_draft:
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 17 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Lint
on: push
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.11
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: v1/${{ runner.os }}/pip/${{ hashFiles('{requirements,development}.txt') }}
restore-keys: v1/${{ runner.os }}/pip/
- run: make lint
20 changes: 20 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Release
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: v1/${{ runner.os }}/pip/${{ hashFiles('{requirements,development}.txt') }}
restore-keys: v1/${{ runner.os }}/pip/
- run: make release
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
31 changes: 31 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 'Close stale issues and PRs'
on:
schedule:
- cron: '0 19 * * 2'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8
with:
stale-issue-message: >-
This issue is stale because it has been open for more than 14 days with no activity.
Remove stale label or comment or this will be closed in 14 days.
stale-pr-message: >-
This PR is stale because it has been open for more than 14 days with no activity.
Remove stale label or comment or this will be closed in 14 days.
close-issue-message: >-
This issue was closed because it has been stalled for 28 days with no activity.
close-pr-message: >-
This PR was closed because it has been stalled for 28 days with no activity.
days-before-issue-stale: 14
days-before-pr-stale: 14
# close 14 days _after_ initial warning
days-before-issue-close: 14
days-before-pr-close: 14
exempt-pr-labels: '❄️ on ice'
exempt-issue-labels: '🐛 bug,❄️ on ice,✨ enhancement'
exempt-all-assignees: true
stale-pr-label: '🍞 stale'
stale-issue-label: '🍞 stale'
64 changes: 64 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Test
on:
push:
workflow_dispatch:
inputs:
branch:
required: false
type: string
default: master

jobs:
test:
name: Test
strategy:
matrix:
python: [3.6, 3.7, 3.8, 3.9]
runs-on: ${{ matrix.python == 3.6 && 'ubuntu-20.04' || 'ubuntu-latest' }}

steps:
- uses: actions-ecosystem/action-regex-match@v2
id: regex-match
if: ${{ github.event_name == 'workflow_dispatch' }}
with:
text: ${{ github.event.inputs.branch }}
regex: '^[a-zA-Z0-9_/\-]+$'
- name: Break on invalid branch name
run: exit 1
if: ${{ github.event_name == 'workflow_dispatch' && steps.regex-match.outputs && steps.regex-match.outputs.match == '' }}
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: v1/${{ runner.os }}/pypi-${{matrix.python}}/${{ hashFiles('{requirements,development}.txt') }}
restore-keys: v1/${{ runner.os }}/pypi-${matrix.python}/
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: v1/${{ runner.os }}/node-${{ matrix.node }}/${{ hashFiles('**/yarn.lock') }}
restore-keys: v1/${{ runner.os }}/node-${{ matrix.node }}/
- name: Set up @percy/cli from git
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
cd /tmp
git clone --branch ${{ github.event.inputs.branch }} --depth 1 https://github.com/percy/cli
cd cli
PERCY_PACKAGES=`find packages -mindepth 1 -maxdepth 1 -type d | sed -e 's/packages/@percy/g' | tr '\n' ' '`
git log -1
yarn
yarn build
yarn global:link
cd ${{ github.workspace }}
yarn remove @percy/cli && yarn link `echo $PERCY_PACKAGES`
npx percy --version
- run: make test
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @percy/percy-product-reviewers
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ clean:
build: venv
$(VENV)/python setup.py sdist bdist_wheel

# release: build
# $(VENV)/twine upload dist/* --username __token__ --password ${PYPI_TOKEN}
release: build
$(VENV)/twine upload dist/* --username __token__ --password ${PYPI_TOKEN}

0 comments on commit fe6374b

Please sign in to comment.