Generate #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate | |
on: workflow_dispatch | |
jobs: | |
fetch_golang: | |
name: Fetch Golang git repo | |
runs-on: ubuntu-latest | |
outputs: | |
go_versions: ${{steps.get_versions.outputs.go_versions}} | |
key: ${{ steps.get_version.outputs.num_versions }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: get_version | |
run: printf 'num_versions=%s\n' $(./golang_num_versions.sh) | tee -a "$GITHUB_OUTPUT" | |
- id: cache_golang | |
uses: actions/cache@v3 | |
with: | |
path: go | |
key: ${{ steps.get_version.outputs.num_versions }} | |
- name: Fetch Golang | |
if: steps.cache_golang.outputs.cache-hit != 'true' | |
run: git clone https://github.com/golang/go | |
- id: get_versions | |
run: printf 'go_versions=%s\n' $(git -C go tag | grep -vE '(weekly|release|beta|rc)' | sort -V | grep -A 999 go1.14 | jq -Rsc 'split("\n") | .[:-1]') | tee -a "$GITHUB_OUTPUT" | |
build: | |
name: Build data files | |
runs-on: ubuntu-latest | |
needs: fetch_golang | |
strategy: | |
matrix: | |
go_version: ${{ fromJson(needs.fetch_golang.outputs.go_versions) }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v4 | |
with: | |
cache-dependency-path: go.sum | |
go-version: ">=1.21" | |
- uses: actions/cache@v3 | |
with: | |
path: go | |
key: ${{ needs.fetch_golang.outputs.key }} | |
- run: env go_dir=$(realpath go) tag=${{ matrix.go_version }} ./gen.sh | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.go_version }}.json | |
path: results/${{ matrix.go_version }}.json | |
retention-days: 1 | |
dedup: | |
name: Deduplicate data files | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/[email protected] | |
with: | |
path: artifacts | |
- run: mv artifacts/*/* results | |
- run: rmdir artifacts/* | |
- run: ./dedup.py | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: deduped | |
path: artifacts/ |