Skip to content

Commit

Permalink
Merge pull request #313 from slaclab/pre-release
Browse files Browse the repository at this point in the history
Release Candidate 4.12.0
  • Loading branch information
ruck314 authored Apr 23, 2024
2 parents 742278f + ad0505d commit 091fe00
Show file tree
Hide file tree
Showing 4 changed files with 200 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/conda_build_lib.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# ----------------------------------------------------------------------------
# Title : Ruckus GitHub Actions CI Script
# ----------------------------------------------------------------------------
# This file is part of the 'Ruckus Package'. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
# https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of the 'Ruckus Package', including this file, may be
# copied, modified, propagated, or distributed except according to the terms
# contained in the LICENSE.txt file.
# ----------------------------------------------------------------------------

name: Anaconda Build for a Library

on:
workflow_call:
inputs:
version:
required: true
type: string
secrets:
CONDA_UPLOAD_TOKEN_TAG:
required: true


jobs:
conda_build_lib:
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
os:
- ubuntu-20.04
runs-on: ${{ matrix.os }}
steps:

# This step checks out a copy of your repository.
- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Setup anaconda
env:
OS_NAME: ${{ matrix.os }}
run: |
cd ${HOME}
wget -O miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash miniconda.sh -b -p ${HOME}/miniconda
export PATH="${HOME}/miniconda/bin:$PATH"
source ${HOME}/miniconda/etc/profile.d/conda.sh
conda config --set always_yes yes
conda config --set channel_priority strict
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
conda install conda-build anaconda-client conda-verify
conda update -q conda conda-build
conda update --all
- name: Get Image Information
id: get_image_info
env:
CONDA_UPLOAD_TOKEN_TAG: ${{ secrets.CONDA_UPLOAD_TOKEN_TAG }}
OS_NAME: ${{ matrix.os }}
run: |
echo ::set-output name=token::$CONDA_UPLOAD_TOKEN_TAG
echo ::set-output name=os::linux-64
- name: Build And Upload
run: |
export PATH="${HOME}/miniconda/bin:$PATH"
source ${HOME}/miniconda/etc/profile.d/conda.sh
conda build --debug conda-recipe --output-folder bld-dir -c tidair-tag -c tidair-packages -c conda-forge
anaconda -t ${{ steps.get_image_info.outputs.token }} upload --force bld-dir/noarch/*.tar.bz2
56 changes: 56 additions & 0 deletions .github/workflows/gen_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# ----------------------------------------------------------------------------
# Title : Ruckus GitHub Actions CI Script
# ----------------------------------------------------------------------------
# This file is part of the 'Ruckus Package'. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
# https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of the 'Ruckus Package', including this file, may be
# copied, modified, propagated, or distributed except according to the terms
# contained in the LICENSE.txt file.
# ----------------------------------------------------------------------------

name: Generate Release

on:
workflow_call:
inputs:
version:
required: true
type: string
secrets:
GH_TOKEN:
required: true

jobs:
gen_release:
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/')
steps:

- uses: actions/checkout@v2
with:
fetch-depth: 0

- uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Get Image Information
id: get_image_info
run: |
echo ::set-output name=tag::`git describe --tags`
- name: Get Ruckus
run: |
git clone https://github.com/slaclab/ruckus.git
python -m pip install --upgrade pip
pip install -r ruckus/scripts/pip_requirements.txt
- name: Gen Release
env:
TRAVIS_REPO_SLUG: ${{ github.repository }}
TRAVIS_TAG: ${{ steps.get_image_info.outputs.tag }}
GH_REPO_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
python ruckus/scripts/releaseGen.py
67 changes: 67 additions & 0 deletions scripts/download_github_asset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# ----------------------------------------------------------------------------
# Description: Used to download an asset from a tag release on Github
# ----------------------------------------------------------------------------
# This file is part of the 'SLAC Firmware Standard Library'. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
# https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of the 'SLAC Firmware Standard Library', including this file, may be
# copied, modified, propagated, or distributed except according to the terms
# contained in the LICENSE.txt file.
# ----------------------------------------------------------------------------

import os
import requests
from github import Github # PyGithub
import argparse

# Set up argument parsing
parser = argparse.ArgumentParser(description="Download assets from GitHub releases in private repositories.")
parser.add_argument("--repo_name", type=str, required=True, help="Repository name, e.g., 'slaclab/epix-hr-m-320k'")
parser.add_argument("--asset_name", type=str, required=True, help="Asset name to download, e.g., 'ePixHRM320k-0x01000400-20240323061941-dnajjar-ff123db.mcs'")
parser.add_argument("--release_tag", type=str, required=True, help="Release tag, e.g., 'v1.1.4'")

args = parser.parse_args()

# Ensure GITHUB_TOKEN is set in your environment variables
GITHUB_TOKEN = os.getenv('GITHUB_TOKEN')
if GITHUB_TOKEN is None:
raise ValueError("GITHUB_TOKEN environment variable not set.")

# Initialize PyGithub with the GitHub token for authentication
g = Github(GITHUB_TOKEN)

# Use the arguments for the repository name, asset name, and release tag
repo_name = args.repo_name
asset_name = args.asset_name
release_tag = args.release_tag

# Get the repository object
repo = g.get_repo(repo_name)

# Get the release by tag
release = repo.get_release(release_tag)

# Find the correct asset by name
asset_to_download = None
for asset in release.get_assets():
if asset.name == asset_name:
asset_to_download = asset
break

if asset_to_download is not None:
# The API provides an authenticated URL for assets in private repositories
asset_url = asset_to_download.url

headers = {'Authorization': f'token {GITHUB_TOKEN}', 'Accept': 'application/octet-stream'}
response = requests.get(asset_url, headers=headers, stream=True)

if response.status_code == 200:
with open(asset_name, 'wb') as file:
for chunk in response.iter_content(chunk_size=128):
file.write(chunk)
print(f"Downloaded {asset_name}")
else:
print(f"Failed to download {asset_name}: {response.status_code}")
else:
print("Asset not found in the release.")
1 change: 1 addition & 0 deletions shared/proc.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ proc GenBuildString { pkgDir } {

# Generate the build string
binary scan [encoding convertto ascii $::env(BUILD_STRING)] c* bstrAsic
set bstrAsic [lrange $bstrAsic 1 end-1]
set buildString ""
foreach decChar ${bstrAsic} {
set hexChar [format %02X ${decChar}]
Expand Down

0 comments on commit 091fe00

Please sign in to comment.