Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Improve CI #124

Merged
merged 5 commits into from
Feb 8, 2024
Merged
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
58 changes: 30 additions & 28 deletions .github/workflows/validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,56 @@ name: validation
on: push

jobs:
test_ruby:
lint-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout Redmine
uses: actions/checkout@v4
with:
repository: redmine/redmine
path: redmine
ref: 5.1-stable

- name: Checkout Tracky
uses: actions/checkout@v4
with:
repository: renuo/redmine_tracky
path: redmine/plugins/redmine_tracky
path: plugins/redmine_tracky

- name: Install Ruby
- name: Cache gems
uses: actions/cache@v3
with:
path: vendor/bundle
key: gems-${{ hashFiles('Gemfile', 'plugins/redmine_tracky/PluginGemfile.lock') }}

- name: Cache Node modules
uses: actions/cache@v3
with:
path: plugins/redmine_tracky/assets.src/node_modules
key: npm-${{ hashFiles('plugins/redmine_tracky/assets.src/package-lock.json') }}

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1.2'

- name: Start MySQL and update gems
run: gem update --system && sudo service mysql start
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: latest

- name: Start MySQL
run: sudo service mysql start

- name: Setup Tracky
run: cd redmine/plugins/redmine_tracky && ./bin/setup
working-directory: plugins/redmine_tracky
run: bin/setup
env:
GITHUB_ACTIONS: true

- name: Lint
run: cd redmine/plugins/redmine_tracky && rake lint_ruby
- name: Run linters
working-directory: plugins/redmine_tracky
run: rake lint

- name: Run tests
run: cd redmine && rake test TEST=plugins/redmine_tracky

check_javascript:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install node
uses: actions/setup-node@v4
with:
node-version: latest

- name: Install node modules
working-directory: ./assets.src
run: npm install

- name: Lint
run: rake lint_javascript
working-directory: plugins/redmine_tracky
run: rake test
11 changes: 5 additions & 6 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
cp -n .ruby-version ../../.ruby-version

# Install Dependencies
[[ -v GITHUB_ACTIONS ]] && bundle config set --local path vendor/bundle
BUNDLE_GEMFILE=PluginGemfile bundle install -j 4
cd assets.src
npm install
npm run build
cd ../../..

# Configure Database
db=plugins/redmine_tracky/.github/database.yml
[[ -z "$GITHUB_ACTIONS" ]] && db=config/database.yml.example
db=config/database.yml.example
[[ -v GITHUB_ACTIONS ]] && db=plugins/redmine_tracky/.github/database.yml
cp -n $db config/database.yml

bundle install -j 4
[[ -z "$GITHUB_ACTIONS" ]] && rake db:drop
rake db:create db:migrate db:seed
rake redmine:sample_data:seed
rake redmine:plugins:redmine_tracky:install
bundle exec rake db:create db:migrate db:seed redmine:sample_data:seed
bundle exec rake redmine:plugins:redmine_tracky:install
Loading