-
Notifications
You must be signed in to change notification settings - Fork 385
54 lines (47 loc) · 1.55 KB
/
contribs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Contribs
on:
push:
branches:
- master
pull_request:
paths:
- contribs/**
workflow_dispatch:
jobs:
setup:
runs-on: ubuntu-latest
outputs:
programs: ${{ steps.set-matrix.outputs.programs }}
go-versions: ${{ steps.get-go-versions.outputs.go-versions }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
run: |
echo "::set-output name=programs::$(ls -d contribs/*/ | cut -d/ -f2 | jq -R -s -c 'split("\n")[:-1]')"
- id: get-go-versions
run: |
contribs_programs=$(ls -d contribs/*/ | cut -d/ -f2)
versions_map="{"
for p in $contribs_programs; do
# Fetch the go version of the contribs entry, and save it
# to a versions map we can reference later in the workflow
go_version=$(grep "^go [0-9]" contribs/$p/go.mod | cut -d ' ' -f2)
versions_map="$versions_map\"$p\":\"$go_version\","
done
# Close out the JSON
versions_map="${versions_map%,}"
versions_map="$versions_map}"
echo "::set-output name=go-versions::$versions_map"
main:
needs: setup
strategy:
fail-fast: false
matrix:
program: ${{ fromJson(needs.setup.outputs.programs) }}
name: Run Main
uses: ./.github/workflows/main_template.yml
with:
modulepath: contribs/${{ matrix.program }}
go-version: ${{ (fromJson(needs.setup.outputs.go-versions))[matrix.program] }}
secrets:
codecov-token: ${{ secrets.CODECOV_TOKEN }}