@@ -19,34 +19,19 @@ import fs from 'fs';
1919import os from 'os' ;
2020import path from 'path' ;
2121
22- import { Buildx } from '../src/buildx/buildx' ;
23- import { Bake } from '../src/buildx/bake' ;
24- import { Build } from '../src/buildx/build' ;
25- import { Exec } from '../src/exec' ;
26- import { GitHub } from '../src/github' ;
27- import { History } from '../src/buildx/history ' ;
28- import { Util } from '../src/util ' ;
22+ import { Buildx } from '../../ src/buildx/buildx' ;
23+ import { Bake } from '../../ src/buildx/bake' ;
24+ import { Build } from '../../ src/buildx/build' ;
25+ import { Exec } from '../../ src/exec' ;
26+ import { GitHubArtifact } from '../../ src/github/artifact ' ;
27+ import { GitHubSummary } from '../../ src/github/summary ' ;
28+ import { History } from '../../ src/buildx/history ' ;
2929
30- const fixturesDir = path . join ( __dirname , '.fixtures' ) ;
30+ const fixturesDir = path . join ( __dirname , '..' , '. fixtures') ;
3131const tmpDir = fs . mkdtempSync ( path . join ( process . env . TEMP || os . tmpdir ( ) , 'github-itg-' ) ) ;
3232
3333const maybe = ! process . env . GITHUB_ACTIONS || ( process . env . GITHUB_ACTIONS === 'true' && process . env . ImageOS && process . env . ImageOS . startsWith ( 'ubuntu' ) ) ? describe : describe . skip ;
3434
35- maybe ( 'uploadArtifact' , ( ) => {
36- it ( 'uploads an artifact' , async ( ) => {
37- const filename = path . join ( tmpDir , `github-repo-${ Util . generateRandomString ( ) } .json` ) ;
38- fs . copyFileSync ( path . join ( fixturesDir , `github-repo.json` ) , filename ) ;
39- const res = await GitHub . uploadArtifact ( {
40- filename : filename ,
41- mimeType : 'application/json' ,
42- retentionDays : 1
43- } ) ;
44- expect ( res ) . toBeDefined ( ) ;
45- console . log ( 'uploadArtifactResponse' , res ) ;
46- expect ( res ?. url ) . toBeDefined ( ) ;
47- } ) ;
48- } ) ;
49-
5035maybe ( 'writeBuildSummary' , ( ) => {
5136 // prettier-ignore
5237 test . each ( [
@@ -98,15 +83,15 @@ maybe('writeBuildSummary', () => {
9883 expect ( exportRes ?. dockerbuildSize ) . toBeDefined ( ) ;
9984 expect ( exportRes ?. summaries ) . toBeDefined ( ) ;
10085
101- const uploadRes = await GitHub . uploadArtifact ( {
86+ const uploadRes = await GitHubArtifact . upload ( {
10287 filename : exportRes ?. dockerbuildFilename ,
10388 mimeType : 'application/gzip' ,
10489 retentionDays : 1
10590 } ) ;
10691 expect ( uploadRes ) . toBeDefined ( ) ;
10792 expect ( uploadRes ?. url ) . toBeDefined ( ) ;
10893
109- await GitHub . writeBuildSummary ( {
94+ await GitHubSummary . writeBuildSummary ( {
11095 exportRes : exportRes ,
11196 uploadRes : uploadRes ,
11297 inputs : {
@@ -178,15 +163,15 @@ maybe('writeBuildSummary', () => {
178163 expect ( exportRes ?. dockerbuildSize ) . toBeDefined ( ) ;
179164 expect ( exportRes ?. summaries ) . toBeDefined ( ) ;
180165
181- const uploadRes = await GitHub . uploadArtifact ( {
166+ const uploadRes = await GitHubArtifact . upload ( {
182167 filename : exportRes ?. dockerbuildFilename ,
183168 mimeType : 'application/gzip' ,
184169 retentionDays : 1
185170 } ) ;
186171 expect ( uploadRes ) . toBeDefined ( ) ;
187172 expect ( uploadRes ?. url ) . toBeDefined ( ) ;
188173
189- await GitHub . writeBuildSummary ( {
174+ await GitHubSummary . writeBuildSummary ( {
190175 exportRes : exportRes ,
191176 uploadRes : uploadRes ,
192177 inputs : {
@@ -233,15 +218,15 @@ maybe('writeBuildSummary', () => {
233218 expect ( exportRes ?. dockerbuildSize ) . toBeDefined ( ) ;
234219 expect ( exportRes ?. summaries ) . toBeDefined ( ) ;
235220
236- const uploadRes = await GitHub . uploadArtifact ( {
221+ const uploadRes = await GitHubArtifact . upload ( {
237222 filename : exportRes ?. dockerbuildFilename ,
238223 mimeType : 'application/gzip' ,
239224 retentionDays : 1
240225 } ) ;
241226 expect ( uploadRes ) . toBeDefined ( ) ;
242227 expect ( uploadRes ?. url ) . toBeDefined ( ) ;
243228
244- await GitHub . writeBuildSummary ( {
229+ await GitHubSummary . writeBuildSummary ( {
245230 exportRes : exportRes ,
246231 uploadRes : uploadRes ,
247232 inputs : {
@@ -288,7 +273,7 @@ maybe('writeBuildSummary', () => {
288273 expect ( exportRes ?. dockerbuildSize ) . toBeDefined ( ) ;
289274 expect ( exportRes ?. summaries ) . toBeDefined ( ) ;
290275
291- await GitHub . writeBuildSummary ( {
276+ await GitHubSummary . writeBuildSummary ( {
292277 exportRes : exportRes ,
293278 inputs : {
294279 context : fixturesDir ,
0 commit comments