mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2026-01-25 20:32:19 +01:00
Compare commits
3 Commits
peaceiris-
...
docker-com
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f6d0e78500 | ||
|
|
71327d4646 | ||
|
|
1eeaa0edab |
1
.github/workflows/test-action.yml
vendored
1
.github/workflows/test-action.yml
vendored
@@ -3,6 +3,7 @@ name: Daily Test
|
|||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '13 13 * * *'
|
- cron: '13 13 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
|||||||
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@@ -1,3 +1,4 @@
|
|||||||
{
|
{
|
||||||
"git.ignoreLimitWarning": true
|
"git.ignoreLimitWarning": true,
|
||||||
|
"deno.enable": false
|
||||||
}
|
}
|
||||||
3
Makefile
3
Makefile
@@ -2,14 +2,13 @@ cmd := "bash"
|
|||||||
msg := ""
|
msg := ""
|
||||||
IMAGE_NAME := actions_hugo_dev:latest
|
IMAGE_NAME := actions_hugo_dev:latest
|
||||||
NODE_VERSION := $(shell cat ./.nvmrc)
|
NODE_VERSION := $(shell cat ./.nvmrc)
|
||||||
DOCKER_BUILD := docker build . -t $(IMAGE_NAME) --build-arg NODE_VERSION=$(NODE_VERSION)
|
|
||||||
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/root/.gitconfig $(IMAGE_NAME)
|
DOCKER_RUN := docker run --rm -i -t -v ${PWD}:/repo -v ~/.gitconfig:/root/.gitconfig $(IMAGE_NAME)
|
||||||
DOCKER_RUN_CI := docker run --rm -v ${PWD}:/repo $(IMAGE_NAME)
|
DOCKER_RUN_CI := docker run --rm -v ${PWD}:/repo $(IMAGE_NAME)
|
||||||
|
|
||||||
|
|
||||||
.PHONY: build
|
.PHONY: build
|
||||||
build:
|
build:
|
||||||
$(DOCKER_BUILD)
|
docker build . -t $(IMAGE_NAME) --build-arg NODE_VERSION=$(NODE_VERSION)
|
||||||
|
|
||||||
.PHONY: run
|
.PHONY: run
|
||||||
run:
|
run:
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ describe('Integration testing run()', () => {
|
|||||||
test('succeed in installing a custom version', async () => {
|
test('succeed in installing a custom version', async () => {
|
||||||
const testVersion = Tool.TestVersionSpec;
|
const testVersion = Tool.TestVersionSpec;
|
||||||
process.env['INPUT_HUGO-VERSION'] = testVersion;
|
process.env['INPUT_HUGO-VERSION'] = testVersion;
|
||||||
process.env['INPUT_EXTENDED'] = 'false';
|
|
||||||
const result: main.ActionResult = await main.run();
|
const result: main.ActionResult = await main.run();
|
||||||
expect(result.exitcode).toBe(0);
|
expect(result.exitcode).toBe(0);
|
||||||
expect(result.output).toMatch(`Hugo Static Site Generator v${testVersion}`);
|
expect(result.output).toMatch(`Hugo Static Site Generator v${testVersion}`);
|
||||||
@@ -44,7 +43,6 @@ describe('Integration testing run()', () => {
|
|||||||
test('succeed in installing the latest version', async () => {
|
test('succeed in installing the latest version', async () => {
|
||||||
const testVersion = 'latest';
|
const testVersion = 'latest';
|
||||||
process.env['INPUT_HUGO-VERSION'] = testVersion;
|
process.env['INPUT_HUGO-VERSION'] = testVersion;
|
||||||
process.env['INPUT_EXTENDED'] = 'false';
|
|
||||||
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(200, jsonTestBrew);
|
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(200, jsonTestBrew);
|
||||||
const result: main.ActionResult = await main.run();
|
const result: main.ActionResult = await main.run();
|
||||||
expect(result.exitcode).toBe(0);
|
expect(result.exitcode).toBe(0);
|
||||||
@@ -64,8 +62,8 @@ describe('Integration testing run()', () => {
|
|||||||
|
|
||||||
test('fail to install the latest version due to 404 of brew', async () => {
|
test('fail to install the latest version due to 404 of brew', async () => {
|
||||||
process.env['INPUT_HUGO-VERSION'] = 'latest';
|
process.env['INPUT_HUGO-VERSION'] = 'latest';
|
||||||
process.env['INPUT_EXTENDED'] = 'false';
|
|
||||||
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(404);
|
nock('https://formulae.brew.sh').get(`/api/formula/${Tool.Repo}.json`).reply(404);
|
||||||
|
|
||||||
await expect(main.run()).rejects.toThrowError(FetchError);
|
await expect(main.run()).rejects.toThrowError(FetchError);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
16
docker-compose.yml
Normal file
16
docker-compose.yml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
version: '3.2'
|
||||||
|
|
||||||
|
services:
|
||||||
|
dev:
|
||||||
|
image: 'docker.pkg.github.com/peaceiris/actions-hugo/dev:latest'
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
# cache_from:
|
||||||
|
# - 'docker.pkg.github.com/peaceiris/actions-hugo/dev:latest'
|
||||||
|
container_name: peaceiris_actions_hugo_dev_latest
|
||||||
|
volumes:
|
||||||
|
- ${PWD}:/repo
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
command:
|
||||||
|
- bash
|
||||||
@@ -2,10 +2,10 @@ export default function getURL(os: string, extended: string, version: string): s
|
|||||||
const extendedStr = (extended: string): string => {
|
const extendedStr = (extended: string): string => {
|
||||||
if (extended === 'true') {
|
if (extended === 'true') {
|
||||||
return 'extended_';
|
return 'extended_';
|
||||||
} else if (extended === 'false') {
|
|
||||||
return '';
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Invalid input (extended): ${extended}`);
|
return '';
|
||||||
|
// } else {
|
||||||
|
// throw new Error(`Invalid input (extended): ${extended}`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user