Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat]: ds template automatic check workflow #21

Draft
wants to merge 101 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
c6e8e7d
ds template check workflow
karllu3 Jul 23, 2024
f9f9df3
fix repo name
karllu3 Jul 23, 2024
171015e
update
karllu3 Jul 23, 2024
1e2bd2d
update workflow
karllu3 Jul 24, 2024
b1771f9
act
karllu3 Jul 24, 2024
a9a1538
git init
karllu3 Jul 24, 2024
f7073b0
git order
karllu3 Jul 24, 2024
07d017e
check
karllu3 Jul 24, 2024
ffd0084
precommit
karllu3 Jul 24, 2024
6dc51b1
safe directory
karllu3 Jul 24, 2024
680cc54
working directory
karllu3 Jul 24, 2024
cfa6b4f
remove cd
karllu3 Jul 24, 2024
374babd
comments
karllu3 Jul 24, 2024
719f8e3
add git init
karllu3 Jul 24, 2024
097a2ce
update
karllu3 Jul 24, 2024
4dd6da4
pip install
karllu3 Jul 24, 2024
1927068
act -p
karllu3 Jul 24, 2024
06a5ced
delete act
karllu3 Jul 25, 2024
16194ca
define user for commit
karllu3 Jul 25, 2024
c055610
set origin
karllu3 Jul 25, 2024
f391ace
pushes
karllu3 Jul 25, 2024
0e51813
update
karllu3 Jul 25, 2024
eac8b39
key fix
karllu3 Jul 25, 2024
9560e6f
ommit authorization
karllu3 Jul 25, 2024
1163510
fix order
karllu3 Jul 25, 2024
1e60482
git init main
karllu3 Jul 25, 2024
74eadfe
init
karllu3 Jul 25, 2024
adeb89f
debug
karllu3 Jul 25, 2024
0613a71
work template
karllu3 Jul 25, 2024
c2a7d34
add to ssh
karllu3 Jul 25, 2024
ef564f3
tu
karllu3 Jul 25, 2024
5bc4dfb
back to git ssh
karllu3 Jul 25, 2024
88f1f1e
template update
karllu3 Jul 25, 2024
67b5cc1
checkout actions
karllu3 Jul 25, 2024
93a2573
list repo content
karllu3 Jul 25, 2024
06ce114
temp update
karllu3 Jul 25, 2024
836153f
template update
karllu3 Jul 25, 2024
bd8436e
copy files
karllu3 Jul 25, 2024
762b003
change git add order
karllu3 Jul 25, 2024
f811a09
update permissions
karllu3 Jul 26, 2024
0abd60c
workflows
karllu3 Jul 26, 2024
780c593
secrets
karllu3 Jul 26, 2024
6d149dc
username/pass
karllu3 Jul 26, 2024
ec56ec9
fixups
karllu3 Jul 26, 2024
635e223
fixes
karllu3 Jul 26, 2024
d4a2684
fixes
karllu3 Jul 26, 2024
171088f
gh clone
karllu3 Jul 26, 2024
c3c535d
update gh link
karllu3 Jul 26, 2024
69cb56f
change username
karllu3 Jul 26, 2024
0cb1d01
change username
karllu3 Jul 26, 2024
06ac324
change username
karllu3 Jul 26, 2024
c0430bd
change username
karllu3 Jul 26, 2024
4e4cca1
reusable
karllu3 Jul 26, 2024
2c82ede
clean up
karllu3 Jul 26, 2024
70e68cd
env fix
karllu3 Jul 26, 2024
3e1648f
env fix
karllu3 Jul 26, 2024
fb5396e
env fix
karllu3 Jul 26, 2024
1fca9bf
escape
karllu3 Jul 26, 2024
e5ab91d
escape
karllu3 Jul 26, 2024
b01fe2f
escape
karllu3 Jul 26, 2024
0942dbd
escape
karllu3 Jul 26, 2024
031f127
escape
karllu3 Jul 26, 2024
1964c43
escape
karllu3 Jul 26, 2024
8922abe
escape
karllu3 Jul 26, 2024
30aae07
escape
karllu3 Jul 26, 2024
92aebde
escape
karllu3 Jul 26, 2024
b045a42
escape
karllu3 Jul 26, 2024
f59c2ad
escape
karllu3 Jul 26, 2024
d7a9312
escape
karllu3 Jul 26, 2024
ce53065
escape
karllu3 Jul 26, 2024
9601c08
escape
karllu3 Jul 26, 2024
7734faa
escape
karllu3 Jul 26, 2024
85fcb7c
escape
karllu3 Jul 26, 2024
b6bcbd8
escape
karllu3 Jul 26, 2024
261c999
escape
karllu3 Jul 26, 2024
602b8b5
escape
karllu3 Jul 26, 2024
5edfda7
escape
karllu3 Jul 26, 2024
906fef4
escape
karllu3 Jul 26, 2024
8b1a166
escape
karllu3 Jul 27, 2024
5d041e9
escape
karllu3 Jul 27, 2024
8eab57c
escape
karllu3 Jul 27, 2024
c85f320
hardfix
karllu3 Jul 27, 2024
b2836d8
hardfix
karllu3 Jul 27, 2024
166674e
hardfix
karllu3 Jul 27, 2024
740e28f
hardfix
karllu3 Jul 27, 2024
4c26117
hardfix
karllu3 Jul 27, 2024
76d2dd1
bring back envs
karllu3 Jul 27, 2024
4ec6f8d
reusable
karllu3 Jul 27, 2024
f49c5d9
escape @
karllu3 Jul 27, 2024
2d82556
workflow reusable
karllu3 Jul 27, 2024
0f72f9d
repo workflow
karllu3 Jul 27, 2024
c1c7c56
repo
karllu3 Jul 27, 2024
55855f2
set env
karllu3 Jul 27, 2024
a842d70
set env
karllu3 Jul 27, 2024
9e83e96
set env
karllu3 Jul 27, 2024
9393bbd
secret pass
karllu3 Jul 27, 2024
287436a
gitlab tag
karllu3 Jul 29, 2024
4b801e0
gh/gh
karllu3 Jul 29, 2024
c16c6dc
gh/gl
karllu3 Jul 29, 2024
7687a4f
own runner
karllu3 Jul 29, 2024
08d696b
gitlab public tag
karllu3 Jul 30, 2024
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
24 changes: 24 additions & 0 deletions .github/workflows/generate_default_project.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Generate default project
on:
push:

