Skip to content

Commit

Permalink
Merge pull request datajoint#56 from yambottle/main
Browse files Browse the repository at this point in the history
U24 workflow CICD
  • Loading branch information
Ernaldis authored Aug 25, 2022
2 parents df46b76 + 64a345d commit 578a8f2
Show file tree
Hide file tree
Showing 15 changed files with 199 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: u24_workflow_before_release
on:
pull_request:
push:
branches:
- '**'
tags-ignore:
- '**'
workflow_dispatch:

anchor-dev-build-call: &dev-build-call
uses: yambottle/djsciops-cicd/.github/workflows/u24_workflow_build.yaml@main

anchor-test-build-call: &test-build-call
uses: yambottle/djsciops-cicd/.github/workflows/u24_workflow_build.yaml@main

anchor-prod-build-call: &prod-build-call
uses: dj-sciops/djsciops-cicd/.github/workflows/u24_workflow_build.yaml@main

jobs:
call_context_check:
uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main

call_u24_workflow_build_debian:
!!merge <<: *$STAGE-build-call
with:
jhub_ver: 1.4.2
py_ver: 3.9
dist: debian
codebook_base_hash: 561b765
47 changes: 47 additions & 0 deletions .github/.staging_workflows/anchored_u24_workflow_release_call.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: u24_workflow_release_call

on:
workflow_run:
workflows: ["u24_workflow_tag_to_release"]
types:
- completed

anchor-dev-release-call: &dev-release-call
uses: yambottle/djsciops-cicd/.github/workflows/u24_workflow_release.yaml@main

anchor-test-release-call: &test-release-call
uses: yambottle/djsciops-cicd/.github/workflows/u24_workflow_release.yaml@main

anchor-prod-release-call: &prod-release-call
uses: dj-sciops/djsciops-cicd/.github/workflows/u24_workflow_release.yaml@main

anchor-dev-release-if: &dev-release-if
if: >-
github.event.workflow_run.conclusion == 'success' &&
github.repository_owner == 'yambottle'
anchor-test-release-if: &test-release-if
if: >-
github.event.workflow_run.conclusion == 'success' &&
github.repository_owner == 'yambottle'
anchor-prod-release-if: &prod-release-if
if: >-
github.event.workflow_run.conclusion == 'success' &&
github.repository_owner == 'datajoint'
jobs:
call_context_check:
uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main

call_u24_workflow_release_debian:
!!merge <<: *$STAGE-release-if
!!merge <<: *$STAGE-release-call
with:
jhub_ver: 1.4.2
py_ver: 3.9
dist: debian
codebook_base_hash: 561b765
secrets:
REGISTRY_USERNAME: ${{secrets.DOCKER_USERNAME}}
REGISTRY_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: u24_workflow_tag_to_release

on:
push:
tags:
- '*.*.*'
- 'test*.*.*'

anchor-dev-build-call: &dev-build-call
uses: yambottle/djsciops-cicd/.github/workflows/u24_workflow_build.yaml@main

anchor-test-build-call: &test-build-call
uses: yambottle/djsciops-cicd/.github/workflows/u24_workflow_build.yaml@main

anchor-prod-build-call: &prod-build-call
uses: dj-sciops/djsciops-cicd/.github/workflows/u24_workflow_build.yaml@main

jobs:
call_context_check:
uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main
call_u24_workflow_build_debian:
!!merge <<: *$STAGE-build-call
with:
jhub_ver: 1.4.2
py_ver: 3.9
dist: debian
codebook_base_hash: 561b765
14 changes: 14 additions & 0 deletions .github/.staging_workflows/normalize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
# For Github Action that doesn't support anchor yet...
# https://github.com/actions/runner/issues/1182

