Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

h1.sh works #26

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.git/*
log/*
rails*
39 changes: 39 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Run CI

on:
push:
branches: [ main ]
workflow_dispatch:

jobs:
build-and-test:
runs-on: ubuntu-latest
steps:

- name: Checkout code
uses: actions/checkout@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Build Docker image
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
push: false
load: true
tags: ${{ github.event.repository.name }}:latest, ${{ github.repository }}:latest
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Run functional tests
run: go test -v ./...
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
log/*
tmp/*
rails6*
tmp/*
variables/*
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ FROM registry.gitlab.com/rubyonracetracks/docker-debian-bullseye-rvm-rails-neutr

ENV DEBIAN_FRONTEND=noninteractive

RUN sudo sed -i '/deb-src/d' /etc/apt/sources.list && \
sudo apt-get update && \
sudo apt-get install -y build-essential libsqlite3-dev sqlite3 tree graphviz
COPY ./ /home/winner/neutrino/

RUN sudo chown -R winner:winner /home/winner/neutrino && \
cd /home/winner/neutrino && bash build-rails.sh
40 changes: 18 additions & 22 deletions build-rails.sh
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
#!/bin/bash
set -e

DIR_MAIN=$PWD

# Basic parameters
BASE_APP_URL='' # Will be updated later if necessary
HOST_ENV=`cat tmp/host_env.txt`
ANNOTATE=`cat tmp/annotate.txt`
FROM_SCRATCH=`cat tmp/from_scratch.txt`
DOCKERIZE=`cat tmp/dockerize.txt`
ADD_LINT=`cat tmp/add_lint.txt`
ADD_VULNERABILITY_TESTS=`cat tmp/add_vulnerability_tests.txt`
ADD_STATIC_PAGES=`cat tmp/add_static_pages.txt`
ADD_OTHER=`cat tmp/add_other.txt`

# Preparation steps needed if this script was initiated in the host environment
HOST_ENV=`cat $DIR_MAIN/variables/host_env.txt`
ANNOTATE=`cat $DIR_MAIN/variables/annotate.txt`
FROM_SCRATCH=`cat $DIR_MAIN/variables/from_scratch.txt`
DOCKERIZE=`cat $DIR_MAIN/variables/dockerize.txt`
ADD_LINT=`cat $DIR_MAIN/variables/add_lint.txt`
ADD_VULNERABILITY_TESTS=`cat $DIR_MAIN/variables/add_vulnerability_tests.txt`
ADD_STATIC_PAGES=`cat $DIR_MAIN/variables/add_static_pages.txt`
ADD_OTHER=`cat $DIR_MAIN/variables/add_other.txt`

# Prepare Git credentials if not already provided
# This is necessary if the script was initiated from the host environment.
if [ "$HOST_ENV" = 'Y' ]
then
echo 'Automatcally setting Git credentials in Docker environment'

# Git credentials
GIT_EMAIL=`cat tmp/git_email.txt`
GIT_NAME=`cat tmp/git_name.txt`
git config --global user.email "$GIT_EMAIL"
git config --global user.name "$GIT_NAME"
else
# Git credentials
bash credentials.sh
git config --global user.email '[email protected]'
git config --global user.name 'Ruby on Racetracks'
fi

bash credentials.sh

# Display parameters
DIR_MAIN=$PWD
APP_NAME=`cat $DIR_MAIN/tmp/app_name.txt`
APP_NAME=`cat $DIR_MAIN/variables/app_name.txt`
DIR_APP=$DIR_MAIN/$APP_NAME

echo '---------'
Expand Down
12 changes: 0 additions & 12 deletions docker-compose.yml

This file was deleted.

25 changes: 13 additions & 12 deletions h1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,25 @@
set -e

bash credentials.sh
mkdir -p tmp
mkdir -p variables

RAILS_VERSION='6'
MODE='h1'
echo 'Y' > tmp/host_env.txt
echo 'N' > tmp/annotate.txt
echo 'Y' > variables/host_env.txt
echo 'N' > variables/annotate.txt

DATE=`date -u +%Y%m%d-%H%M%S-%3N`
APP_NAME="rails$RAILS_VERSION$MODE-$DATE"
echo "$DATE" > tmp/time_stamp.txt
echo "$APP_NAME" > tmp/app_name.txt
echo "$DATE" > variables/time_stamp.txt
echo "$APP_NAME" > variables/app_name.txt

echo 'Y' > tmp/from_scratch.txt
echo 'Y' > tmp/dockerize.txt
echo 'N' > tmp/add_lint.txt
echo 'N' > tmp/add_vulnerability_tests.txt
echo 'N' > tmp/add_static_pages.txt
echo 'N' > tmp/add_other.txt
echo 'Y' > variables/from_scratch.txt
echo 'Y' > variables/dockerize.txt
echo 'N' > variables/add_lint.txt
echo 'N' > variables/add_vulnerability_tests.txt
echo 'N' > variables/add_static_pages.txt
echo 'N' > variables/add_other.txt

mkdir -p log
bash start-docker.sh 2>&1 | tee log/$APP_NAME.txt
bash nukec.sh
docker build . 2>&1 | tee log/$APP_NAME.txt
22 changes: 11 additions & 11 deletions v1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
set -e

bash credentials.sh
mkdir -p tmp
mkdir -p tmp_vars

RAILS_VERSION='6'
MODE='v1'
echo 'N' > tmp/host_env.txt
echo 'N' > tmp/annotate.txt
echo 'N' > tmp_vars/host_env.txt
echo 'N' > tmp_vars/annotate.txt

DATE=`date -u +%Y%m%d-%H%M%S-%3N`
APP_NAME="rails$RAILS_VERSION$MODE-$DATE"
echo "$DATE" > tmp/time_stamp.txt
echo "$APP_NAME" > tmp/app_name.txt
echo "$DATE" > tmp_vars/time_stamp.txt
echo "$APP_NAME" > tmp_vars/app_name.txt

echo 'N' > tmp/from_scratch.txt
echo 'Y' > tmp/dockerize.txt
echo 'N' > tmp/add_lint.txt
echo 'N' > tmp/add_vulnerability_tests.txt
echo 'N' > tmp/add_static_pages.txt
echo 'N' > tmp/add_other.txt
echo 'N' > tmp_vars/from_scratch.txt
echo 'Y' > tmp_vars/dockerize.txt
echo 'N' > tmp_vars/add_lint.txt
echo 'N' > tmp_vars/add_vulnerability_tests.txt
echo 'N' > tmp_vars/add_static_pages.txt
echo 'N' > tmp_vars/add_other.txt

mkdir -p log
bash $PWD/build-rails.sh 2>&1 | tee log/$APP_NAME.txt