Merge pull request #1489 from SachinSahu431/update-go-yml

ci: Remove hardcoded supported Go versions from go.yml
This commit is contained in:
Arthur Silva Sens 2024-04-02 10:24:04 -03:00 committed by GitHub
commit e3bea8af78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 1 deletions

View File

@ -12,13 +12,29 @@ permissions:
contents: read
jobs:
supportedVersions:
name: Fetch supported Go versions
runs-on: ubuntu-latest
outputs:
supported_versions: ${{ steps.matrix.outputs.supported_versions }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Read supported_go_versions.txt
id: matrix
run: |
versions=$(cat supported_go_versions.txt)
matrix="[$(echo "$versions" | sed 's/\(.*\)/"\1"/' | paste -s -d,)]"
echo "supported_versions=$matrix" >> $GITHUB_OUTPUT
test:
name: Tests
runs-on: ubuntu-latest
needs: supportedVersions
strategy:
matrix:
go_version: ["1.20", "1.21", "1.22"]
go_version: ${{ fromJSON(needs.supportedVersions.outputs.supported_versions) }}
steps:
- name: Checkout code