Skip to content

Commit 4e4cca1

Browse files
committed
reusable
1 parent c0430bd commit 4e4cca1

4 files changed

+108
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Generate default project
2+
on:
3+
push:
4+
5+
jobs:
6+
test-Github-default-instance:
7+
uses: ./.github/workflows/generate_default_project_reusable.yaml
8+
with:
9+
repo-path: github.com/karllu3/ds-lk-default.git
10+
repo-user: karllu3
11+
repo-email: lukasz.karlowski@deepsense.ai
12+
cookiecutter-profile: cookiecutter_default_gh.yaml
13+
secrets:
14+
repo-token: ${{ secrets.REPO_KEY_GITHUB }}
15+
16+
test-GitLab-default-instance:
17+
uses: ./.github/workflows/generate_default_project_reusable.yaml
18+
with:
19+
repo-path: gitlab.com/lukasz.karlowski/ds-lk-default.git
20+
repo-user: lukasz karlowski
21+
repo-email: lukasz.karlowski@deepsense.ai
22+
cookiecutter-profile: cookiecutter_default_gh.yaml
23+
secrets:
24+
repo-token: ${{ secrets.REPO_KEY_GITLAB }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Generate default project template
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
repo-path:
7+
required: true
8+
type: string
9+
repo-user:
10+
required: true
11+
type: string
12+
repo-email:
13+
required: true
14+
type: string
15+
cookiecutter-profile:
16+
required: true
17+
type: string
18+
secrets:
19+
repo-token:
20+
required: true
21+
22+
jobs:
23+
validate-instance:
24+
runs-on: ubuntu-latest
25+
container: python:3.11
26+
permissions:
27+
contents: read
28+
pages: write
29+
env:
30+
TEST_REPO_TOKEN: ${{ secrets.repo-token }}
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Cache Dependencies
36+
uses: actions/cache@v4
37+
with:
38+
path: ~/.cache/pip
39+
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
40+
restore-keys: |
41+
${{ runner.os }}-pip-
42+
43+
- name: Install Dependencies
44+
run: pip install -r requirements.txt
45+
46+
- name: Create Github project instance
47+
run: cookiecutter . --no-input --config-file ${{ inputs.cookiecutter-profile }}
48+
49+
- name: Remote checkout
50+
run: |
51+
git clone https://oauth2:${{ env.TEST_REPO_TOKEN }}@github.com/{inputs.repo-path} ds-default-repo
52+
cp -r ds-default/. ds-default-repo
53+
54+
- name: Set safe directory
55+
run: |
56+
git config --global --add safe.directory /__w/ds-template/ds-template
57+
58+
- name: Prepare local git repo
59+
working-directory: ./ds-default-repo
60+
run: |
61+
git config --local user.email ${{ inptus.repo-email }}
62+
git config --local user.name ${{ inputs.repo-user }}
63+
git checkout -b ds-default-check
64+
git add .
65+
66+
- name: Validate package build
67+
working-directory: ./ds-default-repo
68+
run: |
69+
python -m pip install .
70+
71+
- name: Install pre-commit
72+
run: pip3 install pre-commit
73+
74+
- name: Run pre-commit checks
75+
working-directory: ./ds-default-repo
76+
run: pre-commit run --all-files --show-diff-on-failure --color always
77+
78+
- name: Push repo
79+
working-directory: ./ds-default-repo
80+
run: |
81+
git commit -m "Repo after creation"
82+
git push --set-upstream origin ds-default-check -f

cookiecutter_default_gh.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
default_context:
22
client_name: "ds"
3-
project_name: "gh_default"
3+
project_name: "ds_default"
44
ci: "Github"
55
jupytext": "No"

cookiecutter_default_gl.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
default_context:
22
client_name: "ds"
3-
project_name: "gl_default"
3+
project_name: "ds_default"
44
ci: "GitLab"
55
jupytext": "No"

0 commit comments

Comments
 (0)