From e470118ba769747b6e3426b14b58afbc72efc657 Mon Sep 17 00:00:00 2001 From: Misha Brukman Date: Sat, 17 Aug 2024 20:20:34 -0400 Subject: [PATCH] Split GitHub Actions into Python and Go This will let us trigger them separately based on modified files. --- .github/workflows/go.yaml | 57 +++++++++++++++++++++ .github/workflows/{main.yml => python.yaml} | 30 +---------- README.md | 9 ++-- 3 files changed, 65 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/go.yaml rename .github/workflows/{main.yml => python.yaml} (76%) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml new file mode 100644 index 0000000..8a30955 --- /dev/null +++ b/.github/workflows/go.yaml @@ -0,0 +1,57 @@ +# Copyright 2021 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +name: "Go" + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + schedule: + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule + # + # ┌───────────── minute (0 - 59) + # │ ┌───────────── hour (0 - 23) + # │ │ ┌───────────── day of the month (1 - 31) + # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) + # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) + # │ │ │ │ │ + - cron: '1 2 3 * *' # run at 2:01 every month on the 3rd day + +jobs: + build-test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ 'ubuntu-24.04', 'ubuntu-22.04', 'macos-13', 'macos-12' ] + go: [ '1.18', '1.17', '1.16', '1.15', '1.14', '1.13', '1.12' ] + name: Go ${{ matrix.go }} (${{ matrix.os }}) + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: ${{ matrix.go }} + + - name: Build binaries + run: make go-build VERBOSE=1 + + - name: Run tests + run: make go-test VERBOSE=1 + + - name: Regenerate test outputs + run: make regen diff --git a/.github/workflows/main.yml b/.github/workflows/python.yaml similarity index 76% rename from .github/workflows/main.yml rename to .github/workflows/python.yaml index fb32d59..33efe81 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/python.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -name: "Build & test" +name: "Python" on: push: @@ -31,8 +31,7 @@ on: - cron: '1 2 3 * *' # run at 2:01 every month on the 3rd day jobs: - - python-build-test: + build-test: runs-on: ${{ matrix.os }} strategy: matrix: @@ -60,28 +59,3 @@ jobs: - name: Run tests run: make py-test VERBOSE=1 - - go-build-test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ 'ubuntu-24.04', 'ubuntu-22.04', 'macos-13', 'macos-12' ] - go: [ '1.18', '1.17', '1.16', '1.15', '1.14', '1.13', '1.12' ] - name: Go ${{ matrix.go }} (${{ matrix.os }}) - steps: - - name: Checkout repo - uses: actions/checkout@v4 - - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: ${{ matrix.go }} - - - name: Build binaries - run: make go-build VERBOSE=1 - - - name: Run tests - run: make go-test VERBOSE=1 - - - name: Regenerate test outputs - run: make regen diff --git a/README.md b/README.md index c627275..6adfcbf 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,13 @@ # yaml2json -[![Build Status][github-ci-badge]][github-ci-url] +[![Python build status][github-python-ci-badge]][github-python-ci-url] +[![Go build status][github-go-ci-badge]][github-go-ci-url] [![Go Report Card][go-report-card-badge]][go-report-card-url] -[github-ci-badge]: https://github.com/mbrukman/yaml2json/actions/workflows/main.yml/badge.svg -[github-ci-url]: https://github.com/mbrukman/yaml2json/actions/workflows/main.yml +[github-python-ci-badge]: https://github.com/mbrukman/yaml2json/actions/workflows/python.yaml/badge.svg?query=branch%3Amain +[github-python-ci-url]: https://github.com/mbrukman/yaml2json/actions/workflows/python.yaml?query=branch%3Amain +[github-go-ci-badge]: https://github-go.com/mbrukman/yaml2json/actions/workflows/go.yaml/badge.svg?query=branch%3Amain +[github-go-ci-url]: https://github-go.com/mbrukman/yaml2json/actions/workflows/go.yaml?query=branch%3Amain [go-report-card-badge]: https://goreportcard.com/badge/github.com/mbrukman/yaml2json [go-report-card-url]: https://goreportcard.com/report/github.com/mbrukman/yaml2json