Added Custom Docker Action which prints fibonacci
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"root": true,
|
||||
"env": {
|
||||
"node": true,
|
||||
"browser": true
|
||||
},
|
||||
"parserOptions": {
|
||||
"ecmaFeatures": {
|
||||
"jsx": true
|
||||
},
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"extends": ["plugin:react/recommended", "plugin:react/jsx-runtime"],
|
||||
"rules": {
|
||||
"react/react-in-jsx-scope": "off",
|
||||
"semi": [2, "always"]
|
||||
},
|
||||
"settings": {
|
||||
"react": {
|
||||
"version": "detect"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
name: Deployment
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
jobs:
|
||||
deploy:
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Get code
|
||||
uses: actions/checkout@v3
|
||||
- name: Get build artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: dist-files
|
||||
path: ./dist
|
||||
- name: Output contents
|
||||
run: ls
|
||||
- name: Deploy site
|
||||
run: echo 1
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
lerna-debug.log*
|
||||
|
||||
/node_modules
|
||||
/dist
|
||||
dist-ssr
|
||||
*.local
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
.DS_Store
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
@@ -0,0 +1,9 @@
|
||||
FROM python:3
|
||||
|
||||
COPY requirements.txt /requirements.txt
|
||||
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY deployment.py /deployment.py
|
||||
|
||||
CMD ["python", "/deployment.py"]
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
#
|
||||
# To be able to use this action (with Gitea and Act Runner),
|
||||
# this action.yml file has to be placed in the root of the repository.
|
||||
# It is also important that a Git TAG is created (for example 'v1')
|
||||
# Then workflows can use this action like this:
|
||||
# 'using: https://gitea.coursow.de/Test-Playground/actions-custom-docker@v1'
|
||||
#
|
||||
|
||||
# Name and Description of the Action (Like displayed in GitHub Marketplace Overview)
|
||||
name: 'Print Fibonacci Numbers (Docker Version)'
|
||||
description: 'Prints a sequence of fibonacci numbers'
|
||||
|
||||
inputs:
|
||||
iterations:
|
||||
description: 'The maximum amount of iterations to produce fibonacci numbers'
|
||||
required: false
|
||||
default: 10
|
||||
|
||||
outputs:
|
||||
lastNumber:
|
||||
description: 'The last fibonacci number printed during the execution of the action'
|
||||
# value: ... # The value key is not needed (like nedded with composite actions) because the main.js will set the ouput value
|
||||
|
||||
runs:
|
||||
using: 'docker' # Must be 'docker' for a custom docker action
|
||||
image: 'Dockerfile' # The Dockerfile to build a docker image which will be used to execute the action
|
||||
#image: 'docker://debian:stretch-slim' # Could also use an existing dockerhub image
|
||||
#pre-entrypoint: 'setup.sh'
|
||||
#entrypoints: 'main.sh'
|
||||
#args:
|
||||
# - 'bzz'
|
||||
@@ -0,0 +1,20 @@
|
||||
import os
|
||||
|
||||
def run():
|
||||
input_iterations = os.environ['INPUT_ITERATIONS']
|
||||
|
||||
current_number = 1
|
||||
last_number = 0
|
||||
|
||||
for _ in range(input_iterations):
|
||||
print(current_number)
|
||||
temp = current_number
|
||||
current_number = current_number + last_number
|
||||
last_number = temp
|
||||
|
||||
with open(os.environ['GITHUB_OUTPUT'], 'a') as gh_output:
|
||||
print(f'lastNumber={last_number}', file=gh_output)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
run()
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Vite + React</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="/src/main.jsx"></script>
|
||||
</body>
|
||||
</html>
|
||||
Generated
+8278
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"name": "02-basic-example",
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"lint": "eslint --ext .jsx --fix src",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"prop-types": "^15.8.1",
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@testing-library/jest-dom": "^5.16.5",
|
||||
"@testing-library/react": "^13.3.0",
|
||||
"@testing-library/user-event": "^14.4.3",
|
||||
"@types/react": "^18.0.17",
|
||||
"@types/react-dom": "^18.0.6",
|
||||
"@vitejs/plugin-react": "^2.0.1",
|
||||
"eslint": "^8.23.0",
|
||||
"eslint-plugin-react": "^7.31.1",
|
||||
"jsdom": "^20.0.0",
|
||||
"vite": "^3.0.7",
|
||||
"vite-plugin-eslint": "^1.8.1",
|
||||
"vitest": "^0.22.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
|
||||
|
After Width: | Height: | Size: 1.5 KiB |
@@ -0,0 +1,7 @@
|
||||
boto3==1.24.71
|
||||
botocore==1.27.71
|
||||
jmespath==1.0.1
|
||||
python-dateutil==2.8.2
|
||||
s3transfer==0.6.0
|
||||
six==1.16.0
|
||||
urllib3==1.26.12
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
import MainContent from './components/MainContent';
|
||||
import logo from './assets/images/logo.png';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<>
|
||||
<header>
|
||||
<div id="logo-img">
|
||||
<img src={logo} />
|
||||
</div>
|
||||
<h1>Learn & Master GitHub Actions</h1>
|
||||
</header>
|
||||
<MainContent />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.8 KiB |
@@ -0,0 +1,4 @@
|
||||
#help-area {
|
||||
margin: auto;
|
||||
display: flex;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import HelpBox from './HelpBox';
|
||||
import './HelpArea.css';
|
||||
|
||||
const HELP_ITEMS = [
|
||||
{
|
||||
id: 'h1',
|
||||
title: 'What is Git?',
|
||||
text: 'Git is a version control system, helping you to manage your code and create code snapshots.',
|
||||
},
|
||||
{
|
||||
id: 'h2',
|
||||
title: 'What is GitHub?',
|
||||
text: 'GitHub is a company and online offering, providing you with tons of Git-related services (e.g., cloud repositories).',
|
||||
},
|
||||
{
|
||||
id: 'h3',
|
||||
title: 'What is GitHub Actions?',
|
||||
text: 'GitHub Actions is an automation service (or CI / CD service) that helps you automate repository-related workflows and processes.',
|
||||
},
|
||||
];
|
||||
|
||||
function HelpArea() {
|
||||
return (
|
||||
<section data-testid="help-area" id="help-area">
|
||||
{HELP_ITEMS.map((item) => (
|
||||
<HelpBox key={item.id} title={item.title} text={item.text} />
|
||||
))}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
export default HelpArea;
|
||||
@@ -0,0 +1,11 @@
|
||||
.help-box {
|
||||
padding: 1rem;
|
||||
border-radius: 4px;
|
||||
margin: 1;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.help-box h2 {
|
||||
color: #97a2a2;
|
||||
font-size: 1.05rem;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
import { string } from 'prop-types';
|
||||
|
||||
import './HelpBox.css';
|
||||
|
||||
function HelpBox({ title, text }) {
|
||||
return (
|
||||
<article className="help-box">
|
||||
<h2>{title}</h2>
|
||||
<p>{text}</p>
|
||||
</article>
|
||||
);
|
||||
}
|
||||
|
||||
HelpBox.propTypes = {
|
||||
title: string,
|
||||
text: string,
|
||||
};
|
||||
|
||||
export default HelpBox;
|
||||
@@ -0,0 +1,20 @@
|
||||
import { useState } from 'react';
|
||||
|
||||
import HelpArea from './HelpArea';
|
||||
|
||||
function MainContent() {
|
||||
const [helpVisible, setHelpVisible] = useState(false);
|
||||
|
||||
function toggleHelp() {
|
||||
setHelpVisible((isVisible) => !isVisible);
|
||||
}
|
||||
|
||||
return (
|
||||
<main>
|
||||
<button onClick={toggleHelp}>{helpVisible ? 'Hide' : 'Show'} Help</button>
|
||||
{helpVisible && <HelpArea />}
|
||||
</main>
|
||||
);
|
||||
}
|
||||
|
||||
export default MainContent;
|
||||
@@ -0,0 +1,24 @@
|
||||
import '@testing-library/jest-dom';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
|
||||
import MainContent from './MainContent';
|
||||
|
||||
// My tests!
|
||||
// Add yet another comment
|
||||
|
||||
describe('MainContent', () => {
|
||||
it('should render a button', () => {
|
||||
render(<MainContent />);
|
||||
|
||||
expect(screen.getByRole('button')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('should show the help area after clicking the button', async () => {
|
||||
render(<MainContent />);
|
||||
|
||||
const button = screen.getByRole('button');
|
||||
await userEvent.click(button);
|
||||
expect(screen.getByTestId('help-area')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,51 @@
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #798080;
|
||||
color: #292d2d;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#logo-img {
|
||||
width: 7rem;
|
||||
height: 7rem;
|
||||
background-color: #3f3828;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: auto;
|
||||
border: 4px solid #292d2d;
|
||||
}
|
||||
|
||||
header img {
|
||||
width: 4rem;
|
||||
height: 4rem;
|
||||
margin: 2rem 0;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
main {
|
||||
margin: 2rem auto;
|
||||
padding: 2rem;
|
||||
max-width: 50rem;
|
||||
background-color: #292d2d;
|
||||
border-radius: 8px;
|
||||
color: white;
|
||||
}
|
||||
|
||||
button {
|
||||
font: inherit;
|
||||
cursor: pointer;
|
||||
background-color: #f8bd47;
|
||||
color: #292d2d;
|
||||
padding: 0.25rem 1rem;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #f8bd47;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom/client';
|
||||
|
||||
import App from './App';
|
||||
import './index.css';
|
||||
|
||||
ReactDOM.createRoot(document.getElementById('root')).render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
import '@testing-library/jest-dom';
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"numTotalTestSuites": 1,
|
||||
"numPassedTestSuites": 0,
|
||||
"numFailedTestSuites": 1,
|
||||
"numPendingTestSuites": 0,
|
||||
"numTotalTests": 0,
|
||||
"numPassedTests": 0,
|
||||
"numFailedTests": 0,
|
||||
"numPendingTests": 0,
|
||||
"numTodoTests": 0,
|
||||
"startTime": 1662469084119,
|
||||
"success": false,
|
||||
"testResults": [
|
||||
{
|
||||
"assertionResults": [],
|
||||
"startTime": 1662469084119,
|
||||
"endTime": 1662469084119,
|
||||
"status": "passed",
|
||||
"message": "\u001b[0m\u001b[0m\n\u001b[0m\u001b[4m/Users/max/development/teaching/gh-flow/src/components/HelpBox.jsx\u001b[24m\u001b[0m\n\u001b[0m \u001b[2m5:20\u001b[22m \u001b[31merror\u001b[39m 'title' is missing in props validation \u001b[2mreact/prop-types\u001b[22m\u001b[0m\n\u001b[0m \u001b[2m5:27\u001b[22m \u001b[31merror\u001b[39m 'text' is missing in props validation \u001b[2mreact/prop-types\u001b[22m\u001b[0m\n\u001b[0m\u001b[0m\n\u001b[0m\u001b[31m\u001b[1m✖ 2 problems (2 errors, 0 warnings)\u001b[22m\u001b[39m\u001b[0m\n\u001b[0m\u001b[31m\u001b[1m\u001b[22m\u001b[39m\u001b[0m",
|
||||
"name": "/Users/max/development/teaching/gh-flow/src/components/MainContent.test.jsx"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { defineConfig } from 'vite';
|
||||
import react from '@vitejs/plugin-react';
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
test: {
|
||||
globals: true,
|
||||
environment: 'jsdom',
|
||||
setupFiles: './src/test/setup.js',
|
||||
reporters: ['json'],
|
||||
outputFile: 'test.json',
|
||||
exclude: [
|
||||
'**/node_modules/**',
|
||||
'**/dist/**',
|
||||
'**/cypress/**',
|
||||
'.{idea,git,cache,output,temp}/**',
|
||||
'./src/config/**',
|
||||
]
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user