Skip to content

Commit

Permalink
Get TC to run 'npm run lint'
Browse files Browse the repository at this point in the history
Met with owlish who answered a lot of my initial questions for this first milestone
  • Loading branch information
biancadanforth committed Dec 13, 2018
1 parent 48c90fe commit b2ad549
Showing 1 changed file with 42 additions and 47 deletions.
89 changes: 42 additions & 47 deletions .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
# - https://github.com/taskcluster/taskcluster-github/blob/master/docs/taskcluster-yml-v1.md
version: 1
policy:
pullRequests: public
pullRequests: public # Run these tasks for qualifying GH events from any one in the repo
tasks:
# When a PR is opened, reopened or synchronized, perform this task
- $if: 'tasks_for == "github-pull-request" && event["action"] in ["opened", "reopened", "synchronize"]'
then:
# QUESTION - how does taskId vary? Seems like passing a static string each time.
taskId: {$eval: as_slugid("pr_task")}
# TC creates a task group with tasks in it; each task has an ID. TC will provide a link
# built with these IDs in GH's GUI every time a task is created, even if it fails.
taskId: {$eval: as_slugid("pr_task")} # Returns a hash of a string
created: {$fromNow: ''}
# If the task is not completed by its deadline, it will be resolved as `exception`
# with reason "deadline-exceeded"
Expand All @@ -18,35 +19,29 @@ tasks:
# (could be 1 CPU, a fraction of a CPU, multiple CPUs...)that will execute the
# task. e.g. 'aws-provisioner-v1' is the AWS Provisioner, which runs its tasks
# on Amazon EC2 instances using Docker.
# QUESTION - is this the right provisioner? In mythmon's v0, he had something like:
# '{{ taskcluster.docker.provisionerId }}'
provisionerId: aws-provisioner-v1
# A parameter specific to the AWS Provisioner which identifies the pool of EC2
# resources within which the task should be executed. Pools may use different
# EC2 instance types, AMIs (Amazon Machine Images), etc.
# QUESTION - is this the right worker? In mythmon's v0, he had something like:
# '{{ taskcluster.docker.workerType }}'
workerType: github-worker
workerType: github-worker # TC's generic worker for any github projects; can do Try server pushes
# A scope is a permission to perform a particular action. A task has a set of
# scopes that determine what the task can do. These scopes are validated by the worker.
scopes:
- secrets:get:project/taskcluster/testing/taskcluster-github # QUESTION - What scopes do I need?
payload: # The format of a task's payload property is specific to the worker that will execute it
maxRunTime: 600 # 10 minutes
# QUESTION: Is this the right image? Where can I find all supported images? Do all images have
# Firefox installed to push to Try? I want to run TALOS and mochitests in addition to unit tests
# from my repo
image: "node:8" # The Docker image to pull
env: # QUESTION: What is this?
DEBUG: "* -mocha* -nock* -express* -body-parser* -eslint*" # QUESTION: What is this? What does *, -mocha* etc. do?
features: # QUESTION: What is this?
taskclusterProxy: true # QUESTION: What does this mean?
env: # Environment variables to declare in the shell
DEBUG: "* -eslint*" # Say you have debug statements in library code; a DEBUG variable with a
# value of * will log all levels of debug statements
command: # The command to run within that Docker image
- "/bin/bash"
- "-lc" # '--login' (executes user's profile commands), '-c' (executes commands from a string)
- >- # QUESTION: Will multi-line commands like this work in v1? Can I omit -c above?
- >-
git clone ${event.pull_request.head.repo.git_url} repo &&
cd repo && git checkout ${event.pull_request.head.sha} &&
cd repo &&
git checkout ${event.pull_request.head.sha} &&
npm install &&
npm run lint
# TODO bdanforth: Replace `npm run lint` above with `npm test`
Expand All @@ -55,37 +50,37 @@ tasks:
description: "All tests"
owner: ${event.pull_request.user.login}@users.noreply.github.com
source: ${event.repository.url}
# When a commit is pushed to the repo, perform this task
# When a commit is pushed to master, perform this task
# If a branch is merged without being updated first, the tests could pass on the branch
# but not when things are merged into master.
# QUESTION: Does this cover additional commits to an existing open PR?
- $if: 'tasks_for == "github-push"'
then:
taskId: {$eval: as_slugid("push_task")}
created: {$fromNow: ''}
deadline: {$fromNow: '1 hour'}
provisionerId: aws-provisioner-v1
workerType: github-worker
scopes:
- secrets:get:project/taskcluster/testing/taskcluster-github
payload:
maxRunTime: 600
image: "node:8"
env:
DEBUG: "* -mocha* -nock* -express* -body-parser* -eslint*"
NO_TEST_SKIP: "true"
features:
taskclusterProxy: true
command:
- "/bin/bash"
- "-lc"
- >-
git clone ${event.repository.url} repo &&
cd repo &&
git checkout ${event.after} &&
npm install &&
npm run lint
# TODO bdanforth: Replace `npm run lint` above with `npm test`
metadata:
name: "Taskcluster GitHub Tests"
description: "All tests"
owner: ${event.pusher.name}@users.noreply.github.com
source: ${event.repository.url}
$if: 'event.ref == "refs/heads/master"'
then:
taskId: {$eval: as_slugid("push_task")}
created: {$fromNow: ''}
deadline: {$fromNow: '1 hour'}
provisionerId: aws-provisioner-v1
workerType: github-worker
payload:
maxRunTime: 600
image: "node:8"
env:
DEBUG: "* -eslint*"
NO_TEST_SKIP: "true"
command:
- "/bin/bash"
- "-lc"
- >-
git clone ${event.repository.url} repo &&
cd repo &&
git checkout ${event.after} &&
npm install &&
npm run lint
# TODO bdanforth: Replace `npm run lint` above with `npm test`
metadata:
name: "Firefox Experiments GitHub Tests"
description: "All tests"
owner: ${event.pusher.name}@users.noreply.github.com
source: ${event.repository.url}

0 comments on commit b2ad549

Please sign in to comment.