enhance tasks #33
Workflow file for this run
This file contains 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
name: Test and Release | |
on: | |
pull_request: | |
push: | |
paths: | |
- .github/** | |
- lib/** | |
- spec/** | |
- Gemfile | |
- Rakefile | |
- compose.yml | |
- replica_pools.gemspec | |
release: | |
types: | |
- published | |
jobs: | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ruby: | |
- "2.7" | |
- "3.1" | |
- "3.2" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
- run: docker compose up --detach | |
- run: bundle install --jobs 4 --retry 3 | |
- run: bundle exec rake bootstrap | |
- run: bundle exec rake spec | |
push: | |
name: Publish Gem | |
if: ${{ github.event.release }} | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.2" | |
# The kickstarter/actions/setup-rubygems action is not available | |
# because this is a public repo | |
- name: setup-rubygems | |
run: | | |
mkdir -p ~/.gem | |
cat <<-YAML > ~/.gem/credentials | |
--- | |
:rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }} | |
YAML | |
chmod 0600 ~/.gem/credentials | |
- run: bundle install | |
- run: bundle exec rake release |