Skip to content

Commit

Permalink
chore: switch from circle ci to github actions (nolanlawson#2253)
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanlawson authored Nov 25, 2022
1 parent 0e4523a commit fda00fc
Show file tree
Hide file tree
Showing 13 changed files with 176 additions and 223 deletions.
212 changes: 0 additions & 212 deletions .circleci/config.yml

This file was deleted.

65 changes: 65 additions & 0 deletions .github/workflows/e2e-tests-readonly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Read-only e2e tests
on:
pull_request:
branches: [ master ]
jobs:
test:
runs-on: ubuntu-18.04
services:
postgres:
image: postgres:12.2
env:
POSTGRES_USER: pinafore
POSTGRES_PASSWORD: pinafore
POSTGRES_DB: pinafore_development
POSTGRES_HOST: 127.0.0.1
POSTGRES_PORT: 5432
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis:5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0.3'
- name: Cache Mastodon bundler
uses: actions/cache@v3
with:
path: ~/.bundle-vendor-cache
# cache based on masto version implicitly defined in mastodon-config.js
key: masto-bundler-v3-${{ hashFiles('bin/mastodon-config.js') }}
- name: Cache Mastodon's and our yarn
uses: actions/cache@v3
with:
path: ~/.cache/yarn
# cache based on our version and masto version implicitly defined in mastodon-config.js
# because we share the yarn cache
key: masto-yarn-v1-${{ hashFiles('yarn.lock') }}-${{ hashFiles('bin/mastodon-config.js') }}
- name: Install Mastodon system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
ffmpeg \
fonts-noto-color-emoji \
imagemagick \
libicu-dev \
libidn11-dev \
libprotobuf-dev \
postgresql-contrib \
protobuf-compiler
- run: yarn --frozen-lockfile
- run: yarn build
- run: yarn clone-mastodon
- name: Move bundler cache so Mastodon can find it
run: if [ -d ~/.bundle-vendor-cache ]; then mkdir -p ./mastodon/vendor && mv ~/.bundle-vendor-cache ./mastodon/vendor/bundle; fi
- name: Read-only e2e tests
run: yarn test-in-ci-suite0
- name: Move bundler cache so GitHub Actions can find it
run: mv ./mastodon/vendor/bundle ~/.bundle-vendor-cache
65 changes: 65 additions & 0 deletions .github/workflows/e2e-tests-readwrite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Read-write e2e tests
on:
pull_request:
branches: [ master ]
jobs:
test:
runs-on: ubuntu-18.04
services:
postgres:
image: postgres:12.2
env:
POSTGRES_USER: pinafore
POSTGRES_PASSWORD: pinafore
POSTGRES_DB: pinafore_development
POSTGRES_HOST: 127.0.0.1
POSTGRES_PORT: 5432
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
redis:
image: redis:5
ports:
- 6379:6379
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0.3'
- name: Cache Mastodon bundler
uses: actions/cache@v3
with:
path: ~/.bundle-vendor-cache
# cache based on masto version implicitly defined in mastodon-config.js
key: masto-bundler-v3-${{ hashFiles('bin/mastodon-config.js') }}
- name: Cache Mastodon's and our yarn
uses: actions/cache@v3
with:
path: ~/.cache/yarn
# cache based on our version and masto version implicitly defined in mastodon-config.js
# because we share the yarn cache
key: masto-yarn-v1-${{ hashFiles('yarn.lock') }}-${{ hashFiles('bin/mastodon-config.js') }}
- name: Install Mastodon system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
ffmpeg \
fonts-noto-color-emoji \
imagemagick \
libicu-dev \
libidn11-dev \
libprotobuf-dev \
postgresql-contrib \
protobuf-compiler
- run: yarn --frozen-lockfile
- run: yarn build
- run: yarn clone-mastodon
- name: Move bundler cache so Mastodon can find it
run: if [ -d ~/.bundle-vendor-cache ]; then mkdir -p ./mastodon/vendor && mv ~/.bundle-vendor-cache ./mastodon/vendor/bundle; fi
- name: Read-write e2e tests
run: yarn test-in-ci-suite1
- name: Move bundler cache so GitHub Actions can find it
run: mv ./mastodon/vendor/bundle ~/.bundle-vendor-cache
17 changes: 17 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Unit tests
on:
pull_request:
branches: [ master ]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
cache: 'yarn'
- run: yarn --frozen-lockfile
- run: yarn lint
- run: yarn test-vercel-json
- run: yarn test-unit
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ or

1. Run `rm -fr mastodon` to clear out all Mastodon data
1. Comment out `await restoreMastodonData()` in `run-mastodon.js` to avoid actually populating the database with statuses/favorites/etc.
2. Update the `GIT_TAG_OR_BRANCH` in `clone-mastodon.js` to whatever you want
3. If the Ruby version changed (check Mastodon's `.ruby-version`), install it and update `RUBY_VERSION` in `mastodon-config.js` as well as the Ruby version in `.circleci/config.yml`.
2. Update the `GIT_TAG` in `mastodon-config.js` to whatever you want
3. If the Ruby version changed (check Mastodon's `.ruby-version`), install it and update `RUBY_VERSION` in `mastodon-config.js` as well as the Ruby version in `.github/workflows`.
4. Run `yarn run-mastodon`
5. Run `yarn backup-mastodon-data` to overwrite the data in `fixtures/`
6. Uncomment `await restoreMastodonData()` in `run-mastodon.js`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Pinafore [![Build status](https://circleci.com/gh/nolanlawson/pinafore.svg?style=svg)](https://app.circleci.com/pipelines/gh/nolanlawson/pinafore)
# Pinafore

An alternative web client for [Mastodon](https://joinmastodon.org), focused on speed and simplicity.

Expand Down
5 changes: 1 addition & 4 deletions bin/clone-mastodon.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { promisify } from 'util'
import childProcessPromise from 'child-process-promise'
import path from 'path'
import fs from 'fs'
import { envFile, RUBY_VERSION } from './mastodon-config.js'
import { envFile, GIT_TAG, GIT_URL, RUBY_VERSION } from './mastodon-config.js'
import esMain from 'es-main'

const exec = childProcessPromise.exec
Expand All @@ -11,9 +11,6 @@ const writeFile = promisify(fs.writeFile)
const __dirname = path.dirname(new URL(import.meta.url).pathname)
const dir = __dirname

const GIT_URL = 'https://github.com/tootsuite/mastodon.git'
const GIT_TAG = 'v3.5.3'

const mastodonDir = path.join(dir, '../mastodon')

export default async function cloneMastodon () {
Expand Down
Loading

0 comments on commit fda00fc

Please sign in to comment.