Skip to content

Commit

Permalink
try to use a reusable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnachun committed Sep 20, 2023
1 parent dd267f1 commit d37f0ee
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 34 deletions.
40 changes: 6 additions & 34 deletions .github/workflows/container_build.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,13 @@
name: Build containers from conda environments

on:
pull_request:
paths:
- 'container/containers.csv'
- 'container/*/*.yml'
workflow_call:
inputs:
commit_sha:
required: true
type: string

jobs:
update_csv:
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- name: Checkout pull request branch
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- name: Setup micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-name: containers
create-args: numpy pandas pyyaml
generate-run-shell: true

- name: Regenerate environment YAML files
shell: micromamba-shell {0}
run: python3 .github/workflows/export_envs.py

- name: Commit changes to YAML files
uses: EndBug/add-and-commit@v9
with:
push: true

setup:
needs: update_csv
runs-on: ubuntu-latest
Expand Down Expand Up @@ -82,7 +54,7 @@ jobs:
if: steps.changed-directories.outputs.all_changed_files_count > 0
uses: actions/upload-artifact@v3
with:
name: changed_directories_${{ github.event.push.head.sha }}
name: changed_directories_${{ inputs.commit_sha }}
path: /tmp/changed_directories.json

docker_container:
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/update_container_list.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build containers from conda environments

on:
pull_request:
paths:
- 'container/containers.csv'

jobs:
update_csv:
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- name: Checkout pull request branch
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}

- name: Setup micromamba
uses: mamba-org/setup-micromamba@v1
with:
environment-name: containers
create-args: numpy pandas pyyaml
generate-run-shell: true

- name: Regenerate environment YAML files
shell: micromamba-shell {0}
run: python3 .github/workflows/export_envs.py

- name: Commit changes to YAML files
uses: EndBug/add-and-commit@v9
with:
push: true

- name: Call container_build
uses: .github/workflows/container_build.yml
with:
commit_sha: ${{ github.event.pull_request.head.sha }}

0 comments on commit d37f0ee

Please sign in to comment.