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

GitHub Actions #216

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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
152 changes: 0 additions & 152 deletions .circleci/config.yml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/github-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: "Github Pages"

on:
push:
branches:
- main
tags:
- v*

jobs:
pages:
name: Github Pages
runs-on: ubuntu-latest
env:
api-dir: ./

strategy:
fail-fast: false

steps:
- name: Checkout repository for Yard
uses: actions/checkout@v3
with:
path: discordrb_docs

- name: Install OS package
run: |
sudo apt update
sudo apt install -y git openssh-client

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

- name: Checkout repository for Github Pages
uses: actions/checkout@v3
with:
path: discordrb_gh
ref: gh-pages

- name: Run bundle install
working-directory: ${{env.api-dir}}
run: |
gem install bundler
BUNDLE_GEMFILE=discordrb_docs/Gemfile bundle install --jobs 4 --retry 3

- name: Generate Yard docs
working-directory: ${{env.api-dir}}
run: |
cd discordrb_docs
bundle exec yard --output-dir /tmp/docs

- name: Commit & Push docs
run: |
cd discordrb_gh
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
mkdir -p $GITHUB_REF_NAME
rm -rf $GITHUB_REF_NAME/*
cp -r /tmp/docs/. $GITHUB_REF_NAME
git add $GITHUB_REF_NAME
git commit --allow-empty -m "[skip ci] Deploy docs"
git push
53 changes: 53 additions & 0 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: "RSpec"

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
rspec:
name: RSpec
runs-on: ubuntu-latest
env:
api-dir: ./

strategy:
fail-fast: false
matrix:
versions: [ '2.7', '3.0', '3.1', '3.2', '3.3' ]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup libraries
run: |
sudo apt update
sudo apt install -y libsodium-dev

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

- name: Run bundle install (Ruby ${{ matrix.versions }})
working-directory: ${{env.api-dir}}
run: |
gem install bundler
bundle install --jobs 4 --retry 3

- name: RSpec spec (Ruby ${{ matrix.versions }})
working-directory: ${{env.api-dir}}
run: bundle exec rspec spec --format progress --format RspecJunitFormatter -o ~/rspec/rspec.xml

- name: Save test results (Ruby ${{ matrix.versions }})
uses: actions/upload-artifact@v3
with:
name: rspec_results_${{ matrix.versions }}
path: ~/rspec/rspec.xml
retention-days: 30
39 changes: 39 additions & 0 deletions .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "RuboCop"

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
rubocop:
name: RuboCop
runs-on: ubuntu-latest
env:
api-dir: ./

strategy:
fail-fast: false

steps:
- name: Checkout repository
uses: actions/checkout@v3

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

- name: Run bundle install
working-directory: ${{env.api-dir}}
run: |
gem install bundler
bundle install --jobs 4 --retry 3

- name: RuboCop checks
working-directory: ${{env.api-dir}}
run: bundle exec rubocop
51 changes: 51 additions & 0 deletions .github/workflows/yard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "Yard"

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
yard:
name: Yard
runs-on: ubuntu-latest
env:
api-dir: ./

strategy:
fail-fast: false

steps:
- name: Checkout repository
uses: actions/checkout@v3

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

- name: Run bundle install
working-directory: ${{env.api-dir}}
run: |
gem install bundler
bundle install --jobs 4 --retry 3

- name: Generate Yard docs
working-directory: ${{env.api-dir}}
run: bundle exec yard --output-dir /tmp/docs

- name: Compress docs to prevent error 429
run: |
cd /tmp/docs
tar -cvf /tmp/docs.tar .

- name: Keep temporary the generated docs
uses: actions/upload-artifact@v3
with:
name: docs_${{ github.run_number }}
path: /tmp/docs.tar
retention-days: 30
Loading
Loading