Skip to content

Commit e6cd848

Browse files
authored
feat(ci-checks): add workflow to run rspec and jest on PR (#1404)
1 parent cb39796 commit e6cd848

File tree

56 files changed

+265
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+265
-104
lines changed

.github/pull_request_template.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Summary
2+
3+
<!-- Provide a short summary explaining the purpose of this pull request. -->
4+
5+
# Changes Made
6+
7+
<!-- List the changes that were made in this pull request. -->
8+
9+
- Change 1
10+
- Change 2
11+
- Change 3
12+
13+
# Related Issues
14+
15+
<!-- List any related issues or tickets, including links to them. -->
16+
17+
- Issue 1: #ISSUE_ID
18+
19+
# Screenshots (if applicable)
20+
21+
<!-- If there are any visual changes, provide screenshots or GIFs. -->
22+
23+
# Checklist
24+
25+
<!-- Ensure that your pull request meets the following requirements. -->
26+
27+
- [ ] I have performed a self-review of my code.
28+
- [ ] I have commented my code, particularly in hard-to-understand areas.
29+
- [ ] I have added tests that prove my fix is effective or that my feature works.
30+
- [ ] New and existing unit tests pass locally with my changes.
31+
- [ ] I have made corresponding changes to the documentation (if applicable).
32+
- [ ] My changes generate no new warnings or errors.

.github/workflows/ci-checks.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: CI Check
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- synchronize
8+
- reopened
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
container:
14+
image: ruby:3.2
15+
16+
services:
17+
postgres:
18+
image: postgres:16
19+
env:
20+
POSTGRES_USER: postgres
21+
POSTGRES_PASSWORD: "postgres"
22+
POSTGRES_DB: postgres
23+
POSTGRES_HOST_AUTH_METHOD: trust
24+
ports:
25+
- 5432:5432
26+
# needed because the postgres container does not provide a healthcheck
27+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
28+
29+
steps:
30+
- uses: actions/checkout@v1
31+
32+
- uses: actions/setup-node@v1
33+
with:
34+
node-version: '20'
35+
registry-url: 'https://registry.npmjs.org'
36+
37+
- name: Gem cache
38+
id: cache-bundle
39+
uses: actions/cache@v1
40+
with:
41+
path: vendor/bundle
42+
key: bundle-${{ hashFiles('**/Gemfile.lock') }}
43+
44+
- name: Bundle install
45+
env:
46+
RAILS_ENV: test
47+
run: |
48+
gem install bundler
49+
bundle install --jobs 4 --retry 3 --path vendor/bundle
50+
- name: Install yarn
51+
run: npm install -g yarn
52+
53+
- name: Get yarn cache dir
54+
id: yarn-cache-dir
55+
run: echo "::set-output name=dir::$(yarn cache dir)"
56+
57+
- name: Yarn cache
58+
id: cache-yarn
59+
uses: actions/cache@v1
60+
with:
61+
path: ${{ steps.yarn-cache-dir.outputs.dir }}
62+
key: yarn-${{ hashFiles('**/yarn.lock') }}
63+
64+
- name: Setup DB, Run tests
65+
env:
66+
POSTGRES_SERVICE_HOST: postgres
67+
PGUSER: postgres
68+
PGPORT: 5432
69+
RAILS_ENV: test
70+
run: |
71+
bin/rails db:create db:schema:load
72+
bundle exec rspec
73+
74+
- name: Yarn install
75+
run: |
76+
yarn install
77+
yarn test

app/javascript/lib/components/search_field.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { SearchInput } from "juno-ui-components/build/SearchInput"
1+
import { SearchInput } from "@cloudoperators/juno-ui-components/build/SearchInput"
22
import React from "react"
33
import { Popover } from "./Overlay"
44

app/javascript/tailwind.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import "juno-ui-components/build/lib/variables";
1+
@import "@cloudoperators/juno-ui-components/build/lib/variables";
22
@import "tailwindcss/base";
33
@import "tailwindcss/components";
4-
@import "tailwindcss/utilities";
4+
@import "tailwindcss/utilities";

docker/Dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ ADD . $APP_PATH
8282

8383
# transpile javascripts
8484
#RUN yarn install --no-progress && yarn build --production && rm -rf node_modules
85-
RUN yarn upgrade juno-ui-components
8685
RUN bin/rails assets:precompile && rm -rf node_modules
8786

8887
RUN echo $(git rev-parse HEAD) > $APP_PATH/REVISION && rm -rf .git

docker/Dockerfile.dev

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM keppel.eu-de-1.cloud.sap/ccloud-dockerhub-mirror/library/ruby:3.2.2-alpine3.17
1+
FROM keppel.eu-de-1.cloud.sap/ccloud-dockerhub-mirror/library/ruby:3.2.2-alpine3.19
22

33
LABEL source_repository="https://github.wdf.sap.corp/monsoon/workspaces/tree/master/environments/elektra"
44

@@ -15,9 +15,9 @@ RUN apk upgrade --no-cache --no-progress \
1515
build-base \
1616
npm \
1717
--virtual .builddeps \
18-
postgresql15-dev \
19-
postgresql15-jit \
20-
postgresql15-client \
18+
postgresql16-dev \
19+
postgresql16-jit \
20+
postgresql16-client \
2121
openssh \
2222
yarn \
2323
bash \
@@ -27,22 +27,35 @@ RUN apk upgrade --no-cache --no-progress \
2727
vim \
2828
shared-mime-info \
2929
python3 \
30+
python3-dev \
3031
py3-pip\
32+
py3-werkzeug \
3133
ca-certificates \
3234
gcc \
3335
libffi-dev \
34-
python3-dev \
3536
musl-dev \
3637
openssl-dev \
3738
g++ libxml2-dev \
3839
libxslt-dev \
3940
libjpeg-turbo-dev \
4041
zlib-dev \
41-
tshark
42+
tshark \
43+
rust \
44+
cargo
45+
# Create and activate a virtual environment
46+
RUN python3 -m venv /opt/venv
47+
48+
# Make sure the venv Python is used by default
49+
ENV PATH="/opt/venv/bin:$PATH"
50+
RUN echo 'export PATH="/opt/venv/bin:$PATH"' >> /etc/profile
4251

43-
RUN pip install --upgrade pip
52+
# Install Python packages in the virtual environment
4453
# werkzeug==2.2.2 -> https://stackoverflow.com/questions/77213053/why-did-flask-start-failing-with-importerror-cannot-import-name-url-quote-fr
45-
RUN pip install mitmproxy==8.1.1 pgcli werkzeug==2.2.2
54+
RUN pip install werkzeug==2.2.2 mitmproxy==9.0.0
55+
56+
# Verify installation
57+
RUN mitmproxy --version
58+
4659
ENV LANG=en_US.UTF-8
4760

4861
RUN mkdir /app
@@ -57,7 +70,6 @@ ENV PGDATA /app/tmp/postgresql/data
5770
RUN gem install bundler -v 2.3.20 && bundle config set --local path 'vendor/bundle'
5871
RUN echo -e '#!/bin/bash\n\n\
5972
bundle install \n\
60-
yarn upgrade juno-ui-components \n\
6173
yarn \n\
6274
mkdir -p "$PGDATA" && chown -R postgres:postgres "$PGDATA"\n\
6375
PGDATA_FILES=$(ls -A $PGDATA)\n\
@@ -68,7 +80,7 @@ RUN echo -e '#!/bin/bash\n\n\
6880
mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql\n\
6981
su - postgres -c "pg_ctl -D $PGDATA -w start"\n\
7082
DISABLE_SPRING=1 bin/rails db:create && DISABLE_SPRING=1 bin/rails db:migrate\n\
71-
/bin/bash -login' >> /usr/local/bin/prepare-elektra && chmod +x /usr/local/bin/prepare-elektra
83+
exec /bin/bash --login' >> /usr/local/bin/prepare-elektra && chmod +x /usr/local/bin/prepare-elektra
7284

7385
RUN echo -e '\n\
7486
#!/bin/bash\n\n\

docker/Dockerfile.jest-tests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# needs to be in sync with node version in elektra image!
2-
FROM keppel.eu-de-1.cloud.sap/ccloud-dockerhub-mirror/library/node:18-alpine
2+
FROM keppel.eu-de-1.cloud.sap/ccloud-dockerhub-mirror/library/node:20-alpine
33

44
LABEL source_repository="https://github.com/sapcc/elektra"
55

lib/generators/templates/juno/app/javascript/widgets/app/components/Application.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import NewEntryModal from "./entries/new"
1313
import StateProvider from "./StateProvider"
1414
import styles from "../styles.css"
1515

16-
import StyleProvider, { AppShell } from "juno-ui-components"
16+
import StyleProvider, { AppShell } from "@cloudoperators/juno-ui-components"
1717
import { BrowserRouter } from "react-router-dom/cjs/react-router-dom.min"
1818
import { widgetBasePath } from "lib/widget"
1919

lib/generators/templates/juno/app/javascript/widgets/app/components/Tabs.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import React from "react"
22
import { useHistory, useLocation } from "react-router-dom"
3-
import { Tab, Tabs, TabPanel, TabList, Container } from "juno-ui-components"
3+
import {
4+
Tab,
5+
Tabs,
6+
TabPanel,
7+
TabList,
8+
Container,
9+
} from "@cloudoperators/juno-ui-components"
410

511
const TabsComponent = ({ tabsConfig, ...otherProps }) => {
612
const location = useLocation()

lib/generators/templates/juno/app/javascript/widgets/app/components/Welcome.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React from "react"
22

3-
import { IntroBox } from "juno-ui-components"
3+
import { IntroBox } from "@cloudoperators/juno-ui-components"
44

55
const Welcome = () => (
66
<>

0 commit comments

Comments
 (0)