forked from NetBSD/pkgsrc
-
Notifications
You must be signed in to change notification settings - Fork 7
167 lines (167 loc) · 5.76 KB
/
Copy pathupdate-binpkg.yml
File metadata and controls
167 lines (167 loc) · 5.76 KB
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#
# On push to trunk or manual workflow call, build touched or requested
# pkgpaths and sync the built binary packages to the BINPKG_SITES cache.
#
name: update-binpkg
on:
push:
branches:
- trunk
workflow_dispatch:
inputs:
pkgpaths:
description: 'List of package paths to build'
required: true
jobs:
what-changed:
runs-on: ubuntu-latest
outputs:
bootstrap-hash: ${{ steps.what-changed.outputs.bootstrap-hash }}
pkgbuild-files: ${{ steps.vars.outputs.pkgpaths }}
steps:
- uses: actions/checkout@v4
with:
show-progress: false
- name: Calculate changes
id: what-changed
uses: ./.github/actions/what-changed
- name: Set variables based on push or workflow call
id: vars
run: |
if [ -n "${{ inputs.pkgpaths }}" ]; then
pkgpaths="${{ inputs.pkgpaths }}"
else
pkgpaths="${{ steps.what-changed.outputs.pkgbuild-files }}"
fi
echo "pkgpaths=${pkgpaths}" >> ${GITHUB_OUTPUT}
build-native:
needs: what-changed
strategy:
fail-fast: false
matrix:
platform:
- name: macos-13-x86_64
os: macos-13
- name: macos-15-arm64
os: macos-15
- name: ubuntu-24.04-x86_64
os: ubuntu-24.04
- name: cygwin-2022-x86_64
os: windows-2022
runs-on: ${{ matrix.platform.os }}
steps:
- name: Set autocrlf
if: runner.os == 'Windows'
run: git config --global core.autocrlf input
- uses: actions/checkout@v4
- name: Check for cached bootstrap kit
id: bootstrap-kit
uses: actions/cache@v4
with:
key: bootstrap-kit-${{ matrix.platform.name }}-${{ needs.what-changed.outputs.bootstrap-hash }}
# Must live in checkout dir due to actions/cache limitations.
path: bootstrap.tar
- name: Install Cygwin
uses: egor-tensin/setup-cygwin@v4
if: runner.os == 'Windows'
with:
packages: gcc-g++
- name: Configure SSH
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.CI_SSH_KEY }}
known_hosts: ${{ secrets.CI_KNOWN_HOSTS }}
- name: Bootstrap if required
if: steps.bootstrap-kit.outputs.cache-hit != 'true'
shell: bash
run: ./.github/scripts/bootstrap.sh
- name: Build requested packages
uses: ./.github/actions/pkgbuild
with:
platform: ${{ matrix.platform.name }}
pkgbuild-files: ${{ needs.what-changed.outputs.pkgbuild-files }}
binpkg-sites: http://cipkg.dreckly.dev/packages/${{ matrix.platform.name }}
- name: Upload packages
if: always()
shell: bash
env:
CI_SSH_USER: ${{ secrets.CI_SSH_USER }}
CI_SSH_HOST: ${{ secrets.CI_SSH_HOST }}
CI_REMOTE_DIR: ${{ secrets.CI_PACKAGE_DIR }}/${{ matrix.platform.name }}/
run: ./.github/scripts/upload.sh
jenkins:
needs: what-changed
uses: ./.github/workflows/jenkins.yml
with:
bootstrap-hash: ${{ needs.what-changed.outputs.bootstrap-hash }}
github-sha: ${{ github.sha }}
pkgbuild-files: ${{ needs.what-changed.outputs.pkgbuild-files }}
upload-pkgs: true
secrets:
CI_JENKINS_TRIGGER_URL: ${{ secrets.CI_JENKINS_TRIGGER_URL }}
CI_JENKINS_TOKEN: ${{ secrets.CI_JENKINS_TOKEN }}
CI_PACKAGE_DIR: ${{ secrets.CI_PACKAGE_DIR }}
CI_SSH_HOST: ${{ secrets.CI_SSH_HOST }}
CI_SSH_USER: ${{ secrets.CI_SSH_USER }}
build-qemu:
needs: what-changed
strategy:
fail-fast: false
matrix:
platform:
- name: freebsd-14.2-x86_64
os: freebsd
arch: x86-64
version: '14.2'
- name: openbsd-7.6-x86_64
os: openbsd
arch: x86-64
version: '7.6'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure SSH
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.CI_SSH_KEY }}
known_hosts: ${{ secrets.CI_KNOWN_HOSTS }}
- name: Check for cached bootstrap kit
id: bootstrap-kit
uses: actions/cache@v4
with:
key: bootstrap-kit-${{ matrix.platform.name }}-${{ needs.what-changed.outputs.bootstrap-hash }}
# Must live in checkout dir due to actions/cache limitations.
path: bootstrap.tar
# Note that this action can only be called once in the same job, so we
# need to do everything in one go.
- name: Run jobs inside VM
uses: cross-platform-actions/action@v0.27.0
env:
RUN_BOOTSTRAP: ${{ steps.bootstrap-kit.outputs.cache-hit != 'true' }}
BINPKG_SITES: http://cipkg.dreckly.dev/packages/${{ matrix.platform.name }}
PKGBUILD_FILES: ${{ needs.what-changed.outputs.pkgbuild-files }}
with:
environment_variables: RUN_BOOTSTRAP BINPKG_SITES PKGBUILD_FILES
operating_system: ${{ matrix.platform.os }}
architecture: ${{ matrix.platform.arch }}
version: ${{ matrix.platform.version }}
cpu_count: 4
shell: bash
run: |
if ${RUN_BOOTSTRAP}; then
.github/scripts/bootstrap.sh
fi
.github/scripts/pkgbuild.sh
- name: Archive build logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: build-logs-${{ matrix.platform.name }}
path: wrkdir
- name: Upload packages
if: always()
env:
CI_SSH_USER: ${{ secrets.CI_SSH_USER }}
CI_SSH_HOST: ${{ secrets.CI_SSH_HOST }}
CI_REMOTE_DIR: ${{ secrets.CI_PACKAGE_DIR }}/${{ matrix.platform.name }}/
run: ./.github/scripts/upload.sh