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

View file

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

10
main.js
View file

@ -28,6 +28,7 @@ async function getImageName(distribution) {
async function main() { async function main() {
try { try {
const cpuArchitecture = core.getInput("cpu_architecture") || "amd64"
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 osDistribution = core.getInput("os_distribution") || "" const osDistribution = core.getInput("os_distribution") || ""
@ -67,9 +68,18 @@ async function main() {
console.log(details) console.log(details)
core.endGroup() 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") core.startGroup("Create container")
await exec.exec("docker", [ await exec.exec("docker", [
"create", "create",
"--platform", `linux/${cpuArchitecture}`,
"--name", container, "--name", container,
"--volume", workspaceDirectory + ":" + workspaceDirectory, "--volume", workspaceDirectory + ":" + workspaceDirectory,
"--workdir", sourceDirectory, "--workdir", sourceDirectory,