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

Add some testing of actions #30

Merged
merged 10 commits into from
Dec 9, 2021
Merged
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
10 changes: 7 additions & 3 deletions .github/actions/binder-link/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,16 @@ runs:
var PR_HEAD_USERREPO = process.env.PR_HEAD_USERREPO;
var PR_HEAD_REF = process.env.PR_HEAD_REF;
var URL_PATH = process.env.URL_PATH;
github.issues.createComment({
var BODY = `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${PR_HEAD_USERREPO}/${PR_HEAD_REF}?urlpath=${URL_PATH}) :point_left: Launch a Binder on branch _${PR_HEAD_USERREPO}/${PR_HEAD_REF}_`;
var CONTENT = {
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/${PR_HEAD_USERREPO}/${PR_HEAD_REF}?urlpath=${URL_PATH}) :point_left: Launch a Binder on branch _${PR_HEAD_USERREPO}/${PR_HEAD_REF}_`
})
body: BODY
};
if ("${{ inputs.github_token }}" !== "FAKE") {
github.issues.createComment($CONTENT);
}
env:
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
PR_HEAD_USERREPO: ${{ github.event.pull_request.head.repo.full_name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/downstream-test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ runs:

# Test the downstream package
eval ${test_command}
eval ${extra_test}
eval "${{inputs.extra_test}}"

# Cleanup
rm -rf ./test_venv
54 changes: 54 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Tests
on:
push:
branches: ["main"]
pull_request:
branches: ["*"]

jobs:
downstream_defaults:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Base Setup
uses: ./.github/actions/base-setup
- name: Create a mock python package
run:
echo "from setuptools import setup; setup(name='foo')" > setup.py
- name: Check Downstream test with defaults
uses: ./.github/actions/downstream-test
with:
package_name: jupyter_client

downstream_overrides:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Base Setup
uses: ./.github/actions/base-setup
- name: Create a mock python package
run:
echo "from setuptools import setup; setup(name='foo')" > setup.py
- name: Check Downstream test with overrides
uses: ./.github/actions/downstream-test
with:
package_name: nbclient
package_spec: "nbclient[test] ipykernel"
test_command: "echo 'hello'"
extra_test: "pytest --pyargs nbclient"
env_values: IPYKERNEL_CELL_NAME=\<IPY-INPUT\>

binder_link:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Base Setup
uses: ./.github/actions/base-setup
- name: Check Binder Link
uses: ./.github/actions/binder-link
with:
github_token: "FAKE"
url_path: "/foo/bar"