Skip to content

Commit

Permalink
Disable current workflow and test split workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhemstad committed May 30, 2023
1 parent b9dad11 commit 082492e
Show file tree
Hide file tree
Showing 5 changed files with 87 additions and 5 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/per_cuda.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Per CUDA version

on:
workflow_call:
inputs:
per_cuda_matrix: {type: string, required: true}

test-repo-per-cuda-ver:
uses: ./.github/workflows/test-repo-per-compiler.yml
strategy:
matrix: ${{ fromJSON(inputs.cuda_vers) }}
with:
repo: ${{ inputs.repo }}
cxx_vers: ${{ inputs.cxx_vers }}
cuda_ver: ${{ matrix.cuda_ver }}
compilers: ${{ inputs.compilers }}
10 changes: 5 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ defaults:
run:
shell: bash

on:
push:
branches:
- main
- "pull-request/[0-9]+"
#on:
# push:
# branches:
# - main
# - "pull-request/[0-9]+"

# Only runs one instance of this workflow at a time for a given PR and cancels any in-progress runs when a new one starts.
concurrency:
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/test_new_workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

# This is the main workflow that runs on every PR and push to main
name: pr_split

defaults:
run:
shell: bash

on:
push:
branches:
- main
- "pull-request/[0-9]+"

# Only runs one instance of this workflow at a time for a given PR and cancels any in-progress runs when a new one starts.
concurrency:
group: ${{ github.workflow }}-on-${{ github.event_name }}-from-${{ github.ref_name }}
cancel-in-progress: true

jobs:
compute-matrix:
runs-on: ubuntu-latest
outputs:
BUILD_MATRIX: ${{ steps.compute-matrix.outputs.BUILD_MATRIX }}
PER_CUDA_MATRIX: ${{ steps.compute-matrix.outputs.PER_CUDA_MATRIX }}
CUDA_VERSIONS: ${{ steps.compute-matrix.outputs.CUDA_VERSIONS }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Compute matrix
id: compute-matrix
run: |
cat ./ci/matrix.yaml
BUILD_MATRIX=$(yq -o=json ./ci/matrix.yaml | jq -c '[.include[] | . as $o | {std: .std[]} + del($o.std)] | {include: . }' )
echo "BUILD_MATRIX=$BUILD_MATRIX" | tee -a "$GITHUB_OUTPUT"
PER_CUDA_MATRIX=./ci/get_groups.sh $BUILD_MATRIX cuda $GITHUB_OUTPUT
CUDA_VERSIONS=$(echo $PER_CUDA_MATRIX | jq 'keys')
echo "CUDA_VERSIONS=$CUDA_VERSIONS" | tee -a "$GITHUB_OUTPUT"
thrust:
needs: compute-matrix
uses: ./.github/workflows/per_cuda.yml
strategy:
matrix: ${{ fromJSON(needs.compute-matrix.outputs.CUDA_VERSIONS) }} }}
with:
per_cuda_matrix: ${{ needs.compute-matrix.outputs.PER_CUDA_MATRIX }}
16 changes: 16 additions & 0 deletions ci/get_groups.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash

# Check if input JSON, field, and file arguments are provided
if [ "$#" -ne 3 ]; then
echo "Usage: ./get_groups.sh <input_json> <field> <output_file>"
exit 1
fi

# Assign command-line arguments to variables
input_json="$1"
field="$2"
output_file="$3"

output=$(echo $input_json | jq -c --arg field "$field" 'include "group_by_field"; .include | group_by_field($field)')
echo $output | tee -a "$output_file"

4 changes: 4 additions & 0 deletions ci/group_by_field.jq
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Groups an array of objects by a field and returns an object with the field value as key and the array of objects as value
# Handles nested fields (e.g. "compiler.name")
def group_by_field($field):
group_by(getpath($field | split("."))) | map( {(.[0] | getpath($field | split("."))): .}) | add;

0 comments on commit 082492e

Please sign in to comment.