mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-21 17:33:29 +01:00
arm64 and amd64 image support (#88)
* Ability to build arm7 docker image using buildx * Build arm64 and amd64 images
This commit is contained in:
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
@@ -38,6 +38,12 @@ jobs:
|
|||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
-
|
||||||
|
name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
-
|
||||||
|
name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
-
|
-
|
||||||
name: Docker meta
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
@@ -56,6 +62,7 @@ jobs:
|
|||||||
uses: docker/build-push-action@v2
|
uses: docker/build-push-action@v2
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
@@ -16,6 +16,8 @@ COPY yarn.lock .
|
|||||||
COPY .yarnrc.yml .
|
COPY .yarnrc.yml .
|
||||||
COPY .yarn/releases ./.yarn/releases
|
COPY .yarn/releases ./.yarn/releases
|
||||||
|
|
||||||
|
ENV JEST_TIMEOUT=30000
|
||||||
|
|
||||||
RUN apk add --no-cache --update --virtual .gyp \
|
RUN apk add --no-cache --update --virtual .gyp \
|
||||||
vips-dev \
|
vips-dev \
|
||||||
python3 \
|
python3 \
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ function server(
|
|||||||
removeRegistrationRoute: bonobUrl
|
removeRegistrationRoute: bonobUrl
|
||||||
.append({ pathname: REMOVE_REGISTRATION_ROUTE })
|
.append({ pathname: REMOVE_REGISTRATION_ROUTE })
|
||||||
.pathname(),
|
.pathname(),
|
||||||
version: opts.version,
|
version: serverOpts.version || DEFAULT_SERVER_OPTS.version,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import makeServer, {
|
|||||||
rangeFilterFor,
|
rangeFilterFor,
|
||||||
} from "../src/server";
|
} from "../src/server";
|
||||||
|
|
||||||
import { SONOS_DISABLED, Sonos, Device } from "../src/sonos";
|
import { Device, Sonos, SONOS_DISABLED } from "../src/sonos";
|
||||||
|
|
||||||
import { aDevice, aService } from "./builders";
|
import { aDevice, aService } from "./builders";
|
||||||
import { InMemoryMusicService } from "./in_memory_music_service";
|
import { InMemoryMusicService } from "./in_memory_music_service";
|
||||||
@@ -165,7 +165,10 @@ describe("RangeBytesFromFilter", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe("server", () => {
|
describe("server", () => {
|
||||||
|
jest.setTimeout(Number.parseInt(process.env["JEST_TIMEOUT"] || "2000"));
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
jest.clearAllMocks();
|
jest.clearAllMocks();
|
||||||
jest.resetAllMocks();
|
jest.resetAllMocks();
|
||||||
@@ -182,25 +185,46 @@ describe("server", () => {
|
|||||||
[bonobUrlWithNoContextPath, bonobUrlWithContextPath].forEach((bonobUrl) => {
|
[bonobUrlWithNoContextPath, bonobUrlWithContextPath].forEach((bonobUrl) => {
|
||||||
describe(`a bonobUrl of ${bonobUrl}`, () => {
|
describe(`a bonobUrl of ${bonobUrl}`, () => {
|
||||||
describe("/", () => {
|
describe("/", () => {
|
||||||
describe("displaying of version", () => {
|
describe("version", () => {
|
||||||
const server = makeServer(
|
describe("when specified", () => {
|
||||||
SONOS_DISABLED,
|
const server = makeServer(
|
||||||
aService(),
|
SONOS_DISABLED,
|
||||||
bonobUrl,
|
aService(),
|
||||||
new InMemoryMusicService(),
|
bonobUrl,
|
||||||
{
|
new InMemoryMusicService(),
|
||||||
version: "v123.456",
|
{
|
||||||
}
|
version: "v123.456",
|
||||||
);
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
it("should display it", async () => {
|
||||||
|
const res = await request(server)
|
||||||
|
.get(bonobUrl.append({ pathname: "/" }).pathname())
|
||||||
|
.set("accept-language", acceptLanguage)
|
||||||
|
.send();
|
||||||
|
|
||||||
|
expect(res.status).toEqual(200);
|
||||||
|
expect(res.text).toContain('v123.456');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("should display it", async () => {
|
describe("when not specified", () => {
|
||||||
const res = await request(server)
|
const server = makeServer(
|
||||||
.get(bonobUrl.append({ pathname: "/" }).pathname())
|
SONOS_DISABLED,
|
||||||
.set("accept-language", acceptLanguage)
|
aService(),
|
||||||
.send();
|
bonobUrl,
|
||||||
|
new InMemoryMusicService()
|
||||||
expect(res.status).toEqual(200);
|
);
|
||||||
expect(res.text).toMatch(/v123\.456/);
|
|
||||||
|
it("should display the default", async () => {
|
||||||
|
const res = await request(server)
|
||||||
|
.get(bonobUrl.append({ pathname: "/" }).pathname())
|
||||||
|
.set("accept-language", acceptLanguage)
|
||||||
|
.send();
|
||||||
|
|
||||||
|
expect(res.status).toEqual(200);
|
||||||
|
expect(res.text).toContain("v?");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -63,24 +63,25 @@ describe("auth", () => {
|
|||||||
|
|
||||||
const expiresIn = "1h";
|
const expiresIn = "1h";
|
||||||
const secret = `secret-${uuid()}`;
|
const secret = `secret-${uuid()}`;
|
||||||
const smapiLoginTokens = new JWTSmapiLoginTokens(clock, secret, expiresIn);
|
const key = uuid();
|
||||||
|
const smapiLoginTokens = new JWTSmapiLoginTokens(clock, secret, expiresIn, () => key);
|
||||||
|
|
||||||
describe("issuing a new token", () => {
|
describe("issuing a new token", () => {
|
||||||
it("should issue a token that can then be verified", () => {
|
it("should issue a token that can then be verified", () => {
|
||||||
const serviceToken = uuid();
|
const serviceToken = `service-token-${uuid()}`;
|
||||||
|
|
||||||
const smapiToken = smapiLoginTokens.issue(serviceToken);
|
const smapiToken = smapiLoginTokens.issue(serviceToken);
|
||||||
|
|
||||||
expect(smapiToken.token).toEqual(
|
const expected = jwt.sign(
|
||||||
jwt.sign(
|
{
|
||||||
{
|
serviceToken,
|
||||||
serviceToken,
|
iat: clock.now().unix(),
|
||||||
iat: Math.floor(clock.now().toDate().getDate() / 1000),
|
},
|
||||||
},
|
secret + SMAPI_TOKEN_VERSION + key,
|
||||||
secret + SMAPI_TOKEN_VERSION + smapiToken.key,
|
{ expiresIn }
|
||||||
{ expiresIn }
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
expect(smapiToken.token).toEqual(expected);
|
||||||
expect(smapiToken.token).not.toContain(serviceToken);
|
expect(smapiToken.token).not.toContain(serviceToken);
|
||||||
expect(smapiToken.token).not.toContain(secret);
|
expect(smapiToken.token).not.toContain(secret);
|
||||||
expect(smapiToken.token).not.toContain(":");
|
expect(smapiToken.token).not.toContain(":");
|
||||||
@@ -100,7 +101,7 @@ describe("auth", () => {
|
|||||||
clock,
|
clock,
|
||||||
secret,
|
secret,
|
||||||
expiresIn,
|
expiresIn,
|
||||||
() => uuid(),
|
uuid,
|
||||||
SMAPI_TOKEN_VERSION
|
SMAPI_TOKEN_VERSION
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user