Skip to content

Quick Hit Lab for CMX (initial skeleton) (#314) #155

Quick Hit Lab for CMX (initial skeleton) (#314)

Quick Hit Lab for CMX (initial skeleton) (#314) #155

##############################################################################
# Instruqt Github Actions Workflow
#
# This workflow file and its actions will run a validate/push/test cycle on
# one or more Instruqt tracks directories in your repo. Each job targets a
# separate directory of tracks. All the tracks in each directory must belong
# to the same organization.
#
##############################################################################
name: instruqt-production
env:
# Set these values to match your environment. Your token should be
# stored as a Github secret in your tracks repo. Also make sure you
# have a track-slugs.yml file in your tracks directory.
TRACK_DIR: instruqt
INSTRUQT_TOKEN: ${{ secrets.INSTRUQT_TOKEN }}
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
push:
branches:
- main
paths:
- 'instruqt/**'
workflow_dispatch:
jobs:
GetTrackSlugs:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Install yq Package
uses: ./.github/actions/install-yq
# Needed for first commit of repository
- name: Check if track-slugs.yml exists
id: check_slugs
uses: andstor/file-existence-action@v1
with:
files: "${{ env.TRACK_DIR }}/track-slugs.yml"
- name: Create Matrix Data
run: echo "TRACKS=$(yq -o j $TRACK_DIR/track-slugs.yml | jq tostring | sed -e 's/^"//' -e 's/"$//')" >> $GITHUB_ENV
if: steps.check_slugs.outputs.files_exists == 'true'
- id: set-matrix
run: echo "::set-output name=matrix::${{ env.TRACKS }}"
if: steps.check_slugs.outputs.files_exists == 'true'
outputs:
slugs: ${{ steps.check_slugs.outputs.files_exists }}
matrix: ${{ steps.set-matrix.outputs.matrix }}
TestProdTracks:
runs-on: ubuntu-latest
if: ${{ needs.GetTrackSlugs.outputs.matrix != '[]' && needs.GetTrackSlugs.outputs.matrix != '' }}
needs: GetTrackSlugs
strategy:
matrix: ${{ fromJson(needs.GetTrackSlugs.outputs.matrix) }}
steps:
- name: Check out repository code
uses: actions/checkout@v3
# This step checks for the "no-ci" tag on a track
# If the tag is not present, this step succeeds
- name: Check CI
id: check-ci
uses: ./.github/actions/track-tags
with:
id: ${{ matrix.tracks.id }}
continue-on-error: true
- name: Track Validate
uses: ./.github/actions/track-validate
with:
path: ${{ env.TRACK_DIR }}/${{ matrix.tracks.slug }}
if: steps.check-ci.outcome == 'success'
- name: Track Push
uses: ./.github/actions/track-push
with:
path: ${{ env.TRACK_DIR }}/${{ matrix.tracks.slug }}
if: steps.check-ci.outcome == 'success'
- name: Instruqt Track Test
uses: ./.github/actions/track-test
with:
path: ${{ env.TRACK_DIR }}/${{ matrix.tracks.slug }}
if: steps.check-ci.outcome == 'success'