Skip to content

Commit 90654f3

Browse files
authored
31 fix cidi pipeline (#47)
* Added: extra & missing cicd packages * - Changed: updated pre-commit-config & fix: correct file permissions * fix: cicd to build image and push to the `ghcr.io` * bugfix: missing keyword * Add: added allowance for development branch * Fixes * Changed: removed condition * fixed: branch ref * remove: removed development branch specifics * Readme update
1 parent 4e1825a commit 90654f3

File tree

12 files changed

+406
-93
lines changed

12 files changed

+406
-93
lines changed

.dockerignore

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configs
22
data
33
experiments
4-
venv
4+
venv

.github/workflows/docker-image.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Create and publish a Docker image
2+
3+
# Configures this workflow to run every time a change is pushed to the branch called `release`.
4+
on:
5+
push:
6+
branches: [ "dev"]
7+
pull_request_target:
8+
types:
9+
- closed
10+
branches: [ "main","dev" ]
11+
12+
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
13+
env:
14+
REGISTRY: ghcr.io
15+
IMAGE_NAME: ${{ github.repository }}
16+
17+
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
18+
jobs:
19+
build-and-push-image:
20+
if: ${{ (github.event.pull_request.merged == true) || (github.ref_name == 'dev') }}
21+
runs-on: ubuntu-latest
22+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
23+
permissions:
24+
contents: read
25+
packages: write
26+
attestations: write
27+
id-token: write
28+
29+
steps:
30+
# Check out branch
31+
- name: Checkout repository
32+
uses: actions/checkout@v4
33+
34+
#js: read version
35+
- name: set VER
36+
run: echo "VER=$(awk -F \" '/version/ {print $2 }' pyproject.toml)" >> $GITHUB_ENV
37+
38+
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
39+
- name: Log in to the Container registry
40+
uses: docker/login-action@v3
41+
with:
42+
registry: ${{ env.REGISTRY }}
43+
username: ${{ github.actor }}
44+
password: ${{ secrets.GITHUB_TOKEN }}
45+
46+
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
47+
- name: Extract metadata (tags, labels) for Docker
48+
id: meta
49+
uses: docker/metadata-action@v5
50+
with:
51+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
52+
tags: |
53+
type=raw,value=latest,enable=${{ github.base_ref == 'main' }}
54+
type=semver,pattern={{version}},value=${{ env.VER }},enable=${{ github.base_ref == 'main' }}
55+
type=raw,value=dev,enable=${{ (github.base_ref == 'dev') || (github.ref_name == 'dev') }}
56+
57+
# js: added in for multi arch building
58+
- name: Set up QEMU
59+
uses: docker/setup-qemu-action@v3
60+
61+
- name: Set up Docker Buildx
62+
uses: docker/setup-buildx-action@v3
63+
64+
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
65+
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see [Usage](https://github.com/docker/build-push-action#usage) in the README of the `docker/build-push-action` repository.
66+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
67+
- name: Build and push Docker image
68+
id: push
69+
uses: docker/build-push-action@v6
70+
with:
71+
platforms: linux/amd64,linux/arm64 #js: added for multi arch building
72+
context: .
73+
push: true
74+
tags: ${{ steps.meta.outputs.tags }}
75+
labels: ${{ steps.meta.outputs.labels }}
76+
77+
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see [Using artifact attestations to establish provenance for builds](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds).
78+
- name: Generate artifact attestation
79+
uses: actions/attest-build-provenance@v2
80+
with:
81+
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
82+
subject-digest: ${{ steps.push.outputs.digest }}
83+
push-to-registry: true

.gitignore

100755100644
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ playground*.ipynb
1616
coverage.xml
1717
.coverage
1818
ao-env
19-
dev_scripts
19+
dev_scripts

.pre-commit-config.yaml

100755100644
Lines changed: 44 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: check-ast
6+
- id: check-docstring-first
7+
- id: check-executables-have-shebangs
8+
- id: check-json
9+
- id: check-yaml
10+
- id: check-toml
11+
- id: end-of-file-fixer
12+
- id: trailing-whitespace
13+
- id: mixed-line-ending
14+
- id: name-tests-test
15+
args: [--pytest-test-first]
16+
- id: pretty-format-json
17+
args: [--autofix]
218
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.0.289 # Ruff version.
19+
rev: v0.12.7
420
hooks:
521
- id: ruff
622
args:
@@ -12,19 +28,39 @@ repos:
1228
--ignore=E501,
1329
--ignore=F401,
1430
]
15-
- repo: https://github.com/psf/black
16-
rev: de65741b8d49d78fa2675ef79b799cd35e92e7c1
31+
- repo: https://github.com/shellcheck-py/shellcheck-py
32+
rev: v0.10.0.1
33+
hooks:
34+
- id: shellcheck
35+
- repo: https://github.com/pycqa/pydocstyle
36+
rev: 6.3.0
1737
hooks:
18-
- id: black
19-
language_version: python3.9
20-
args: [--line-length=120]
21-
38+
- id: pydocstyle
39+
args:
40+
- --ignore=D203,D213,D401,D413
41+
# - repo: local
42+
# hooks:
43+
# - id: pdoc
44+
# name: pdoc
45+
# language: system
46+
# pass_filenames: false
47+
# entry: poetry run pdoc --html -f autoxai4omics -o docs
48+
# TODO: Include when/if hook is extended to check .toml files
49+
# - repo: https://github.com/pivotal/LicenseFinder
50+
# rev: v7.1.0
51+
# hooks:
52+
# - id: license-finder
53+
# - repo: https://github.com/PyCQA/bandit
54+
# rev: "1.7.9"
55+
# hooks:
56+
# - id: bandit
57+
# args: ["--exclude", "tests"]
2258
- repo: https://github.com/ibm/detect-secrets
2359
# If you desire to use a specific version of detect-secrets, you can replace `master` with other git revisions such as branch, tag or commit sha.
2460
# You are encouraged to use static refs such as tags, instead of branch name
2561
#
2662
# Running "pre-commit autoupdate" automatically updates rev to latest tag
27-
rev: 0.13.1+ibm.61.dss
63+
rev: 0.13.1+ibm.62.dss
2864
hooks:
2965
- id: detect-secrets # pragma: whitelist secret
3066
# Add options for detect-secrets-hook binary. You can run `detect-secrets-hook --help` to list out all possible options.

.travis.yml

100755100644
File mode changed.

CHANGELOG.md

100755100644
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<!--
22
Copyright 2024 IBM Corp.
3-
3+
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
7-
7+
88
http://www.apache.org/licenses/LICENSE-2.0
9-
9+
1010
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,
1212
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,17 +24,21 @@ Change log for the codebase. Initialised from the developments following version
2424

2525
- Added: test case for variance threshold
2626
- Added: `.env' file to set some required env vars
27+
- Added: extra & missing cicd packages
2728

2829
### Changed
2930

3031
- changed: dockerfile to only install main dependencies
3132
- changed: streamlined imports
3233
- changed: updated as many packages as possible
34+
- Changed: updated pre-commit-config
3335

3436
### Fixed
3537

3638
- fix: omic path parsing bug
3739
- fix: plotting bug arising from api change
40+
- fix: correct file permissions
41+
- fix: cicd to build image and push to the `ghcr.io`
3842

3943
### Security
4044

DEV_MANUAL.md

100755100644
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<!--
22
Copyright 2024 IBM Corp.
3-
3+
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
7-
7+
88
http://www.apache.org/licenses/LICENSE-2.0
9-
9+
1010
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,
1212
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

Dockerfile

100755100644
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Copyright 2024 IBM Corp.
2-
#
2+
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
55
# You may obtain a copy of the License at
6-
#
6+
#
77
# http://www.apache.org/licenses/LICENSE-2.0
8-
#
8+
#
99
# Unless required by applicable law or agreed to in writing, software
1010
# distributed under the License is distributed on an "AS IS" BASIS,
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -36,6 +36,6 @@ COPY --chown=omicsuser:0 autoxai4omics .
3636

3737
RUN poetry env use system
3838
RUN poetry install --no-root --only main
39-
USER omicsuser
39+
USER omicsuser
4040

41-
CMD ["$@"]
41+
CMD ["$@"]

README.md

100755100644
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<!--
22
Copyright 2024 IBM Corp.
3-
3+
44
Licensed under the Apache License, Version 2.0 (the "License");
55
you may not use this file except in compliance with the License.
66
You may obtain a copy of the License at
7-
7+
88
http://www.apache.org/licenses/LICENSE-2.0
9-
9+
1010
Unless required by applicable law or agreed to in writing, software
1111
distributed under the License is distributed on an "AS IS" BASIS,
1212
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -49,9 +49,11 @@ AutoXAI4Omics is a command line automated explainable AI tool that easily enable
4949
3. Make the experiments folder accessaible by running the following the directory where the experiment directory exists:
5050

5151
```shell
52-
chmod 777 -R experiments
52+
chmod 777 -R experiments
5353
```
5454

55+
*note* If you dont wish to build the image you can pull the image from the [github container regristry, found here](https://github.com/IBM/AutoXAI4Omics/pkgs/container/autoxai4omics)
56+
5557
## Citation
5658

5759
For citation of this tool, please reference this article:
@@ -101,7 +103,7 @@ Data to be used by AutoXAI4Omics needs to be stored in the `AutoXAI4Omics/data`
101103
* `./autoxai4omics.sh -m bash -r`
102104

103105
* AutoXAI4Omics has a config duplication function (for when you wish to run the same config over multiple datasets). To use this you need to build the image and the run it in `bash` mode. Once there you can then run:
104-
106+
105107
```shell
106108
python mode_config_duplicate.py -c SUBPATH_TO_TEMPLATE_CONFIG -d DATA_SUBDIR
107109
```

0 commit comments

Comments
 (0)