Skip to content

Commit

Permalink
migrate skaraMirror.sh to be a python script
Browse files Browse the repository at this point in the history
  • Loading branch information
gdams committed Apr 9, 2024
1 parent 1286b97 commit 041389a
Show file tree
Hide file tree
Showing 9 changed files with 868 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
21 changes: 21 additions & 0 deletions .github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
###########################
###########################
## Markdown Linter rules ##
###########################
###########################

# Linter rules doc:
# - https://github.com/DavidAnson/markdownlint
#
# Note:
# To comment out a single error:
# <!-- markdownlint-disable -->
# any violations you want
# <!-- markdownlint-restore -->
#

###############
# Rules by id #
###############
MD013: false # Line length is usually not important and the 80 char limit is way too small anyway
MD033: false # Inline HTML is important for multilines and checkboxes within markdown tables
61 changes: 61 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
###########################
###########################
## Linter GitHub Actions ##
###########################
###########################
name: Linter

#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#

####################################################################
# Start the job on all pull requests that target the master branch #
####################################################################
on:
pull_request:
branches: [master]

###############
# Set the Job #
###############
permissions:
contents: read

jobs:
linter:
# Name the Job
permissions:
contents: read # for actions/checkout to fetch code
statuses: write # for github/super-linter to mark status of each linter run
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest

##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0

################################
# Run Linter against code base #
################################
- name: Lint Code Base
uses: github/super-linter@45fc0d88288beee4701c62761281edfee85655d7 # v5.0.0
env:
VALIDATE_ALL_CODEBASE: false
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Markdown lint complains about the issue templates
FILTER_REGEX_EXCLUDE: .github/ISSUE_TEMPLATE/*
# Lots of shellcheck errors - need fixing
VALIDATE_BASH: false
26 changes: 26 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Test

on:
pull_request:
branches: [ master ]

permissions:
contents: read

jobs:
test_python:
name: Python
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2

- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3'

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

- name: Run Python Tests
run: python -m unittest test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ workspace
pipelines/.gradle
pipelines/gradle-cache
pipelines/target
__pycache__
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GitPython==3.1.43
tqdm==4.66.2
49 changes: 49 additions & 0 deletions skaraMirror.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# OpenJDK Mirroring Script

This script automates the process of mirroring OpenJDK repositories from GitHub to Adoptium. It is designed to clone specific JDK versions, add upstream Skara repositories, and perform merges as necessary to keep the Adoptium mirrors up to date with OpenJDK development.

## Features

- **Clone Repositories:** Clone OpenJDK repositories for specific JDK versions.
- **Add Skara Upstream:** Configure Skara repository as a remote upstream.
- **Merge Changes:** Merge changes from Skara into the GitHub repository and manage branch merges for release and development purposes.


## Prerequisites

Python 3.6 or higher
Ensure you have Git installed and configured on your system.

## Installation

Install the required Python dependencies:

```bash
pip install -r requirements.txt
```

## Usage

The script supports various operations based on command-line arguments:

```bash
./skaraMirror.py <jdk_version> [repo_url] [branch]
```

- `<jdk_version>`: The JDK version to mirror (e.g., jdk8u, jdk17u).
- `[repo_url]`: (Optional) URL of the repository to mirror. Defaults to git@github.com:adoptium.
- `[branch]`: (Optional) Branch to mirror. Defaults to master.

## Examples

Mirror the JDK 17 repository:

```bash
./skaraMirror.py jdk17u
```

Mirror the JDK 8 repository from a specific repo and branch:

```bash
./skaraMirror.py jdk8u git@github.com:custom_org custom_branch
```
Loading

0 comments on commit 041389a

Please sign in to comment.