Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade ruby and migrate to Github actions (#7)
* Upgrade ruby from 2.3 to 2.7 * Add GH action to run tests & publish to Coveralls * Remove support for ruby 2.4 * Add GH action to release to rubygems * Fix dependency versioning * Add GH action to build/push docker image * Rename docker repo prefix after moving to GH
- Loading branch information
Showing
12 changed files
with
199 additions
and
59 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: rspec-tests | ||
description: Composite action for rspec tests | ||
inputs: | ||
github-token: | ||
required: true | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Install bundler | ||
shell: bash | ||
# The bundler version used must match the one in the repo's gemspec | ||
run: gem install bundler:2.2.19 | ||
- name: Bundle dependencies | ||
shell: bash | ||
run: bundle | ||
- name: Run rspec tests | ||
shell: bash | ||
env: | ||
CI: true | ||
run: bundle exec rspec | ||
- name: Use coveralls | ||
uses: coverallsapp/github-action@1.1.3 | ||
with: | ||
github-token: ${{ inputs.github-token }} | ||
path-to-lcov: 'coverage/lcov.info' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- v* | ||
|
||
env: | ||
IMAGE_NAME: hammady/scaltainer | ||
|
||
jobs: | ||
docker: | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'push' | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Determine target image name | ||
id: image-name | ||
run: | | ||
IMAGE_ID=ghcr.io/$IMAGE_NAME | ||
# Strip git ref prefix from version | ||
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | ||
# Strip "v" prefix from tag name | ||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') | ||
# Use Docker `latest` tag convention | ||
[ "$VERSION" == "master" ] && VERSION=latest | ||
IMAGES= | ||
IMAGES="$IMAGE_ID:$VERSION"$'\n'$IMAGES | ||
# debug output | ||
echo images $IMAGES | ||
echo ::set-output name=images::"$IMAGES" | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64,linux/arm/v7 | ||
push: true | ||
tags: ${{ steps.image-name.outputs.images }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Release | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '2.7' | ||
- name: Install bundler | ||
shell: bash | ||
# The bundler version used must match the one in the repo's gemspec | ||
run: gem install bundler:2.2.19 | ||
- name: Bundle dependencies | ||
shell: bash | ||
run: bundle | ||
- name: Release gem | ||
shell: bash | ||
env: | ||
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} | ||
run: ./publish.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: 'Test' | ||
on: | ||
push: | ||
branches: | ||
- master | ||
tags: | ||
- v* | ||
pull_request: | ||
types: [opened, reopened, edited, synchronize] | ||
jobs: | ||
test: | ||
strategy: | ||
matrix: | ||
ruby_version: [2.5, 2.6, 2.7] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: '${{ matrix.ruby_version }}' | ||
- name: Run rspec tests | ||
uses: ./.github/actions/rspec_tests | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Scaltainer | ||
VERSION = "0.5.0" | ||
VERSION = "0.6.0" | ||
end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
if [ ! -z "$RUBYGEMS_API_KEY" ]; then | ||
mkdir $HOME/.gem | ||
creds="$HOME/.gem/credentials" | ||
echo -e "---\n:rubygems_api_key: $RUBYGEMS_API_KEY" > $creds | ||
chmod 0600 $creds | ||
fi | ||
|
||
gem build scaltainer.gemspec | ||
gem push scaltainer*.gem |
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
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