Skip to content

Commit

Permalink
Switch from Travis CI to GitHub Actions (#27)
Browse files Browse the repository at this point in the history
* Try installing a few deps

* Install Node, Ruby, and attach a Postgres instance

* Match the installed version of ruby with the one in ruby-version

* Use a clever method for finding the current ruby version

actions/setup-ruby#31 (comment)

* Oops, gotta checkout the code before reading the version

* Bump to the latest patch version of Ruby

* Bump the Gemfile too

* Health check the Postgres instance and split out the bundle step

* use the latest Postgres, reformat the heallth check

* Point Rails at the service container

* Switch back to port mapping postgres to the local machine

* Manually set up the postgres instance and use DATABASE_URL for telling Rails where to look

* Deploy using GitHub workflows

* Use secrets store

* Setup both api. and git. for Heroku

* Specify the Heroku app to deploy to

* Double check current config

* debug heroku auth

* Work that netrc

* try and preserve newlines when writing netrc

* Be extra specific with the GH branch we want to push

* Only deploy on master

* I read the docs

* Install specific node versions

* Cache Node Modules runs

* Cache Ruby dependencies

* Ditch Travis

Switch the build badge from Travis to GH Actions

ayy

wow

Clobber the remote ref

Fix a Gemfile Ruby version issue

Fetch the whole repository because Heroku wants it

Keep the Heroku app names secret and Deploy to Production
  • Loading branch information
waltz committed Mar 1, 2020
1 parent 1a54914 commit c5612a3
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 29 deletions.
106 changes: 106 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
on: [push]
jobs:
build:
name: Test
runs-on: ubuntu-latest

services:
postgres:
image: postgres
ports: ['5432:5432']
env:
POSTGRES_USER: test-a-bot
POSTGRES_PASSWORD: toot
POSTGRES_DATABASE: rubbish-heap

steps:
- name: Get Code
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install Dependencies
run: |
sudo apt-get install ffmpeg -y
sudo apt-get install youtube-dl
- name: Fetch Ruby Version
id: ruby_version
run: echo "::set-output name=RUBY_VERSION::$(cat .ruby-version)"

- name: Install Ruby
uses: actions/setup-ruby/@v1
with:
ruby-version: ${{ steps.ruby_version.outputs.RUBY_VERSION }}

- name: Fetch Node Version
id: node_version
run: echo "::set-output name=NODE_VERSION::$(cat .nvmrc)"

- name: Install Node
uses: actions/setup-node@v1
with:
node-version: ${{ steps.node_version.outputs.NODE_VERSION }}

- name: Fetch Yarn Cache Directory
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- name: Configure Yarn Cache
uses: actions/cache@v1
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Node Packages
run: yarn

- name: Configure Ruby Cache
uses: actions/cache@v1
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install Ruby Packages
run: |
gem install bundler
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Build and Test with Rake
env:
DATABASE_URL: postgres://test-a-bot:toot@localhost/rubbish-heap
RAILS_ENV: test
run: |
bundle exec rails db:setup
bundle exec rails test
- name: Write Heroku Credentials
env:
NETRC: |
machine api.heroku.com
login ${{ secrets.HEROKU_USER }}
password ${{ secrets.HEROKU_API_KEY }}
machine git.heroku.com
login ${{ secrets.HEROKU_USER }}
password ${{ secrets.HEROKU_API_KEY }}
run: echo $NETRC > ~/.netrc

- name: Push to Heroku, Staging
if: github.ref == 'refs/heads/master'
run: |
heroku git:remote --app ${{ secrets.STAGING_APP_NAME }}
git push --force heroku HEAD:master
- name: Push to Heroku, Production
if: github.ref == 'refs/heads/production'
run: |
heroku git:remote --app ${{ secrets.PRODUCTION_APP_NAME }}
git push --force heroku HEAD:master
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.3
2.6.5
25 changes: 0 additions & 25 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source 'https://rubygems.org'

ruby '2.6.3'
ruby '2.6.5'

gem 'rails', '5.2.3'

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ DEPENDENCIES
webpacker (~> 3.5)

RUBY VERSION
ruby 2.6.3p62
ruby 2.6.5p114

BUNDLED WITH
1.17.2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# [Imploder](http://imploder.xyz)

[![Build Status](https://travis-ci.org/waltz/imploder.svg?branch=master)](https://travis-ci.org/waltz/imploder)
![.github/workflows/test.yml](https://github.com/waltz/imploder/workflows/.github/workflows/test.yml/badge.svg)

Take your favorite GIF, mix in some audio from a YouTube track, and turn it
in to a short video.

0 comments on commit c5612a3

Please sign in to comment.