Skip to content

Commit c693664

Browse files
Create docker.yml
1 parent 1f86e74 commit c693664

4 files changed

Lines changed: 43 additions & 5 deletions

File tree

.github/workflows/docker.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
on:
2+
push:
3+
branches:
4+
- "main"
5+
pull_request:
6+
branches:
7+
- "main"
8+
9+
env:
10+
TEST_TAG: corefiling/pdf2html:test
11+
12+
jobs:
13+
docker:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
- name: Set up QEMU
19+
uses: docker/setup-qemu-action@v2
20+
- name: Set up Docker Buildx
21+
uses: docker/setup-buildx-action@v2
22+
- name: Build and export to Docker
23+
uses: docker/build-push-action@v4
24+
with:
25+
context: ./src/Pdf2Html
26+
load: true
27+
tags: ${{ env.TEST_TAG }}
28+
- name: Set up Dotnet
29+
uses: actions/setup-dotnet@v3
30+
with:
31+
dotnet-version: "7.x"
32+
- name: E2E tests
33+
run: |
34+
docker run --rm --detach -p 8080:8080 --name pdf2html ${{ env.TEST_TAG }}
35+
dotnet test
36+
docker stop pdf2html

src/Pdf2Html/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ WORKDIR /app
1515
COPY --from=build /app ./
1616
ENV ASPNETCORE_URLS=http://+:8080
1717
EXPOSE 8080
18-
CMD ["./pdf2html"]
18+
CMD ["./Pdf2Html"]

src/Pdf2Html/Pdf2Html.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Version>1.0.0</Version>
8-
<AssemblyName>Pdf2html</AssemblyName>
9-
<RootNamespace>Pdf2html</RootNamespace>
8+
<AssemblyName>Pdf2Html</AssemblyName>
9+
<RootNamespace>Pdf2Html</RootNamespace>
1010
</PropertyGroup>
1111

1212
<ItemGroup>
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ public async Task TestConvertPdf()
3232
var response = await _client.PostAsync("/", new StreamContent(GetResourceStream("CS_cheat_sheet.pdf")));
3333
Assert.Multiple(async () =>
3434
{
35-
Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
36-
Assert.That(await response.Content.ReadAsStreamAsync(), Is.EqualTo(GetResourceStream("CS_cheat_sheet.html")));
35+
var responseStream = await response.Content.ReadAsStreamAsync();
36+
Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK),
37+
() => $"Conversion failed: {new StreamReader(responseStream).ReadToEnd()}");
38+
Assert.That(responseStream, Is.EqualTo(GetResourceStream("CS_cheat_sheet.html")));
3739
});
3840
}
3941

0 commit comments

Comments
 (0)