From c7bb78f767c67c8672b7428cbdbe170401ba4baf Mon Sep 17 00:00:00 2001 From: Jayaram Kancherla Date: Fri, 24 Jan 2025 10:00:28 -0800 Subject: [PATCH] Add GitHub actions to test environments and Publish docker images (#1) --- .github/workflows/create-docker.yml | 26 +++++++++++++++++++++ .github/workflows/create-env.yml | 35 +++++++++++++++++++++++++++++ envs/release.yml | 2 +- release.dockerfile | 10 ++++----- 4 files changed, 67 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/create-docker.yml create mode 100644 .github/workflows/create-env.yml diff --git a/.github/workflows/create-docker.yml b/.github/workflows/create-docker.yml new file mode 100644 index 0000000..1c7d02b --- /dev/null +++ b/.github/workflows/create-docker.yml @@ -0,0 +1,26 @@ +name: Create Docker images + +on: + push: + tags: "*" + +jobs: + create_docker: + runs-on: ubuntu-latest + strategy: + matrix: + conda-config: [release] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Publish to Registry + uses: elgohr/Publish-Docker-Github-Action@v4 + with: + name: ${{ github.repository }}/${{ matrix.conda-config }}:${{ github.ref_name }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + dockerfile: ${{ matrix.conda-config }}.dockerfile + registry: ghcr.io + snapshot: true diff --git a/.github/workflows/create-env.yml b/.github/workflows/create-env.yml new file mode 100644 index 0000000..92849b9 --- /dev/null +++ b/.github/workflows/create-env.yml @@ -0,0 +1,35 @@ +name: Create the environment + +on: + push: + branches: [master] + pull_request: + branches: [master] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + conda-config: [release] + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - uses: mamba-org/setup-micromamba@v2 + with: + environment-file: envs/${{ matrix.conda-config }}.yml + init-shell: >- + bash + cache-environment: true + cache-downloads: true + post-cleanup: "all" + + - name: Test for import + run: python -c "import genomicranges" + shell: bash -el {0} + + - name: Snapshot the package versions in the environment + run: pip list + shell: micromamba-shell {0} diff --git a/envs/release.yml b/envs/release.yml index a999e5d..a33c848 100644 --- a/envs/release.yml +++ b/envs/release.yml @@ -1,4 +1,4 @@ -name: biocpy_devel +name: biocpy_release channels: - conda-forge dependencies: diff --git a/release.dockerfile b/release.dockerfile index 219b56d..7a88ab2 100644 --- a/release.dockerfile +++ b/release.dockerfile @@ -1,7 +1,7 @@ -FROM condaforge/miniforge3:latest +FROM mambaorg/micromamba:2.0.5 -WORKDIR /biocenv -COPY . /biocenv -RUN mamba --version +COPY --chown=$MAMBA_USER:$MAMBA_USER envs/release.yml /tmp/env.yaml +RUN micromamba --version -RUN mamba env create -f env/release.yml +RUN micromamba install -y -n base -f /tmp/env.yaml && \ + micromamba clean --all --yes