-
-
Notifications
You must be signed in to change notification settings - Fork 4
132 lines (124 loc) · 4.81 KB
/
ci.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: CI
permissions:
contents: read
on:
pull_request:
push:
branches:
- main
- dev
tags:
- '[0-9]+-[0-9]+-[0-9]+'
schedule:
- cron: '0 2 * * 5'
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
build:
needs: tidy
strategy:
fail-fast: false
matrix:
include:
- target: linux-gnu
- target: linux-gnu
os: ubuntu-24.04-arm
- target: linux-musl
- target: linux-musl
os: ubuntu-24.04-arm
- target: linux-uclibc
- target: android
- target: freebsd
- target: netbsd
- target: openbsd
- target: dragonfly
# TODO: undefined reference to `__sysconf_xpg7'/'__xnet7_socket'
# - target: solaris
- target: illumos
- target: redox
# - target: fuchsia
- target: wasi
- target: wasi
os: ubuntu-24.04-arm
- target: emscripten
- target: emscripten
os: ubuntu-24.04-arm
- target: windows-gnu
- target: windows-gnu
os: ubuntu-24.04-arm
- target: none
- target: none
os: ubuntu-24.04-arm
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
timeout-minutes: 150
permissions:
contents: read
packages: write # for push to ghcr
steps:
- uses: taiki-e/checkout-action@v1
- uses: taiki-e/github-actions/free-device-space@main
- uses: taiki-e/github-actions/setup-docker@main
with:
qemu: false
- run: |
docker login ghcr.io -u "${{ github.actor }}" --password-stdin <<<"${{ secrets.GITHUB_TOKEN }}"
printf 'PUSH_TO_GHCR=1\n' >>"${GITHUB_ENV}"
if: github.repository_owner == 'taiki-e' && (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
- run: tools/build-docker.sh "${{ matrix.target }}"
manifest:
if: github.repository_owner == 'taiki-e' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
needs: build
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
packages: write # for push to ghcr
steps:
- uses: taiki-e/checkout-action@v1
- run: |
docker login ghcr.io -u "${{ github.actor }}" --password-stdin <<<"${{ secrets.GITHUB_TOKEN }}"
printf 'PUSH_TO_GHCR=1\n' >>"${GITHUB_ENV}"
if: github.repository_owner == 'taiki-e' && (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')) || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule')
- run: tools/docker-manifest.sh
codegen:
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
pull-requests: write # for gh pr edit --add-assignee
repository-projects: read # for gh pr edit --add-assignee
steps:
- uses: taiki-e/checkout-action@v1
- uses: taiki-e/github-actions/install-rust@nightly
- run: tools/gen.sh
- id: diff
run: tools/ci/gen.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 generated code
body: |
Auto-generated by CI using [create-pull-request](https://github.com/peter-evans/create-pull-request).
branch: update-generated-code
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: Notify PR author by assigning PR
run: gh pr edit --add-assignee taiki-e "${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'
- run: git add -N . && git diff --exit-code