jobs:
test-Github-default-instance:
uses: ./.github/workflows/generate_default_project_reusable.yaml
with:
repo-path: github.com/karllu3/ds-lk-default.git
repo-user: karllu3
repo-user-email: [email protected]
cookiecutter-profile: cookiecutter_default_gh.yaml
secrets:
REPO_TOKEN: ${{ secrets.REPO_KEY_GITHUB }}

test-GitLab-default-instance:
uses: ./.github/workflows/generate_default_project_reusable.yaml
with:
repo-path: gitlab.com/lukasz.karlowski/ds-lk-default.git
repo-user: lukasz karlowski
repo-user-email: [email protected]
cookiecutter-profile: cookiecutter_default_gl.yaml
secrets:
REPO_TOKEN: ${{ secrets.REPO_KEY_GITLAB }}
87 changes: 87 additions & 0 deletions .github/workflows/generate_default_project_reusable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Generate default project template

on:
workflow_call:
inputs:
repo-path:
required: true
type: string
repo-user:
required: true
type: string
repo-user-email:
required: true
type: string
cookiecutter-profile:
required: true
type: string
secrets:
REPO_TOKEN:
required: true

env:
REMOTE_REPO_REF: https://oauth2:${{ secrets.REPO_TOKEN }}@${{ inputs.repo-path }}

jobs:
validate-instance:
runs-on: ubuntu-latest
container: python:3.11
permissions:
contents: read
pages: write

steps:
- uses: actions/checkout@v4

- name: Cache Dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-

- name: Install Dependencies
run: pip install -r requirements.txt

- name: Create Github project instance
run: cookiecutter . --no-input --config-file ${{ inputs.cookiecutter-profile }}

- name: Prepare remote link
run: |
echo "remote repo ${{ env.REMOTE_REPO_REF }}"

- name: Remote checkout
run: |
git clone ${{ env.REMOTE_REPO_REF }} ds-default-repo
cp -r ds-default/. ds-default-repo

- name: Set safe directory
run: |
git config --global --add safe.directory /__w/ds-template/ds-template

- name: Prepare local git repo
working-directory: ./ds-default-repo
run: |
git config --local user.email "${{ inputs.repo-user }}"
git config --local user.name "${{ inputs.repo-user-email }}"
git checkout -b ds-default-check
git add .

- name: Validate package build
working-directory: ./ds-default-repo
run: |
python -m pip install .

- name: Install pre-commit
run: pip3 install pre-commit

- name: Run pre-commit checks
working-directory: ./ds-default-repo
run: pre-commit run --all-files --show-diff-on-failure --color always

- name: Push repo
working-directory: ./ds-default-repo
run: |
git commit -m "Repo after creation"
git push --set-upstream origin ds-default-check -f
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

pages:
runs-on: ubuntu-latest
container: python:3.9-buster
container: python:3.11

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"__client_name_slug": "{{cookiecutter.client_name | slugify}}",
"repo_name": "{{cookiecutter.__client_name_slug}}-{{cookiecutter.__project_name_slug}}",
"ci": [
"GitLab",
"Github",
"GitLab",
"None"
],
"jupytext": [
Expand All @@ -18,4 +18,4 @@
"_copy_without_render": [
".github/workflows/*.yml"
]
}
}
5 changes: 5 additions & 0 deletions cookiecutter_default_gh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
default_context:
client_name: "ds"
project_name: "default"
ci: "Github"
jupytext": "No"
5 changes: 5 additions & 0 deletions cookiecutter_default_gl.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
default_context:
client_name: "ds"
project_name: "default"
ci: "GitLab"
jupytext": "No"
4 changes: 2 additions & 2 deletions {{ cookiecutter.repo_name }}/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
default:
tags:
- all-ds
- gitlab-org-docker

variables:
PYTHON_DOCKER_IMAGE: python:3.9-buster
PYTHON_DOCKER_IMAGE: python:3.11
DOCKER_REGISTRY: $CI_REGISTRY/$CI_PROJECT_PATH
PRECOMMIT_IMAGE: $DOCKER_REGISTRY/precommit

Expand Down
2 changes: 1 addition & 1 deletion {{ cookiecutter.repo_name }}/docker/precommit/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Creates a dockerfile with pre-commit preconfigured.
# Can be used to reduce time for linting stage.

FROM python:3.9-slim-buster
FROM python:3.11

ENV PRE_COMMIT_VERSION 3.0.4

Expand Down
2 changes: 1 addition & 1 deletion {{ cookiecutter.repo_name }}/setup_dev_env.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

if [ ! -d venv ]; then
python3 -m venv venv
python3.11 -m venv venv
. venv/bin/activate
pip install --upgrade pip
pip install --quiet wheel==0.41.3
Expand Down
Loading