Skip to content

Commit

Permalink
deadline-cloud-test-fixtures initial commit (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
moorec-aws authored Aug 25, 2023
1 parent 39b4f92 commit 4916038
Show file tree
Hide file tree
Showing 41 changed files with 3,611 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @casillas2/Developers
33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "\U0001F41B Bug Report"
description: Report a bug
title: "Bug: TITLE"
labels: ["bug"]
body:
- type: textarea
id: expected_behaviour
attributes:
label: Expected Behaviour
validations:
required: true

- type: textarea
id: current_behaviour
attributes:
label: Current Behaviour
validations:
required: true

- type: textarea
id: reproduction_steps
attributes:
label: Reproduction Steps
validations:
required: true

- type: textarea
id: code_snippet
attributes:
label: Code Snippet
validations:
required: true

1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE/doc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

name: "📕 Documentation Issue"
description: Issue in the documentation
title: "Docs: TITLE"
labels: ["documenation"]
body:
- type: textarea
id: documentation_issue
attributes:
label: Documentation Issue
description: Describe the issue
validations:
required: true
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "\U0001F680 Feature Request"
description: Request a new feature
title: "Feature request: TITLE"
labels: ["feature"]
body:
- type: textarea
id: use_case
attributes:
label: Use Case
validations:
required: true
- type: textarea
id: proposed_solution
attributes:
label: Proposed Solution
validations:
required: true
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/maintenance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "🛠️ Maintenance"
description: Some type of improvement
title: "Maintenance: TITLE"
labels: ["feature"]
body:
- type: textarea
id: description
attributes:
label: Description
validations:
required: true
- type: textarea
id: solution
attributes:
label: Solution
validations:
required: true
11 changes: 11 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### What was the problem/requirement? (What/Why)

### What was the solution? (How)

### What is the impact of this change?

### How was this change tested?

### Was this change documented?

### Is this a breaking change?
17 changes: 17 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip"
directory: "/" # Location of package manifests
schedule:
interval: "daily"
commit-message:
prefix: "chore(deps):"
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests
schedule:
interval: "daily"
21 changes: 21 additions & 0 deletions .github/workflows/auto_approve.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Dependabot auto-approve
on: pull_request

permissions:
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v1
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12 changes: 12 additions & 0 deletions .github/workflows/code_quality.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Code Quality

on:
pull_request:
branches: [ mainline ]

jobs:
Test:
name: Code Quality
uses: ./.github/workflows/reuse_python_build.yml
secrets: inherit

21 changes: 21 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Release Publish
on:
workflow_dispatch:

jobs:
Publish:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_CODEBUILD_RELEASE_PUBLISH_ROLE }}
aws-region: us-west-2
- name: Run CodeBuild
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: deadline-cloud-test-fixtures-Publish
hide-cloudwatch-logs: true
99 changes: 99 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Release

on:
workflow_dispatch:
inputs:
version_to_publish:
description: "Version to be release"
required: false

jobs:
TestMainline:
name: Test Mainline
uses: ./.github/workflows/reuse_python_build.yml
with:
branch: mainline
secrets: inherit

Merge:
needs: TestMainline
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
ref: release
fetch-depth: 0
token: ${{ secrets.CI_TOKEN }}
- name: Set Git config
run: |
git config --local user.email "client-software-ci@amazon.com"
git config --local user.name "client-software-ci"
- name: Update Release
run: git merge --ff-only origin/mainline -v
- name: Push new release
if: ${{ inputs.version_to_publish}}
run: |
git tag -a ${{ inputs.version_to_publish }} -m "Release ${{ inputs.version_to_publish }}"
git push origin release ${{ inputs.version_to_publish }}
- name: Push post release
if: ${{ !inputs.version_to_publish}}
run: git push origin release

TestRelease:
needs: Merge
name: Test Release
uses: ./.github/workflows/reuse_python_build.yml
with:
branch: release
secrets: inherit

