Skip to content

Commit 486d593

Browse files
authored
Switch from Travis CI to GitHub Actions (#27) (#29)
* 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
1 parent 1a54914 commit 486d593

File tree

6 files changed

+110
-29
lines changed

6 files changed

+110
-29
lines changed

.github/workflows/test.yml

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
on: [push]
2+
jobs:
3+
build:
4+
name: Test
5+
runs-on: ubuntu-latest
6+
7+
services:
8+
postgres:
9+
image: postgres
10+
ports: ['5432:5432']
11+
env:
12+
POSTGRES_USER: test-a-bot
13+
POSTGRES_PASSWORD: toot
14+
POSTGRES_DATABASE: rubbish-heap
15+
16+
steps:
17+
- name: Get Code
18+
uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Install Dependencies
23+
run: |
24+
sudo apt-get install ffmpeg -y
25+
sudo apt-get install youtube-dl
26+
27+
- name: Fetch Ruby Version
28+
id: ruby_version
29+
run: echo "::set-output name=RUBY_VERSION::$(cat .ruby-version)"
30+
31+
- name: Install Ruby
32+
uses: actions/setup-ruby/@v1
33+
with:
34+
ruby-version: ${{ steps.ruby_version.outputs.RUBY_VERSION }}
35+
36+
- name: Fetch Node Version
37+
id: node_version
38+
run: echo "::set-output name=NODE_VERSION::$(cat .nvmrc)"
39+
40+
- name: Install Node
41+
uses: actions/setup-node@v1
42+
with:
43+
node-version: ${{ steps.node_version.outputs.NODE_VERSION }}
44+
45+
- name: Fetch Yarn Cache Directory
46+
id: yarn-cache-dir-path
47+
run: echo "::set-output name=dir::$(yarn cache dir)"
48+
49+
- name: Configure Yarn Cache
50+
uses: actions/cache@v1
51+
id: yarn-cache
52+
with:
53+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
54+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
55+
restore-keys: |
56+
${{ runner.os }}-yarn-
57+
58+
- name: Install Node Packages
59+
run: yarn
60+
61+
- name: Configure Ruby Cache
62+
uses: actions/cache@v1
63+
with:
64+
path: vendor/bundle
65+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
66+
restore-keys: |
67+
${{ runner.os }}-gems-
68+
69+
- name: Install Ruby Packages
70+
run: |
71+
gem install bundler
72+
bundle config path vendor/bundle
73+
bundle install --jobs 4 --retry 3
74+
75+
- name: Build and Test with Rake
76+
env:
77+
DATABASE_URL: postgres://test-a-bot:toot@localhost/rubbish-heap
78+
RAILS_ENV: test
79+
run: |
80+
bundle exec rails db:setup
81+
bundle exec rails test
82+
83+
- name: Write Heroku Credentials
84+
env:
85+
NETRC: |
86+
machine api.heroku.com
87+
login ${{ secrets.HEROKU_USER }}
88+
password ${{ secrets.HEROKU_API_KEY }}
89+
90+
machine git.heroku.com
91+
login ${{ secrets.HEROKU_USER }}
92+
password ${{ secrets.HEROKU_API_KEY }}
93+
94+
run: echo $NETRC > ~/.netrc
95+
96+
- name: Push to Heroku, Staging
97+
if: github.ref == 'refs/heads/master'
98+
run: |
99+
heroku git:remote --app ${{ secrets.STAGING_APP_NAME }}
100+
git push --force heroku HEAD:master
101+
102+
- name: Push to Heroku, Production
103+
if: github.ref == 'refs/heads/production'
104+
run: |
105+
heroku git:remote --app ${{ secrets.PRODUCTION_APP_NAME }}
106+
git push --force heroku HEAD:master

.ruby-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.6.3
1+
2.6.5

.travis.yml

-25
This file was deleted.

Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
source 'https://rubygems.org'
22

3-
ruby '2.6.3'
3+
ruby '2.6.5'
44

55
gem 'rails', '5.2.3'
66

Gemfile.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ DEPENDENCIES
289289
webpacker (~> 3.5)
290290

291291
RUBY VERSION
292-
ruby 2.6.3p62
292+
ruby 2.6.5p114
293293

294294
BUNDLED WITH
295295
1.17.2

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# [Imploder](http://imploder.xyz)
22

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

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

0 commit comments

Comments
 (0)