STAGE=$1
# .yaml in .staging_workflows has to be named using a prefix 'anchored_', this will be removed when normalizing
PREFIX="anchored_"
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
for source in $(ls $SCRIPT_DIR | grep yaml)
do
target=${source#$PREFIX}
export STAGE
envsubst '${STAGE}' < $SCRIPT_DIR/$source | yq e 'explode(.) | del(.anchor-*)' > $SCRIPT_DIR/../workflows/$target
done
4 changes: 4 additions & 0 deletions .github/.test/.secrets
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
RAW_DEPLOY_KEY=
GITHUB_TOKEN=
REGISTRY_USERNAME=
REGISTRY_PASSWORD=
3 changes: 3 additions & 0 deletions .github/.test/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
For local testing using act, you need to create few things:
- make a `.test/artifacts` dir for `act --artifact-server-path ./.test/artifacts/`
- make a `.test/.secrets` file similar as `.env` for `act --secret-file ./.test/.secrets`
2 changes: 2 additions & 0 deletions .github/make-dev.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
bash ./.staging_workflows/normalize.sh dev
2 changes: 2 additions & 0 deletions .github/make-prod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
bash ./.staging_workflows/normalize.sh prod
2 changes: 2 additions & 0 deletions .github/make-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
bash ./.staging_workflows/normalize.sh test
7 changes: 7 additions & 0 deletions .github/run-act.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
bash $SCRIPT_DIR/.staging_workflows/normalize.sh dev
cd ..
act -P ubuntu-latest=drewyangdev/ubuntu:act-latest \
--secret-file $SCRIPT_DIR/.test/.secrets \
--artifact-server-path $SCRIPT_DIR/.test/artifacts/
19 changes: 19 additions & 0 deletions .github/workflows/u24_workflow_before_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: u24_workflow_before_release
on:
pull_request:
push:
branches:
- '**'
tags-ignore:
- '**'
workflow_dispatch:
jobs:
call_context_check:
uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main
call_u24_workflow_build_debian:
uses: dj-sciops/djsciops-cicd/.github/workflows/u24_workflow_build.yaml@main
with:
jhub_ver: 1.4.2
py_ver: 3.9
dist: debian
codebook_base_hash: 561b765
21 changes: 21 additions & 0 deletions .github/workflows/u24_workflow_release_call.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: u24_workflow_release_call
on:
workflow_run:
workflows: ["u24_workflow_tag_to_release"]
types:
- completed
jobs:
call_context_check:
uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main
call_u24_workflow_release_debian:
if: >-
github.event.workflow_run.conclusion == 'success' && github.repository_owner == 'datajoint'
uses: dj-sciops/djsciops-cicd/.github/workflows/u24_workflow_release.yaml@main
with:
jhub_ver: 1.4.2
py_ver: 3.9
dist: debian
codebook_base_hash: 561b765
secrets:
REGISTRY_USERNAME: ${{secrets.DOCKER_USERNAME}}
REGISTRY_PASSWORD: ${{secrets.DOCKER_PASSWORD}}
16 changes: 16 additions & 0 deletions .github/workflows/u24_workflow_tag_to_release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: u24_workflow_tag_to_release
on:
push:
tags:
- '*.*.*'
- 'test*.*.*'
jobs:
call_context_check:
uses: dj-sciops/djsciops-cicd/.github/workflows/context_check.yaml@main
call_u24_workflow_build_debian:
uses: dj-sciops/djsciops-cicd/.github/workflows/u24_workflow_build.yaml@main
with:
jhub_ver: 1.4.2
py_ver: 3.9
dist: debian
codebook_base_hash: 561b765
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,5 +100,8 @@ Diagram.ipynb

# docker, vscode
.env
*.pem

# vscode
docker-compose.yml
.vscode/settings.json
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,6 @@ specific forks for tests.

+ Add - Version

[0.2.0]: https://github.com/datajoint/workflow-array-ephys/releases/tag/0.2.0
[0.2.1]: https://github.com/datajoint/workflow-array-ephys/compare/0.2.1...0.2.0
[0.2.0]: https://github.com/datajoint/workflow-array-ephys/compare/0.2.0...0.1.0
[0.1.0]: https://github.com/datajoint/workflow-array-ephys/releases/tag/0.1.0

0 comments on commit 578a8f2

Please sign in to comment.