PublishMirror:
needs: TestRelease
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
env:
CODEARTIFACT_REGION: "us-west-2"
CODEARTIFACT_DOMAIN: ${{ secrets.CODEARTIFACT_DOMAIN }}
CODEARTIFACT_ACCOUNT_ID: ${{ secrets.CODEARTIFACT_ACCOUNT_ID }}
CODEARTIFACT_REPOSITORY: ${{ secrets.CODEARTIFACT_REPOSITORY }}
CUSTOMER_REPOSITORY: ${{ secrets.CUSTOMER_REPOSITORY }}
steps:
- name: "Checkout"
uses: actions/checkout@v3
with:
ref: release
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_CODEARTIFACT_ROLE }}
aws-region: us-west-2
- name: Install dependencies
run: |
CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token --domain ${{ secrets.CODEARTIFACT_DOMAIN }} --domain-owner ${{ secrets.CODEARTIFACT_ACCOUNT_ID }} --query authorizationToken --output text --region us-west-2)
echo "::add-mask::$CODEARTIFACT_AUTH_TOKEN"
echo CODEARTIFACT_AUTH_TOKEN=$CODEARTIFACT_AUTH_TOKEN >> $GITHUB_ENV
pip install --upgrade hatch
pip install --upgrade twine
- name: Run Build
run: hatch build
- name: Publish
run: |
export TWINE_USERNAME=aws
export TWINE_PASSWORD=`aws codeartifact get-authorization-token --domain ${{ secrets.CODEARTIFACT_DOMAIN }} --domain-owner ${{ secrets.CODEARTIFACT_ACCOUNT_ID }} --query authorizationToken --output text`
export TWINE_REPOSITORY_URL=`aws codeartifact get-repository-endpoint --domain ${{ secrets.CODEARTIFACT_DOMAIN }} --domain-owner ${{ secrets.CODEARTIFACT_ACCOUNT_ID }} --repository ${{ secrets.CODEARTIFACT_REPOSITORY }} --format pypi --query repositoryEndpoint --output text`
twine upload dist/*
- name: Publish to Customer CodeArtifact
run: |
export TWINE_USERNAME=aws
export TWINE_PASSWORD=`aws codeartifact get-authorization-token --domain ${{ secrets.CODEARTIFACT_DOMAIN }} --domain-owner ${{ secrets.CODEARTIFACT_ACCOUNT_ID }} --query authorizationToken --output text`
export TWINE_REPOSITORY_URL=`aws codeartifact get-repository-endpoint --domain ${{ secrets.CODEARTIFACT_DOMAIN }} --domain-owner ${{ secrets.CODEARTIFACT_ACCOUNT_ID }} --repository ${{ secrets.CUSTOMER_REPOSITORY }} --format pypi --query repositoryEndpoint --output text`
twine upload dist/*
60 changes: 60 additions & 0 deletions .github/workflows/reuse_python_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Python Build

on:
workflow_call:
inputs:
branch:
required: false
type: string

jobs:
Python:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11']
env:
PYTHON: ${{ matrix.python-version }}
CODEARTIFACT_REGION: "us-west-2"
CODEARTIFACT_DOMAIN: ${{ secrets.CODEARTIFACT_DOMAIN }}
CODEARTIFACT_ACCOUNT_ID: ${{ secrets.CODEARTIFACT_ACCOUNT_ID }}
CODEARTIFACT_REPOSITORY: ${{ secrets.CODEARTIFACT_REPOSITORY }}
steps:
- uses: actions/checkout@v3
if: ${{ !inputs.branch }}

- uses: actions/checkout@v3
if: ${{ inputs.branch }}
with:
ref: ${{ inputs.branch }}
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_CODEARTIFACT_ROLE }}
aws-region: us-west-2

- name: Install Hatch
run: |
CODEARTIFACT_AUTH_TOKEN=$(aws codeartifact get-authorization-token --domain ${{ secrets.CODEARTIFACT_DOMAIN }} --domain-owner ${{ secrets.CODEARTIFACT_ACCOUNT_ID }} --query authorizationToken --output text --region us-west-2)
echo "::add-mask::$CODEARTIFACT_AUTH_TOKEN"
echo CODEARTIFACT_AUTH_TOKEN=$CODEARTIFACT_AUTH_TOKEN >> $GITHUB_ENV
pip install --upgrade hatch
- name: Run Linting
run: hatch run lint

- name: Run Build
run: hatch build

- name: Run Tests
run: hatch run test
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/dist
*.egg-info/
__pycache__/
.coverage
.tox
.venv
/htmlcov
.vscode
build
*_version.py
32 changes: 27 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
## My Project
## Deadline Test Scaffolding

TODO: Fill this README out!
# Build / Test / Release

Be sure to:
## Setup Code Artifact

* Change the title in this README
* Edit your repository description on GitHub
## Build the package.
```
hatch build
```

## Run tests
```
hatch run test
```

## Run linting
```
hatch run lint
```

## Run formating
```
hatch run fmt
```

## Run a tests for all supported Python versions.
```
hatch run all:test
```

## Security

Expand Down
Loading

0 comments on commit 4916038

Please sign in to comment.