Skip to content

Commit

Permalink
Merge pull request #1010 from slaclab/reusable-CI-yaml
Browse files Browse the repository at this point in the history
updating docker and conda to source reusable YAML CI scripts
  • Loading branch information
ruck314 authored Jul 10, 2024
2 parents c2ddf8e + 1b65235 commit 221deb8
Showing 1 changed file with 12 additions and 85 deletions.
97 changes: 12 additions & 85 deletions .github/workflows/rogue_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,95 +142,22 @@ jobs:

# ----------------------------------------------------------------------------

conda_build:
name: Anaconda Build
conda_build_lib:
needs: [full_build_test, small_build_test]
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-20.04
steps:

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

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

- name: Setup anaconda
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 }}
run: |
echo token=${CONDA_UPLOAD_TOKEN_TAG} >> ${GITHUB_OUTPUT}
- name: Build
run: |
export PATH="${HOME}/miniconda/bin:$PATH"
source ${HOME}/miniconda/etc/profile.d/conda.sh
conda build conda-recipe --output-folder bld-dir -c conda-forge
- name: Upload
run: |
export PATH="${HOME}/miniconda/bin:$PATH"
source ${HOME}/miniconda/etc/profile.d/conda.sh
anaconda -t ${{ steps.get_image_info.outputs.token }} upload --force bld-dir/*/*.tar.bz2
uses: slaclab/ruckus/.github/workflows/conda_build_lib.yml@main
with:
version: '1.0.0'
secrets:
CONDA_UPLOAD_TOKEN_TAG: ${{ secrets.CONDA_UPLOAD_TOKEN_TAG }}

# ----------------------------------------------------------------------------

docker_build:
name: Docker Build
runs-on: ubuntu-20.04
docker_build_lib:
needs: [full_build_test, small_build_test]
if: startsWith(github.ref, 'refs/tags/')
steps:

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

- name: Get Image Information
id: get_image_info
run: |
echo tag=`git describe --tags` >> ${GITHUB_OUTPUT}
echo branch=`echo ${GITHUB_REF} | awk 'BEGIN { FS = "/" } ; { print $3 }'` >> ${GITHUB_OUTPUT}
# Setup docker build environment
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

# Login to Dockerhub
- name: Login to Dockerhub
uses: docker/login-action@v1
with:
username: tidair
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Build and push the docker image
- name: Build and push image to Dockerhub
uses: docker/build-push-action@v2
with:
context: .
file: ./docker/rogue/Dockerfile
push: true
tags: tidair/rogue:${{ steps.get_image_info.outputs.tag }}, tidair/rogue:latest
build-args: branch=${{ steps.get_image_info.outputs.branch }}
uses: slaclab/ruckus/.github/workflows/docker_build_lib.yml@main
with:
version: '1.0.0'
secrets:
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}

# ----------------------------------------------------------------------------

0 comments on commit 221deb8

Please sign in to comment.