feature/supportMultipleArchitectures
This commit is contained in:
parent
b49f96f8a8
commit
e1e494382a
13
action.yml
13
action.yml
|
@ -12,10 +12,19 @@ inputs:
|
||||||
description: Directory where build artifacts will be placed, relative to workspace
|
description: Directory where build artifacts will be placed, relative to workspace
|
||||||
required: false
|
required: false
|
||||||
default: ./
|
default: ./
|
||||||
target_architecture:
|
target_architectures:
|
||||||
description: Target architecture of Debian package to build
|
description: Target architecture of Debian package to build
|
||||||
required: false
|
required: false
|
||||||
default: "armhf"
|
default: []
|
||||||
|
dpkg_buildpackage_opts:
|
||||||
|
description: Options list provided to 'dpkg-buildpackage' as command line parameters (note that '-a' is automatically provided for target architectures specified by target_architectures)
|
||||||
|
required: false
|
||||||
|
default: [ "--no-sign", "-d" ]
|
||||||
|
lintian_opts:
|
||||||
|
description: Options list provided to 'lintian' as command line parameters
|
||||||
|
required: false
|
||||||
|
default: []
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: node12
|
using: node12
|
||||||
main: main.js
|
main: main.js
|
||||||
|
|
140
main.js
140
main.js
|
@ -22,11 +22,22 @@ async function getOS(distribution) {
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
try {
|
try {
|
||||||
const targetArchitecture = core.getInput("target_architecture") || "armhf"
|
const targetArchitectures = core.getInput("target_architectures") || []
|
||||||
|
|
||||||
const sourceRelativeDirectory = core.getInput("source_directory") || "./"
|
const sourceRelativeDirectory = core.getInput("source_directory") || "./"
|
||||||
const artifactsRelativeDirectory = core.getInput("artifacts_directory") || "./"
|
const artifactsRelativeDirectory = core.getInput("artifacts_directory") || "./"
|
||||||
|
|
||||||
|
const defaultDpkgBuildPackageOpts = [
|
||||||
|
// Don't sign for now
|
||||||
|
"--no-sign",
|
||||||
|
|
||||||
|
// Don't worry about build dependencies - we have already installed them
|
||||||
|
// (Seems to not recognize that some packages are installed)
|
||||||
|
"-d"
|
||||||
|
]
|
||||||
|
const dpkgBuildPackageOpts = core.getInput("dpkg_buildpackage_opts") || defaultDpkgBuildPackageOpts
|
||||||
|
const lintianOpts = core.getInput("lintian_opts") || []
|
||||||
|
|
||||||
const workspaceDirectory = process.cwd()
|
const workspaceDirectory = process.cwd()
|
||||||
const sourceDirectory = path.join(workspaceDirectory, sourceRelativeDirectory)
|
const sourceDirectory = path.join(workspaceDirectory, sourceRelativeDirectory)
|
||||||
const buildDirectory = path.dirname(sourceDirectory)
|
const buildDirectory = path.dirname(sourceDirectory)
|
||||||
|
@ -43,6 +54,15 @@ async function main() {
|
||||||
|
|
||||||
fs.mkdirSync(artifactsDirectory, { recursive: true })
|
fs.mkdirSync(artifactsDirectory, { recursive: true })
|
||||||
|
|
||||||
|
function runDockerExecStep(title, commandParams) {
|
||||||
|
core.startGroup(title)
|
||||||
|
await exec.exec("docker", [
|
||||||
|
"exec",
|
||||||
|
container
|
||||||
|
].concat(commandParams))
|
||||||
|
core.endGroup()
|
||||||
|
}
|
||||||
|
|
||||||
core.startGroup("Print details")
|
core.startGroup("Print details")
|
||||||
const details = {
|
const details = {
|
||||||
package: package,
|
package: package,
|
||||||
|
@ -85,10 +105,7 @@ async function main() {
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
||||||
if (revision) {
|
if (revision) {
|
||||||
core.startGroup("Create tarball")
|
runDockerExecStep("Create tarball", [
|
||||||
await exec.exec("docker", [
|
|
||||||
"exec",
|
|
||||||
container,
|
|
||||||
"tar",
|
"tar",
|
||||||
"--exclude-vcs",
|
"--exclude-vcs",
|
||||||
"--exclude", "./debian",
|
"--exclude", "./debian",
|
||||||
|
@ -97,80 +114,71 @@ async function main() {
|
||||||
"-C", sourceDirectory,
|
"-C", sourceDirectory,
|
||||||
"./"
|
"./"
|
||||||
])
|
])
|
||||||
core.endGroup()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
core.startGroup("Add target architecture")
|
if (targetArchitectures.length() != 0) {
|
||||||
await exec.exec("docker", [
|
for (targetArchitecture in targetArchitectures) {
|
||||||
"exec",
|
runDockerExecStep(
|
||||||
container,
|
"Add target architecture: " + targetArchitecture,
|
||||||
"dpkg", "--add-architecture", targetArchitecture
|
["dpkg", "--add-architecture", targetArchitecture]
|
||||||
])
|
)
|
||||||
core.endGroup()
|
}
|
||||||
|
}
|
||||||
|
|
||||||
core.startGroup("Update packages list")
|
runDockerExecStep(
|
||||||
await exec.exec("docker", [
|
"Update packages list",
|
||||||
"exec",
|
["apt-get", "update"]
|
||||||
container,
|
)
|
||||||
"apt-get", "update"
|
|
||||||
])
|
|
||||||
core.endGroup()
|
|
||||||
|
|
||||||
core.startGroup("Install development packages")
|
args = [
|
||||||
await exec.exec("docker", [
|
|
||||||
"exec",
|
|
||||||
container,
|
|
||||||
"apt-get", "install", "--no-install-recommends", "-y",
|
"apt-get", "install", "--no-install-recommends", "-y",
|
||||||
|
|
||||||
// General packaging stuff
|
// General packaging stuff
|
||||||
"dpkg-dev",
|
"dpkg-dev",
|
||||||
"debhelper",
|
"debhelper",
|
||||||
|
"lintian"
|
||||||
|
]
|
||||||
|
|
||||||
// Used by pybuild
|
// Used by pybuild
|
||||||
"libpython3.7-minimal:" + targetArchitecture
|
for (targetArchitecture in targetArchitectures) {
|
||||||
])
|
args.concat("libpython3.7-minimal:" + targetArchitecture)
|
||||||
core.endGroup()
|
}
|
||||||
|
runDockerExecStep(
|
||||||
|
"Install development packages",
|
||||||
|
args
|
||||||
|
)
|
||||||
|
|
||||||
core.startGroup("Install build dependencies")
|
runDockerExecStep(
|
||||||
await exec.exec("docker", [
|
"Install build dependencies",
|
||||||
"exec",
|
["apt-get", "build-dep", "-y", sourceDirectory]
|
||||||
container,
|
)
|
||||||
"apt-get", "build-dep", "-y", sourceDirectory
|
|
||||||
])
|
|
||||||
core.endGroup()
|
|
||||||
|
|
||||||
core.startGroup("Build package")
|
for (targetArchitecture in targetArchitectures) {
|
||||||
await exec.exec("docker", [
|
runDockerExecStep(
|
||||||
"exec",
|
"Build package",
|
||||||
container,
|
[
|
||||||
"dpkg-buildpackage",
|
"dpkg-buildpackage",
|
||||||
|
"-a" + targetArchitecture
|
||||||
|
].concat(dpkgBuildPackageOpts)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
// Don't sign for now
|
runDockerExecStep(
|
||||||
"--no-sign",
|
"Run static analysis",
|
||||||
|
["lintian"].concat(lintianOpts)
|
||||||
|
)
|
||||||
|
|
||||||
// Ignore build dependencies - we have already installed them
|
runDockerExecStep(
|
||||||
//
|
"Move artifacts",
|
||||||
// Seems to not recognise if python3-all and python3-gpiozero are installed
|
[
|
||||||
// and may affect other packages in the same way - but THEY ARE THERE
|
"find",
|
||||||
"-d",
|
buildDirectory,
|
||||||
|
"-maxdepth", "1",
|
||||||
"-a" + targetArchitecture
|
"-name", `*${version}*.*`,
|
||||||
])
|
"-type", "f",
|
||||||
core.endGroup()
|
"-print",
|
||||||
|
"-exec", "mv", "{}", artifactsDirectory, ";"
|
||||||
core.startGroup("Move artifacts")
|
]
|
||||||
await exec.exec("docker", [
|
)
|
||||||
"exec",
|
|
||||||
container,
|
|
||||||
"find",
|
|
||||||
buildDirectory,
|
|
||||||
"-maxdepth", "1",
|
|
||||||
"-name", `*${version}*.*`,
|
|
||||||
"-type", "f",
|
|
||||||
"-print",
|
|
||||||
"-exec", "mv", "{}", artifactsDirectory, ";"
|
|
||||||
])
|
|
||||||
core.endGroup()
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message)
|
core.setFailed(error.message)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue