Skip to content

removed unnecessary code #1

removed unnecessary code

removed unnecessary code #1

name: dependent-rake
on:
workflow_call:
inputs:
repos-json-file:
description: json file with array of gems to test
type: string
default: .github/workflows/dependent-repos.json
command:
description: test command for dependent gem
type: string
default: bundle exec rake
matrix_os:
description: define the operating systems on which to execute jobs
type: string
jobs:
build-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.build-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: build-matrix
run: |
wget https://raw.githubusercontent.com/metanorma/ci/main/.github/workflows/ruby-matrix.json
# remove 'middle' & 'experimental' versions
echo "$(jq 'del(.ruby[1, 2])' ruby-matrix.json)" > ruby-matrix.json
if [ -n "${{ inputs.matrix_os }}" ]; then
echo "$(jq '.os = ${{inputs.matrix_os}}' ruby-matrix.json)" > ruby-matrix.json
fi
echo "matrix=$(jq -s add ${{ inputs.repos-json-file }} ruby-matrix.json | tr '\n' ' ')" >> $GITHUB_OUTPUT
rake:

Check failure on line 36 in .github/workflows/dependent-rake.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/dependent-rake.yml

Invalid workflow file

You have an error in your yaml syntax on line 36
name: ${{ matrix.repo }} ${{ matrix.ruby.version }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs:
- build-matrix
concurrency:
group: '${{ matrix.repo }}-${{ matrix.os }}-${{ matrix.ruby.version }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true
continue-on-error: ${{ matrix.experimental || matrix.ruby.experimental }}
strategy:
max-parallel: 10
fail-fast: false
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: actions/checkout@v4
with:
submodules: recursive
repository: ${{ matrix.repo }}
path: dependent
fetch-depth: 1
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby.version }}
rubygems: ${{ matrix.ruby.rubygems }}
bundler-cache: true
working-directory: dependent
- name: Replace rubygems's gem with git's one
shell: python
run: |
import fileinput
import glob
import sys
import os
gem_name = '${{ github.event.repository.name }}'
if glob.glob('*.gemspec'):
gemspec = glob.glob('*.gemspec')[0]
with fileinput.FileInput(gemspec, inplace=True) as file:
for line in file:
if gem_name not in line:
print(line, end='')
print("'{}' removed from {}".format(gem_name, gemspec))
if os.path.exists("Gemfile.lock"):
os.remove("Gemfile.lock")
print("Gemfile.lock dropped")
print("> git diff")
sys.stdout.flush()
os.system("git diff")
print("> bundle add {} --path ..".format(gem_name))
sys.stdout.flush()
os.system("bundle add {} --path ..".format(gem_name))
working-directory: dependent
- run: ${{ inputs.command }}
working-directory: dependent