Skip to content

Commit

Permalink
Use GitHub Actions for CI and Prepare to use GitHub Package Registry (g…
Browse files Browse the repository at this point in the history
…ithub-linguist#4600)

* Add github CI workflow

* Run prep cmds directly

* Add comments

* Add github_repo metadata

This is so we can start using GitHub Package Registry.

* Remove old travis config

* Update mentions of Travis

* Add push deets for GPR

* Use script for CI deps installation

* Use pipe delimiter so we don't need to escape slashes

* Rename dir

* Use syntax for single cmd

* Link to GitHub Actions
  • Loading branch information
lildude authored Aug 12, 2019
1 parent 1eda31f commit b475846
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 41 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: CI

on: [push]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
ruby: [ '2.6.x', '2.5.x', '2.4.x', '2.3.x' ]
steps:
- uses: actions/checkout@master
- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
version: ${{ matrix.ruby }}
- name: Install dependencies
run: script/ci/install_deps
- name: Run tests
run: bundle exec rake
- name: Check Licenses
run: script/licensed status
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

10 changes: 6 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ If you can, try to reproduce the highlighting problem in the text editor that th

You can also try to fix the bug yourself and submit a pull-request.
[TextMate's documentation](https://manual.macromates.com/en/language_grammars) offers a good introduction on how to work with TextMate-compatible grammars.
Note that Linguist uses [PCRE](https://www.pcre.org/) regular expressions, while TextMate uses [Oniguruma](https://github.com/kkos/oniguruma).
Although they are mostly compatible there might be some differences in syntax and semantics between the two.
Note that Linguist uses [PCRE](https://www.pcre.org/) regular expressions, while TextMate uses [Oniguruma](https://github.com/kkos/oniguruma).
Although they are mostly compatible there might be some differences in syntax and semantics between the two.
You can test grammars using [Lightshow](https://github-lightshow.herokuapp.com).

Once the bug has been fixed upstream, we'll pick it up for GitHub in the next release of Linguist.
Expand Down Expand Up @@ -183,10 +183,10 @@ bundle exec rake test
```

Sometimes getting the tests running can be too much work, especially if you don't have much Ruby experience.
It's okay: be lazy and let our build bot [Travis](https://travis-ci.org/#!/github/linguist) run the tests for you.
It's okay: be lazy and let [GitHub Actions](https://github.com/features/actions) run the tests for you.
Just open a pull request and the bot will start cranking away.

Here's our current build status: [![Build Status](https://api.travis-ci.org/github/linguist.svg?branch=master)](https://travis-ci.org/github/linguist)
Here's our current build status: [![Actions Status](https://wdp9fww0r9.execute-api.us-west-2.amazonaws.com/production/badge/github/linguist)](https://wdp9fww0r9.execute-api.us-west-2.amazonaws.com/production/results/github/linguist)


## Maintainers
Expand Down Expand Up @@ -237,6 +237,7 @@ If you are the current maintainer of this gem:
1. Tag and push: `git tag vx.xx.xx; git push --tags`
1. Create a GitHub release with the pushed tag (https://github.com/github/linguist/releases/new) and populate it with a list of the commits from `git log --pretty=format:"- %s" --reverse refs/tags/[OLD TAG]...refs/tags/[NEW TAG]` [like this](https://github.com/github/linguist/releases/tag/v7.2.0)
1. Build a grammars tarball (`./script/build-grammars-tarball`) and attach it to the GitHub release
1. Push to rubygems.pkg.github.com -- `gem push --key github --host https://rubygems.pkg.github.com/github github-linguist-3.0.0.gem`. See [Configuring RubyGems for use with GitHub Package Registry][gpr] for more details.
1. Push to rubygems.org -- `gem push github-linguist-3.0.0.gem`


Expand All @@ -248,3 +249,4 @@ If you are the current maintainer of this gem:
[color proximity test]: https://github.com/github/linguist/blob/master/test/test_color_proximity.rb
[samples]: /samples
[search-example]: https://github.com/search?utf8=%E2%9C%93&q=extension%3Aboot+NOT+nothack&type=Code&ref=searchresults
[gpr]: https://help.github.com/en/articles/configuring-rubygems-for-use-with-github-package-registry
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Linguist

[![Build Status](https://travis-ci.org/github/linguist.svg?branch=master)](https://travis-ci.org/github/linguist)
[![Actions Status](https://wdp9fww0r9.execute-api.us-west-2.amazonaws.com/production/badge/github/linguist)](https://wdp9fww0r9.execute-api.us-west-2.amazonaws.com/production/results/github/linguist)

[issues]: https://github.com/github/linguist/issues
[new-issue]: https://github.com/github/linguist/issues/new
Expand Down Expand Up @@ -127,7 +127,7 @@ lib/linguist.rb

If the language stats bar is reporting a language that you don't expect:

1. Click on the name of the language in the stats bar to see a list of the files that are identified as that language.
1. Click on the name of the language in the stats bar to see a list of the files that are identified as that language.
Keep in mind this performs a search so the [code search restrictions][search-limits] may result in files identified in the language statistics not appearing in the search results.
[Installing Linguist locally](#usage) and running it from the [command line](#command-line-usage) will give you accurate results.
1. If you see files that you didn't write in the search results, consider moving the files into one of the [paths for vendored code](/lib/linguist/vendor.yml), or use the [manual overrides](#overrides) feature to ignore them.
Expand Down
3 changes: 3 additions & 0 deletions github-linguist.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ Gem::Specification.new do |s|
s.authors = "GitHub"
s.homepage = "https://github.com/github/linguist"
s.license = "MIT"
s.metadata = {
"github_repo" => "ssh://github.com/github/linguist"
}

s.files = Dir['lib/**/*'] + Dir['ext/**/*'] + Dir['grammars/*'] + ['LICENSE']
s.executables = ['github-linguist', 'git-linguist']
Expand Down
9 changes: 6 additions & 3 deletions script/travis/before_install → script/ci/install_deps
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/sh

set -ex
set -e

# As of 3 Jan 2019, Travis defaults to bundler 2.0 - https://docs.travis-ci.com/user/languages/ruby/#bundler-20
# Linguist still requires Bundler 1.x due to Licensed.
gem uninstall -v '>= 2' -ax bundler || true
gem install bundler -v '< 2'
Expand All @@ -11,8 +10,12 @@ gem install bundler -v '< 2'
git fetch origin master:master v2.0.0:v2.0.0 test/attributes:test/attributes test/master:test/master

# Replace SSH links to submodules by HTTPS links.
sed -i 's/[email protected]:/https:\/\/github.com\//' .gitmodules
sed -i 's|[email protected]:|https://github.com/|' .gitmodules

# Fetch all grammars
git submodule init
git submodule sync --quiet
script/fast-submodule-update

# Install dependent gems
bundle install --jobs 4 --retry 3 --without debug

0 comments on commit b475846

Please sign in to comment.