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

Update test_factorization_machines.py #35

Open
wants to merge 19 commits into
base: master-workflows
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 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
4 changes: 2 additions & 2 deletions .github/workflows/codebuild-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: actions/github-script@v7
id: collab-check
env:
PR_USER_LOGIN: ${{ github.event.pull_request.user.login }}
GH_USER_LOGIN: ${{ github.event.pull_request.user.login }}
with:
github-token: ${{ secrets.COLLAB_CHECK_TOKEN }}
result-encoding: string
Expand All @@ -35,7 +35,7 @@ jobs:
const res = await github.rest.repos.checkCollaborator({
owner: context.repo.owner,
repo: context.repo.repo,
username: "${{ env.PR_USER_LOGIN }}",
username: "${{ env.GH_USER_LOGIN }}",
});
console.log("Verifed user is a repo collaborator. Auto Approving PR Checks.")
return res.status == "204" ? "auto-approve" : "manual-approval"
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/localmode-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run Local Mode Tests

on:
workflow_call:
inputs:
prNumber:
required: true
type: number
commitSha:
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ inputs.prNumber }}
cancel-in-progress: true

permissions:
id-token: write # This is required for requesting the JWT

jobs:
local-mode-tests:
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
aws-region: us-west-2
role-duration-seconds: 10800
- name: Run Test
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: ${{ github.repository.name }}-ci-localmode-tests
source-version-override: 'refs/pull/${{ inputs.prNumber }}/head^{${{ inputs.commitSha }}}'
64 changes: 64 additions & 0 deletions .github/workflows/run-extras.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Run Extras

on:
pull_request_review:
types: [submitted]

permissions:
id-token: write # This is required for requesting the JWT

jobs:
check-comment:
if: github.event.review.body == '/run slow' || github.event.review.body == '/run localmode'
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.MONITORING_AWS_ROLE_ARN }}
aws-region: us-west-2
- name: Collaborator Check
uses: actions/github-script@v7
id: collab-check
env:
GH_USER_LOGIN: ${{ github.event.review.user.login }}
with:
github-token: ${{ secrets.COLLAB_CHECK_TOKEN }}
result-encoding: string
script: |
try {
const res = await github.rest.repos.checkCollaborator({
owner: context.repo.owner,
repo: context.repo.repo,
username: "${{ env.GH_USER_LOGIN }}",
});
console.log("Verifed user is a repo collaborator.")
return
} catch (error) {
if (error.message == "Bad credentials") {
console.log("Token Expired. Please update the COLLAB_CHECK_TOKEN secret.")
const { execSync } = require('child_process')
execSync('aws cloudwatch put-metric-data --namespace "GitHubActions" --metric-name "BadCredentials" --value 1')
}
throw new Error("Collaborator status could not be verified.")
}
run-slow-tests:
needs: [check-comment]
if: needs.check-comment.result == 'success' && github.event.review.body == '/run slow'
runs-on: ubuntu-latest
steps:
- name: Run Slow Tests
uses: ./.github/workflows/slow-tests.yml
with:
prNumber: ${{ github.event.pull_request.number }}
commitSha: ${{ github.event.pull_request.head.sha }}
run-localmode-tests:
needs: [check-comment]
if: needs.check-comment.result == 'success' && github.event.review.body == '/run localmode'
runs-on: ubuntu-latest
steps:
- name: Run Local Mode Tests
uses: ./.github/workflows/localmode-tests.yml
with:
prNumber: ${{ github.event.pull_request.number }}
commitSha: ${{ github.event.pull_request.head.sha }}
35 changes: 0 additions & 35 deletions .github/workflows/run-local-mode-tests.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/run-slow-tests.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/slow-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run Slow Tests

on:
workflow_call:
inputs:
prNumber:
required: true
type: number
commitSha:
required: true
type: string

concurrency:
group: ${{ github.workflow }}-${{ inputs.prNumber }}
cancel-in-progress: true

permissions:
id-token: write # This is required for requesting the JWT

jobs:
local-mode-tests:
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.CI_AWS_ROLE_ARN }}
aws-region: us-west-2
role-duration-seconds: 10800
- name: Run Test
uses: aws-actions/aws-codebuild-run-build@v1
with:
project-name: ${{ github.repository.name }}-ci-slow-tests
source-version-override: 'refs/pull/${{ inputs.prNumber }}/head^{${{ inputs.commitSha }}}'
2 changes: 1 addition & 1 deletion tests/integ/test_factorization_machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_factorization_machines(sagemaker_session, cpu_instance_type, training_s
)
predictor = model.deploy(1, cpu_instance_type, endpoint_name=job_name)
result = predictor.predict(training_set[0][:10])

# Random Test
assert len(result) == 10
for record in result:
assert record.label["score"] is not None
Expand Down
Loading