Skip to content

Commit

Permalink
Merge pull request #6 from apainintheneck/add-github-actions
Browse files Browse the repository at this point in the history
Add github actions
  • Loading branch information
apainintheneck authored Nov 18, 2023
2 parents 41aeecf + f1a20e6 commit a921286
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 14 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Docs
on:
push:
branches: master
pull_request:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- name: Set up Git repository
uses: actions/checkout@main

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true

- name: Outdated readme check
run: bundle exec rake readme:outdated
27 changes: 27 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: CI
on:
push:
branches: master
pull_request:
jobs:
tests:
strategy:
matrix:
platform: ["ubuntu-latest", "macos-latest"]
ruby: [2.7, 3.0, 3.1, 3.2]
runs-on: ${{ matrix.platform }}
steps:
- name: Set up Git repository
uses: actions/checkout@main

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Run linter
run: bundle exec rake lint

- name: Run tests
run: bundle exec rake test
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ GEM
unicode_utils (1.4.0)

PLATFORMS
x86_64-darwin-19
ruby

DEPENDENCIES
atlasq!
Expand Down
8 changes: 5 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@ desc "Shortcut for `rake rubocop:autocorrect`"
task fix: :"rubocop:autocorrect"

namespace "readme" do
desc "Check if the readme needs to be regenerated"
task :outdated do
Tempfile.open("readme") do |file|
sh "bin/generate_readme > #{ file.path }"
sh "diff -q README.md #{ file.path }"
sh "bin/generate_readme > #{file.path}"
sh "diff -q README.md #{file.path}"
end
end

desc "Regenerate the readme"
task :generate do
Tempfile.open("readme") do |file|
sh "bin/generate_readme > #{ file.path }"
sh "bin/generate_readme > #{file.path}"
mv file.path, "README.md"
end
end
Expand Down
20 changes: 10 additions & 10 deletions bin/generate_readme
Original file line number Diff line number Diff line change
Expand Up @@ -22,53 +22,53 @@ puts <<~README
Query for country info at the command line.
```console
#{ atlasq }
#{atlasq}
```
## Documentation
```console
#{ atlasq "--help" }
#{atlasq "--help"}
```
## Examples
### Countries
```console
#{ atlasq "--country", "418" }
#{atlasq "--country", "418"}
```
```console
#{ atlasq "--country", "AM" }
#{atlasq "--country", "AM"}
```
```console
#{ atlasq "--country", "honduras" }
#{atlasq "--country", "honduras"}
```
### Regions
```console
#{ atlasq "--region", "melanesia" }
#{atlasq "--region", "melanesia"}
```
```console
#{ atlasq "--region", "antarctica" }
#{atlasq "--region", "antarctica"}
```
### Currencies
```console
#{ atlasq "--money", "ANG" }
#{atlasq "--money", "ANG"}
```
```console
#{ atlasq "--money", "฿" }
#{atlasq "--money", "฿"}
```
```console
#{ atlasq "--money", "Surinamese Dollar" }
#{atlasq "--money", "Surinamese Dollar"}
```
## Development
Expand Down
3 changes: 3 additions & 0 deletions exe/atlasq
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ debug = true if ARGV.delete("-d")
debug = true if ARGV.delete("--debug")
ENV["ATLASQ_DEBUG"] = "1" if debug

# Avoid warnings on Ruby 2.7 related to pattern matching.
Warning[:experimental] = false

$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "atlasq"

Expand Down
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

# Avoid accidental debug output causing test failures.
ENV.delete("ATLASQ_DEBUG")

$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
Expand Down

0 comments on commit a921286

Please sign in to comment.