Commit 28baf891 authored by violethaze74's avatar violethaze74 💬
Browse files

Merge branch 'revert-61deecb7' into 'master'

Revert "Merge pull request #21 from jhenstridge/update-deps"

See merge request !6
parents 87e4a71d d9f6c9bd
Pipeline #7414 passed with stages
in 1 minute and 17 seconds
......@@ -44,13 +44,11 @@ test('SnapcraftBuilder.build runs a snap build', async () => {
const ensureSnapcraft = jest
.spyOn(tools, 'ensureSnapcraft')
.mockImplementation(async (channel): Promise<void> => {})
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
process.env['GITHUB_REPOSITORY'] = 'user/repo'
process.env['GITHUB_RUN_ID'] = '42'
......@@ -90,13 +88,11 @@ test('SnapcraftBuilder.build can disable build info', async () => {
const ensureSnapcraft = jest
.spyOn(tools, 'ensureSnapcraft')
.mockImplementation(async (channel): Promise<void> => {})
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const builder = new build.SnapcraftBuilder({
projectRoot: '.',
......@@ -128,13 +124,11 @@ test('SnapcraftBuilder.build can set the Snapcraft channel', async () => {
const ensureSnapcraft = jest
.spyOn(tools, 'ensureSnapcraft')
.mockImplementation(async (channel): Promise<void> => {})
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const builder = new build.SnapcraftBuilder({
projectRoot: '.',
......@@ -160,13 +154,11 @@ test('SnapcraftBuilder.build can pass additional arguments', async () => {
const ensureSnapcraft = jest
.spyOn(tools, 'ensureSnapcraft')
.mockImplementation(async (channel): Promise<void> => {})
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const builder = new build.SnapcraftBuilder({
projectRoot: '.',
......@@ -196,13 +188,11 @@ test('SnapcraftBuilder.build can pass UA token', async () => {
const ensureSnapcraft = jest
.spyOn(tools, 'ensureSnapcraft')
.mockImplementation(async (channel): Promise<void> => {})
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const builder = new build.SnapcraftBuilder({
projectRoot: '.',
......
......@@ -13,31 +13,24 @@ afterEach(() => {
test('ensureSnapd installs snapd if needed', async () => {
expect.assertions(4)
const accessMock = jest
.spyOn(fs.promises, 'access')
.mockImplementation(
async (
filename: fs.PathLike,
mode?: number | undefined
): Promise<void> => {
throw new Error('not found')
}
)
const statMock = jest
.spyOn(fs.promises, 'stat')
.mockImplementation(async (filename: fs.PathLike): Promise<fs.Stats> => {
const accessMock = jest.spyOn(fs.promises, 'access').mockImplementation(
async (filename: fs.PathLike, mode?: number | undefined): Promise<void> => {
throw new Error('not found')
}
)
const statMock = jest.spyOn(fs.promises, 'stat').mockImplementation(
async (filename: fs.PathLike): Promise<fs.Stats> => {
const s = new fs.Stats()
s.uid = 0
s.gid = 0
return s
})
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureSnapd()
......@@ -67,21 +60,19 @@ test('ensureSnapd is a no-op if snapd is installed', async () => {
mode?: number | undefined
): Promise<void> => {}
)
const statMock = jest
.spyOn(fs.promises, 'stat')
.mockImplementation(async (filename: fs.PathLike): Promise<fs.Stats> => {
const statMock = jest.spyOn(fs.promises, 'stat').mockImplementation(
async (filename: fs.PathLike): Promise<fs.Stats> => {
const s = new fs.Stats()
s.uid = 0
s.gid = 0
return s
})
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureSnapd()
......@@ -101,21 +92,19 @@ test('ensureSnapd fixes permissions on the root directory', async () => {
mode?: number | undefined
): Promise<void> => {}
)
const statMock = jest
.spyOn(fs.promises, 'stat')
.mockImplementation(async (filename: fs.PathLike): Promise<fs.Stats> => {
const statMock = jest.spyOn(fs.promises, 'stat').mockImplementation(
async (filename: fs.PathLike): Promise<fs.Stats> => {
const s = new fs.Stats()
s.uid = 500
s.gid = 0
return s
})
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureSnapd()
......@@ -127,23 +116,16 @@ test('ensureSnapd fixes permissions on the root directory', async () => {
test('ensureLXD installs the snap version of LXD if needed', async () => {
expect.assertions(5)
const accessMock = jest
.spyOn(fs.promises, 'access')
.mockImplementation(
async (
filename: fs.PathLike,
mode?: number | undefined
): Promise<void> => {
throw new Error('not found')
}
)
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const accessMock = jest.spyOn(fs.promises, 'access').mockImplementation(
async (filename: fs.PathLike, mode?: number | undefined): Promise<void> => {
throw new Error('not found')
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureLXD()
......@@ -172,23 +154,16 @@ test('ensureLXD installs the snap version of LXD if needed', async () => {
test('ensureLXD removes the apt version of LXD', async () => {
expect.assertions(2)
const accessMock = jest
.spyOn(fs.promises, 'access')
.mockImplementation(
async (
filename: fs.PathLike,
mode?: number | undefined
): Promise<void> => {
return
}
)
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const accessMock = jest.spyOn(fs.promises, 'access').mockImplementation(
async (filename: fs.PathLike, mode?: number | undefined): Promise<void> => {
return
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureLXD()
......@@ -205,26 +180,19 @@ test('ensureLXD removes the apt version of LXD', async () => {
test('ensureLXD still calls "lxd init" if LXD is installed', async () => {
expect.assertions(5)
const accessMock = jest
.spyOn(fs.promises, 'access')
.mockImplementation(
async (
filename: fs.PathLike,
mode?: number | undefined
): Promise<void> => {
if (filename === '/snap/bin/lxd') {
return
}
throw new Error('not found')
}
)
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
const accessMock = jest.spyOn(fs.promises, 'access').mockImplementation(
async (filename: fs.PathLike, mode?: number | undefined): Promise<void> => {
if (filename === '/snap/bin/lxd') {
return
}
)
throw new Error('not found')
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureLXD()
......@@ -253,23 +221,16 @@ test('ensureLXD still calls "lxd init" if LXD is installed', async () => {
test('ensureSnapcraft installs Snapcraft if needed', async () => {
expect.assertions(2)
const accessMock = jest
.spyOn(fs.promises, 'access')
.mockImplementation(
async (
filename: fs.PathLike,
mode?: number | undefined
): Promise<void> => {
throw new Error('not found')
}
)
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const accessMock = jest.spyOn(fs.promises, 'access').mockImplementation(
async (filename: fs.PathLike, mode?: number | undefined): Promise<void> => {
throw new Error('not found')
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureSnapcraft('edge')
......@@ -287,23 +248,16 @@ test('ensureSnapcraft installs Snapcraft if needed', async () => {
test('ensureSnapcraft refreshes if Snapcraft is installed', async () => {
expect.assertions(2)
const accessMock = jest
.spyOn(fs.promises, 'access')
.mockImplementation(
async (
filename: fs.PathLike,
mode?: number | undefined
): Promise<void> => {
return
}
)
const execMock = jest
.spyOn(exec, 'exec')
.mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
const accessMock = jest.spyOn(fs.promises, 'access').mockImplementation(
async (filename: fs.PathLike, mode?: number | undefined): Promise<void> => {
return
}
)
const execMock = jest.spyOn(exec, 'exec').mockImplementation(
async (program: string, args?: string[]): Promise<number> => {
return 0
}
)
await tools.ensureSnapcraft('edge')
......
This diff is collapsed.
# This file is a template, and might need editing before it works on your project.
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Getting-Started.gitlab-ci.yml
# This is a sample GitLab CI/CD configuration file that should run without any modifications.
# It demonstrates a basic 3 stage CI/CD pipeline. Instead of real tests or scripts,
# it uses echo commands to simulate the pipeline execution.
#
# A pipeline is composed of independent jobs that run scripts, grouped into stages.
# Stages run in sequential order, but jobs within stages run in parallel.
#
# For more information, see: https://docs.gitlab.com/ee/ci/yaml/index.html#stages
stages: # List of stages for jobs, and their order of execution
- build
- test
- deploy
build-job: # This job runs in the build stage, which runs first.
stage: build
script:
- echo "Compiling the code..."
- echo "Compile complete."
unit-test-job: # This job runs in the test stage.
stage: test # It only starts when the job in the build stage completes successfully.
script:
- echo "Running unit tests... This will take about 60 seconds."
- sleep 60
- echo "Code coverage is 90%"
lint-test-job: # This job also runs in the test stage.
stage: test # It can run at the same time as unit-test-job (in parallel).
script:
- echo "Linting code... This will take about 10 seconds."
- sleep 10
- echo "No lint issues found."
deploy-job: # This job runs in the deploy stage.
stage: deploy # It only runs when *both* jobs in the test stage complete successfully.
script:
- echo "Deploying application..."
- echo "Application successfully deployed."
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment