Skip to content

Commit

Permalink
Merge branch 'update-viash-0.9' into feature/no-ref/update-dataset-lo…
Browse files Browse the repository at this point in the history
…aders
  • Loading branch information
rcannood authored Oct 18, 2024
2 parents 9f64edd + 8f49337 commit ea5f512
Show file tree
Hide file tree
Showing 511 changed files with 198 additions and 28,285 deletions.
125 changes: 10 additions & 115 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,121 +6,16 @@ on:
workflow_dispatch:
inputs:
version:
description: Version tag
required: true
description: |
The version of the project to build. Example: `1.0.3`.
If not provided, a development build with a version name
based on the branch name will be built. Otherwise, a release
build with the provided version will be built.
required: false

jobs:
# phase 1
list:
runs-on: ubuntu-latest

outputs:
target_branch: ${{ steps.variables.outputs.target_branch }}
version: ${{ steps.variables.outputs.version }}
docker_matrix: ${{ steps.ns_list_docker.outputs.output_matrix }}

steps:
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0

- uses: viash-io/viash-actions/setup@v6

- name: Determine variables
id: variables
run: |
VERSION="${{ inputs.version }}"
SOURCE_BRANCH=$(echo "$GITHUB_REF" | sed 's/refs\/heads\///')
if [[ -z $VERSION ]]; then
TARGET_BRANCH="build/$SOURCE_BRANCH"
VERSION=$(echo "$TARGET_BRANCH" | sed 's/[^a-zA-Z0-9_]/_/g')
else
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
echo "Version '$VERSION' does not match PEP440"
exit 1
fi
TARGET_BRANCH="release/${VERSION%.*}.x"
fi
echo "Set version of Viash package to '$VERSION'"
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Set target branch to '$TARGET_BRANCH'"
echo "target_branch=$TARGET_BRANCH" >> $GITHUB_OUTPUT
- name: Remove target folder from .gitignore
run: |
# allow publishing the target folder
sed -i 's#^/target/$##g' .gitignore
- uses: viash-io/viash-actions/ns-build@v6
with:
config_mod: .functionality.version := '${{ steps.variables.outputs.version }}'
parallel: true

- name: Deploy to target branch
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .
publish_branch: ${{ steps.variables.outputs.target_branch }}

- id: ns_list_docker
uses: viash-io/viash-actions/ns-list@v6
with:
platform: docker
src: src
format: json

# phase 2
build:
needs: list

runs-on: ubuntu-latest

permissions:
contents: read
packages: write

strategy:
fail-fast: false
matrix:
component: ${{ fromJson(needs.list.outputs.docker_matrix) }}

steps:
# Remove unnecessary files to free up space. Otherwise, we get 'no space left on device.'
- uses: data-intuitive/reclaim-the-bytes@v2

- uses: actions/checkout@v4
with:
submodules: 'recursive'
fetch-depth: 0
ref: ${{ needs.list.outputs.target_branch }}

- uses: viash-io/viash-actions/setup@v6

- name: Build container
uses: viash-io/viash-actions/ns-build@v6
with:
config_mod: .functionality.version := '${{ needs.list.outputs.version }}'
platform: docker
src: ${{ matrix.component.dir }}
setup: build

- name: Login to container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push container
uses: viash-io/viash-actions/ns-build@v6
with:
config_mod: .functionality.version := '${{ needs.list.outputs.version }}'
platform: docker
src: ${{ matrix.component.dir }}
setup: push
uses: viash-io/viash-actions/.github/workflows/build.yaml@v6
with:
version: ${{ github.event.inputs.version }}
87 changes: 5 additions & 82 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,88 +1,11 @@
name: Test

on:
pull_request:
push:
branches: [ main ]
branches:
- main
pull_request:

jobs:

# phase 1
list:
env:
s3_bucket: s3://openproblems-data/resources_test/
runs-on: ubuntu-latest

outputs:
matrix: ${{ steps.set_matrix.outputs.matrix }}
cache_key: ${{ steps.cache.outputs.cache_key }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: viash-io/viash-actions/setup@v6

- uses: viash-io/viash-actions/project/sync-and-cache-s3@v6
id: cache
with:
s3_bucket: $s3_bucket
dest_path: resources_test
cache_key_prefix: resources_test__

- id: ns_list
uses: viash-io/viash-actions/ns-list@v6
with:
platform: docker
format: json

- id: ns_list_filtered
uses: viash-io/viash-actions/project/detect-changed-components@v6
with:
input_file: "${{ steps.ns_list.outputs.output_file }}"

- id: set_matrix
run: |
echo "matrix=$(jq -c '[ .[] |
{
"name": (.functionality.namespace + "/" + .functionality.name),
"config": .info.config
}
]' ${{ steps.ns_list_filtered.outputs.output_file }} )" >> $GITHUB_OUTPUT
# phase 2
viash_test:
needs: list
if: ${{ needs.list.outputs.matrix != '[]' && needs.list.outputs.matrix != '' }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
component: ${{ fromJson(needs.list.outputs.matrix) }}

steps:
# Remove unnecessary files to free up space. Otherwise, we get 'no space left on device.'
- uses: data-intuitive/reclaim-the-bytes@v2

- uses: actions/checkout@v4

- uses: viash-io/viash-actions/setup@v6

# use cache
- name: Cache resources data
uses: actions/cache@v4
timeout-minutes: 10
with:
path: resources_test
key: ${{ needs.list.outputs.cache_key }}

- name: Run test
timeout-minutes: 30
run: |
VIASH_TEMP=$RUNNER_TEMP/viash viash test \
"${{ matrix.component.config }}" \
--cpus 2 \
--memory "5gb"
test:
uses: viash-io/viash-actions/.github/workflows/test.yaml@v6
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "common"]
path = common
url = https://github.com/openproblems-bio/common_resources.git
Loading

0 comments on commit ea5f512

Please sign in to comment.