Last active
April 27, 2020 21:48
-
-
Save stephendolan/f04ca7fafaa5b46c83946668e2bd2fbf to your computer and use it in GitHub Desktop.
GitHub Action - Lucky Setup and Spec
This file contains hidden or 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: Lucky Build and Spec CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
LUCKY_ENV: test | |
DB_HOST: postgres | |
container: | |
image: crystallang/crystal | |
services: | |
postgres: | |
image: postgres:12-alpine | |
env: | |
POSTGRES_PASSWORD: postgres | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Install Node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '12.x' | |
- name: Set up system prerequisites | |
run: | |
apt-get update | |
&& apt-get install -y git libc6-dev libevent-dev libpcre2-dev libpng-dev libnss3-dev libssl-dev libyaml-dev zlib1g-dev postgresql-client curl wget | |
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - | |
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list | |
&& apt-get update | |
&& apt-get install -y yarn | |
- name: Install Chrome | |
run: | | |
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb | |
apt install -y ./google-chrome-stable_current_amd64.deb | |
- name: Install Lucky | |
run: | |
git clone https://github.com/luckyframework/lucky_cli | |
&& cd lucky_cli | |
&& git checkout v0.21.0 | |
&& shards install | |
&& crystal build src/lucky.cr | |
&& mv lucky /usr/local/bin | |
- uses: actions/checkout@v2 | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: echo "::set-output name=dir::$(yarn cache dir)" | |
- name: Set up 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: Set up Crystal cache | |
uses: actions/cache@v1 | |
id: crystal-cache | |
with: | |
path: lib | |
key: ${{ runner.os }}-crystal-${{ hashFiles('**/shard.lock') }} | |
restore_keys: | | |
${{ runner.os }}-crystal- | |
- name: Run Lucky setup script | |
run: ./script/setup | |
- name: Run tests | |
run: crystal spec |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment