Support building for other architectures (#36)

This commit is contained in:
Dawid Dziurla 2021-07-10 00:11:23 +02:00 committed by GitHub
parent 3c531250ab
commit d959ecc623
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 0 deletions

View file

@ -13,24 +13,31 @@ jobs:
matrix:
include:
- package: at
arch: amd64
repo: https://salsa.debian.org/debian/at.git
ref: debian/3.1.23-1
- package: lolcat
arch: arm64
repo: https://salsa.debian.org/ruby-team/lolcat.git
ref: debian/100.0.1-2
- package: micro
arch: amd64
repo: https://salsa.debian.org/go-team/packages/micro.git
ref: debian/2.0.6-2_bpo10+1
- package: dropbear
arch: arm64
repo: https://salsa.debian.org/debian/dropbear.git
ref: debian/2016.74-5+deb9u1
- package: deber
arch: amd64
repo: https://github.com/dawidd6/deber.git
ref: v1.0.0
- package: netcat-openbsd
arch: arm64
repo: https://git.launchpad.net/ubuntu/+source/netcat-openbsd
ref: import/1.206-1ubuntu1
- package: iproute2
arch: amd64
repo: https://git.launchpad.net/ubuntu/+source/iproute2
ref: import/4.18.0-1ubuntu2_ubuntu18.04.1
steps:
@ -41,6 +48,7 @@ jobs:
- name: Test run
uses: ./
with:
cpu_architecture: ${{matrix.arch}}
source_directory: ${{matrix.package}}
artifacts_directory: artifacts
- name: Check files

View file

@ -4,6 +4,10 @@ branding:
color: red
icon: package
inputs:
cpu_architecture:
description: Target CPU architecture
required: false
default: amd64
source_directory:
description: Directory where Debian sources are, relative to workspace
required: false

10
main.js
View file

@ -28,6 +28,7 @@ async function getImageName(distribution) {
async function main() {
try {
const cpuArchitecture = core.getInput("cpu_architecture") || "amd64"
const sourceRelativeDirectory = core.getInput("source_directory") || "./"
const artifactsRelativeDirectory = core.getInput("artifacts_directory") || "./"
const osDistribution = core.getInput("os_distribution") || ""
@ -67,9 +68,18 @@ async function main() {
console.log(details)
core.endGroup()
if (cpuArchitecture != "amd64") {
core.startGroup("Install QEMU")
// Need newer QEMU to avoid errors
await exec.exec("wget", ["http://mirrors.kernel.org/ubuntu/pool/universe/q/qemu/qemu-user-static_5.2+dfsg-9ubuntu2_amd64.deb", "-O", "/tmp/qemu.deb"])
await exec.exec("sudo", ["dpkg", "-i", "/tmp/qemu.deb"])
core.endGroup()
}
core.startGroup("Create container")
await exec.exec("docker", [
"create",
"--platform", `linux/${cpuArchitecture}`,
"--name", container,
"--volume", workspaceDirectory + ":" + workspaceDirectory,
"--workdir", sourceDirectory,