Skip to content

Commit

Permalink
Replace with v2 refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalEgn committed Jun 25, 2024
1 parent 372fec9 commit 8f321f5
Show file tree
Hide file tree
Showing 51 changed files with 4,390 additions and 2,637 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build

on:
workflow_call:
inputs:
ref:
description: The reference to build
type: string
required: true
image:
description: The name of the image to build
type: string
required: true
context:
description: The context used to build the image
type: string
required: true
stage:
description: The stage to build
type: string
required: false
dockerfile:
description: The path to the Dockerfile
type: string
required: false
outputs:
image-id:
description: The ID of image that has been built
value: ${{ jobs.build.outputs.image-id }}

jobs:
build:
runs-on: ubuntu-latest
outputs:
image-id: ${{ steps.build.outputs.image-id }}
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- id: build
name: Build and push
uses: cern-sis/gh-workflows/.github/actions/[email protected]
with:
image: ${{ inputs.image }}
context: ${{ inputs.context }}
stage: ${{ inputs.stage }}
dockerfile: ${{ inputs.dockerfile }}
registry: registry.cern.ch
cache: false
tags: |
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_SECRET }}
26 changes: 26 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Pre-Commit

on:
workflow_call:
inputs:
ref:
description: The reference to build
type: string
required: true

jobs:
linter:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Run pre-commit
uses: pre-commit/[email protected]
12 changes: 12 additions & 0 deletions .github/workflows/pull-request-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Pull request master

on:
pull_request_target:
branches: [master]

jobs:
pre-commit:
uses: ./.github/workflows/pre-commit.yml
with:
ref: ${{ github.event.pull_request.head.sha }}
secrets: inherit
30 changes: 30 additions & 0 deletions .github/workflows/push-master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Push master

on: workflow_dispatch
# push:
# branches: [master]

defaults:
run:
shell: bash

jobs:
build:
uses: ./.github/workflows/build.yml
with:
ref: ${{ inputs.ref }}
image: cern-sis/inspire/classifier
context: .
secrets: inherit

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: send event
uses: cern-sis/gh-workflows/.github/actions/[email protected]
with:
event-type: update
images: |
cern-sis/inspire/classifier@${{ needs.build.outputs.image-id }}
token: ${{ secrets.PAT_FIRE_EVENTS_ON_CERN_SIS_KUBERNETES }}
155 changes: 93 additions & 62 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,3 @@
# -*- coding: utf-8 -*-
#
# This file is part of INSPIRE.
# Copyright (C) 2014-2018 CERN.
#
# INSPIRE is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# INSPIRE is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with INSPIRE. If not, see <http://www.gnu.org/licenses/>.
#
# In applying this license, CERN does not waive the privileges and immunities
# granted to it by virtue of its status as an Intergovernmental Organization
# or submit itself to any jurisdiction.

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand All @@ -30,7 +8,6 @@ __pycache__/

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
Expand All @@ -42,9 +19,12 @@ lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
Expand All @@ -59,14 +39,17 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
Expand All @@ -75,63 +58,111 @@ coverage.xml
# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask instance folder
# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/
docs/_api/

# PyBuilder
.pybuilder/
target/

# IPython Notebook
# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# Eclipse/PyDev
.project
.pydevproject

# Git merge backup files
*.orig
# IPython
profile_default/
ipython_config.py

# Linux backup files
*~
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Mac folder attributes
.DS_Store
# Spyder project settings
.spyderproject
.spyproject

# Locally installed node modules
node_modules
# Rope project settings
.ropeproject

# IntelliJ IDE
.idea
# mkdocs documentation
/site

# Redis
dump.rdb
# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# KDevelop4
.kdev4/
*.kdev4
*.kate-swp
# Pyre type checker
.pyre/

# Vim swapfiles
.*.sw?
# pytype static type analyzer
.pytype/

# Selenium report
assets
selenium-report.html
# Cython debug symbols
cython_debug/

# Rope project files
.ropeproject/
# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

# Twisted
twistd.pid
# Ignore all dataset files
*.pkl
*.df
*.csv
*.h5

# Build artifacts
AUTHORS
CHANGELOG
!/tests/integration/fixtures/inspire_test_data.df
14 changes: 14 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
repos:
- repo: https://github.com/psf/black
rev: '24.4.2'
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: '5.13.2'
hooks:
- id: isort
- repo: https://github.com/pycqa/flake8
rev: '7.1.0'
hooks:
- id: flake8
args: ['--config=setup.cfg']
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

Loading

0 comments on commit 8f321f5

Please sign in to comment.