CI #2872
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: CI | |
permissions: | |
contents: read | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- dev | |
schedule: | |
- cron: '0 0,6,12,18 * * *' | |
workflow_dispatch: | |
defaults: | |
run: | |
shell: bash --noprofile --norc -CeEuxo pipefail {0} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
tidy: | |
uses: taiki-e/github-actions/.github/workflows/tidy.yml@main | |
permissions: | |
contents: read | |
pull-requests: write # for gh pr edit --add-assignee | |
repository-projects: read # for gh pr edit --add-assignee | |
secrets: inherit | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-20.04 | |
- ubuntu-22.04 | |
- ubuntu-24.04 | |
- macos-13 | |
- macos-14 | |
- macos-15 | |
runs-on: ${{ matrix.os }} | |
timeout-minutes: 60 | |
steps: | |
- uses: taiki-e/checkout-action@v1 | |
# https://github.com/actions/runner-images/issues/6283 | |
- run: printf '/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin\n' >>"${GITHUB_PATH}" | |
if: startsWith(matrix.os, 'ubuntu') | |
- run: brew install --verbose Formula/*.rb | |
- run: brew test --verbose Formula/*.rb | |
# - run: tools/audit.sh # disable due to an upstream bug | |
formula: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
permissions: | |
contents: read | |
pull-requests: write # for gh pr review --approve | |
steps: | |
- uses: taiki-e/checkout-action@v1 | |
- run: tools/formula.sh | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- id: diff | |
run: tools/ci/formula.sh | |
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') | |
- id: create-pull-request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
title: Update formula | |
body: | | |
Auto-generated by CI using [create-pull-request](https://github.com/peter-evans/create-pull-request). | |
This will be auto-merged when CI has passed because this is an auto-generated PR in a defined format and is usually considered no additional review is required. | |
branch: update-formula | |
token: ${{ secrets.CREATE_PR_TOKEN }} | |
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' | |
- name: Enable auto-merge for auto-generated PR | |
run: gh pr merge --rebase --auto "${PR_NUMBER:?}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.CREATE_PR_TOKEN }} | |
PR_NUMBER: ${{ steps.create-pull-request.outputs.pull-request-number }} | |
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' && steps.create-pull-request.outputs.pull-request-operation == 'created' | |
- name: Auto approve for auto-generated PR | |
run: gh pr review --approve "${PR_NUMBER:?}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PR_NUMBER: ${{ steps.create-pull-request.outputs.pull-request-number }} | |
if: github.repository_owner == 'taiki-e' && (github.event_name == 'schedule' || github.event_name == 'push' && github.ref == 'refs/heads/main') && steps.diff.outputs.success == 'false' && (steps.create-pull-request.outputs.pull-request-operation == 'created' || steps.create-pull-request.outputs.pull-request-operation == 'updated') | |
- run: git add -N . && git diff --exit-code |