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

Refactor/use oras and organize #19

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions .github/dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
black
flake8
isort
pre-commit
102 changes: 102 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: conda-mirror test

permissions:
contents: read

on:
pull_request: []

jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check Spelling
uses: crate-ci/typos@7ad296c72fa8265059cc03d1eda562fbdfcd6df2 # v1.9.0
with:
files: ./README.md
- name: Setup Environment
run: conda create --quiet --name mirror pre-commit
- name: Lint Conda Oci Mirror
run: |
export PATH="/usr/share/miniconda/bin:$PATH"
source activate mirror
pip install -r .github/dev-requirements.txt
pre-commit run --all-files

testing:
runs-on: ubuntu-latest
services:
registry:
image: ghcr.io/oras-project/registry:latest
ports:
- 5000:5000
steps:
- uses: actions/checkout@v3
- name: Setup Environment
run: conda create --quiet --name mirror pytest
- name: Test Conda OCI Mirror
shell: bash -l {0}
env:
registry_host: http://localhost
registry_port: ${{ job.services.registry.ports[5000] }}
run: |
export PATH="/usr/share/miniconda/bin:$PATH"
source activate mirror
conda install conda-build
pip install .
pytest -xs conda_oci_mirror/tests/*.py

mirror-pkgs:
runs-on: ubuntu-latest
services:
registry:
image: ghcr.io/oras-project/registry:latest
ports:
- 5000:5000
strategy:
max-parallel: 12
matrix:
package: [redo]
subdir:
- linux-64
- osx-64
- osx-arm64
- win-64
- linux-aarch64
- linux-ppc64le
- noarch
fail-fast: true
steps:
- uses: actions/checkout@v3
- name: Setup Environment
run: conda create --quiet --name mirror pre-commit
- name: Install Conda Oci Mirror
run: |
export PATH="/usr/share/miniconda/bin:$PATH"
conda install conda-build
source activate mirror
pip install -e .

- name: Test Conda Oci Mirror
shell: bash -l {0}
env:
channel: conda-forge
subdir: ${{ matrix.subdir }}
package: ${{ matrix.package }}
registry_host: localhost
registry_port: ${{ job.services.registry.ports[5000] }}
run: |
export PYTHONUNBUFFERED=1
export PATH="/usr/share/miniconda/bin:$PATH"
source activate mirror

# First run mirror
conda-oci mirror --channel ${channel} --subdir ${subdir} --package ${package} --registry http://${registry_host}:${registry_port}/dinosaur

# Then run pull-cache and push-cache
conda-oci pull-cache --registry http://${registry_host}:${registry_port}/dinosaur --subdir ${subdir} --package ${package}
conda-oci push-cache --registry http://${registry_host}:${registry_port}/dinosaur --subdir ${subdir} --package ${package}

- name: View Cache
run: sudo apt-get install -y tree && tree ./cache
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
build/
.env
*.pyc
*.egg-info
cache/
env
50 changes: 30 additions & 20 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,42 @@
#exclude: ".all-contributorsrc"
repos:
- repo: https://github.com/pycqa/isort
rev: "5.10.1"
hooks:
- id: isort
name: isort (python)
- repo: https://github.com/psf/black
rev: "22.3.0"
hooks:
- id: black
args: [--safe, --quiet]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.2.1
hooks:
- id: prettier
- repo: https://gitlab.com/pycqa/flake8
rev: "3.8.4"
hooks:
- id: flake8
args: [--ignore=E501]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.4.0
rev: v4.3.0
hooks:
- id: end-of-file-fixer
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: requirements-txt-fixer

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.2.1
hooks:
- id: prettier

- repo: https://github.com/pre-commit/mirrors-pylint
rev: v3.0.0a3
hooks:
- id: pylint
args: [--disable=all, --enable=unused-import]

- repo: local
hooks:
- id: black
name: black
language: python
types: [python]
entry: black

- id: isort
name: isort
args: [--filter-files]
language: python
types: [python]
entry: isort

- id: flake8
name: flake8
language: python
types: [python]
entry: flake8
args: [--ignore=E501]
Loading