Skip to content

Commit

Permalink
refactor CI
Browse files Browse the repository at this point in the history
  • Loading branch information
whereismyjetpack authored and Banu Kutlu committed Sep 12, 2022
1 parent 975dc27 commit d7aa52f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
36 changes: 18 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
version: 2.1

orbs:
docker: circleci/docker@1.5.0
browser-tools: circleci/browser-tools@1.4.0
docker: circleci/docker@2.1.2

jobs:
release:
Expand Down Expand Up @@ -30,18 +29,29 @@ jobs:
user: root
steps:
- setup_remote_docker:
version: 19.03.13
version: 20.10.14
- checkout
- docker/check:
registry: harbor.k8s.libraries.psu.edu
- docker/build:
cache_from: harbor.k8s.libraries.psu.edu/library/myaccount:cache
image: library/myaccount
registry: harbor.k8s.libraries.psu.edu
use-buildkit: true
tag: "cache,$CIRCLE_SHA1"
extra_build_args: "--target production"
- docker/build:
cache_from: harbor.k8s.libraries.psu.edu/library/myaccount:ci
image: library/myaccount
registry: harbor.k8s.libraries.psu.edu
use-buildkit: true
tag: ci
extra_build_args: "--target ci"
- docker/push:
digest-path: /tmp/digest.txt
image: library/myaccount
registry: harbor.k8s.libraries.psu.edu
tag: "$CIRCLE_SHA1,ci,cache"
- run:
command: |
echo "Digest is: $(</tmp/digest.txt)"
Expand All @@ -61,20 +71,15 @@ jobs:
./bin/generate_app
test:
docker:
- image: cimg/ruby:2.7.6-browsers
- image: harbor.k8s.libraries.psu.edu/library/myaccount:ci
- image: redis:7.0.4-alpine3.16
environment:
RAILS_ENV: test
steps:
- browser-tools/install-chrome
- browser-tools/install-chromedriver
- checkout
- restore_cache:
keys:
- bundle-{{ checksum "Gemfile.lock" }}
- run:
name: "Wait for Redis"
command: dockerize -wait tcp://localhost:6379 -timeout 1m
- bundle-{{ checksum "Gemfile.lock" }}-v3
- run:
name: "Bundle"
command: |
Expand All @@ -83,16 +88,16 @@ jobs:
- save_cache:
paths:
- vendor/bundle
key: bundle-{{ checksum "Gemfile.lock" }}
key: bundle-{{ checksum "Gemfile.lock" }}-v3
- restore_cache:
keys:
- yarn-{{ checksum "yarn.lock" }}
- yarn-{{ checksum "yarn.lock" }}-v3
- run:
name: "Yarn"
command: |
yarn install --cache-folder ~/.cache/yarn --frozen-lockfile
- save_cache:
key: yarn-{{ checksum "yarn.lock" }}
key: yarn-{{ checksum "yarn.lock" }}-v3
paths:
- ~/.cache/yarn
- run:
Expand Down Expand Up @@ -134,11 +139,6 @@ workflows:
- publish:
context:
- org-global
filters:
branches:
only:
- main
- /preview\/.*/
- deploy:
context:
- org-global
Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ RUN RAILS_ENV=production \
CMD ["/app/bin/start"]


FROM base as test
FROM base as ci

USER root
RUN wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
Expand All @@ -43,6 +43,8 @@ RUN apt-get update && apt-get install -y x11vnc \

USER app

FROM ci as test

RUN bundle

CMD ["sleep", "99999999"]
Expand Down

0 comments on commit d7aa52f

Please sign in to comment.