-
Notifications
You must be signed in to change notification settings - Fork 94
Migrate from Travis to GitHub Action #228
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: Test | ||
on: | ||
# Ensure GitHub actions are not run twice for same commits | ||
push: | ||
branches: [master] | ||
tags: ['*'] | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
test-node: | ||
name: Node ${{ matrix.node_version }} on ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macOS-latest, windows-latest] | ||
node_version: [12] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Install Node.js ${{ matrix.node }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node_version }} | ||
- name: Git checkout | ||
uses: actions/checkout@v1 | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Tests | ||
run: npm test | ||
test-go: | ||
name: Go ${{ matrix.go_version }} on ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macOS-latest, windows-latest] | ||
go_version: [1.13.x, 1.14.x] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Install Go ${{ matrix.go }} | ||
uses: actions/setup-go@v2-beta | ||
with: | ||
go-version: ${{ matrix.go_version }} | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Install make | ||
run: choco install make | ||
if: ${{ matrix.os == 'windows-latest' }} | ||
- name: Install dependencies | ||
run: make deps | ||
- name: Tests | ||
run: make test |
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on traffic mesh we are not seeing duplicated runs with just
on: push
: https://github.com/netlify/traffic-mesh/blob/master/.github/workflows/rust.yml#L3There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confess that I copy&pasted from https://github.com/netlify/js-client/blob/1000eac0fdf9434336adefdde5cce1d46c02d60e/.github/workflows/workflow.yml#L2-L8 , any opinions/suggestions @ehmicky ? (as I copy pasted from you :P)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was suggested by @erezrokah and was originally copied from
netlify-cms
.When doing only
push
, PRs that come from forked repositories do not seem to be included.When doing both
push
andpull_request
, PRs that come from non-forked repositories are run twice, which is the reason behindbranches: [master]
. Thetags
andtypes
are just the default values (can be removed).@erezrokah Please correct me if I'm wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, that explains why i haven't seen it on a private repo 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice 🎉 very good to know, thanks for tips @ehmicky and @erezrokah , sounds like we could copypasta this whenever we migrate other open source repos too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another thing to consider is that GitHub secrets are not passed to actions triggered from forked repositories.
We had to create a separate testing flow for the CMS project:
https://github.com/netlify/netlify-cms/blob/b5a242ec8ed627e7f5e2ce8af454dd1dda1f71cc/.github/workflows/nodejs.yml#L104
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good to know, thanks for sharing @erezrokah ! I think it won't be a problem with this repo but I'll keep it in my mind 👍