Skip to content

Commit

Permalink
GitHub Actionsのワークフローを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
jiro4989 committed Nov 28, 2019
1 parent 4e833c9 commit eef3917
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 3 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: build

on: [push]

jobs:
build-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Cache ubuntu image
id: cache-ubuntu-image
uses: actions/cache@v1
with:
path: ~/docker-cache
key: ${{ runner.os }}-docker-ubuntu-${{ hashFiles('**/Dockerfile') }}
- name: Load docker image
if: steps.cache-ubuntu-image.outputs.cache-hit == 'true'
run: |
gunzip ~/docker-cache/ubuntu.gz
docker load -i ~/docker-cache/ubuntu
- name: Build docker base image
run: docker-compose -f docker-compose-ci.yml build base
- name: Save docker ubuntu image to cache directory
run: |
mkdir -p ~/docker-cache
docker save ubuntu:18.04 | gzip -c > ~/docker-cache/ubuntu.gz
release:
runs-on: ubuntu-latest
needs: build-image
steps:
- uses: actions/checkout@v1
- name: Cache ubuntu image
id: cache-ubuntu-image
uses: actions/cache@v1
with:
path: ~/docker-cache
key: ${{ runner.os }}-docker-ubuntu-${{ hashFiles('**/Dockerfile') }}
- name: Load docker image
if: steps.cache-ubuntu-image.outputs.cache-hit == 'true'
run: |
gunzip ~/docker-cache/ubuntu.gz
docker load -i ~/docker-cache/ubuntu
- name: Build shellgei-web command
run: |
mkdir -p out
docker-compose -f docker-compose-ci.yml run --rm build
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: bin/shellgei_web
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build:
env:
NIM_VERSION: 1.0.2
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Cache choosenim
id: cache-choosenim
uses: actions/cache@v1
with:
path: ~/.choosenim
key: ${{ runner.os }}-choosenim-${{ env.NIM_VERSION }}
- name: Cache nimble
id: cache-nimble
uses: actions/cache@v1
with:
path: ~/.nimble
key: ${{ runner.os }}-nimble-${{ hashFiles('*.nimble') }}
- uses: jiro4989/[email protected]
- name: Build
run: nimble build -Y

6 changes: 4 additions & 2 deletions build/api/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ RUN apt-get update -yqq \
ca-certificates \
curl \
build-essential \
git \
;

ENV PATH $HOME/.nimble/bin:$PATH
ENV PATH /root/.nimble/bin:$PATH
RUN curl https://nim-lang.org/choosenim/init.sh -sSf > init.sh
RUN sh init.sh -y
RUN sh init.sh -y \
&& choosenim update stable
17 changes: 16 additions & 1 deletion docker-compose-ci.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
version: '3.7'

services:
app:
base:
build:
context: .
dockerfile: ./build/api/Dockerfile
image: base

build:
image: base
volumes:
- ".:/work"
- "./out:/work/bin"
working_dir: /work
entrypoint:
- nimble
- build
- -d:release
- -Y
depends_on:
- base

0 comments on commit eef3917

Please sign in to comment.