Skip to content

Commit

Permalink
ci: refactor worflows
Browse files Browse the repository at this point in the history
Signed-off-by: Emilien Escalle <emilien.escalle@escemi.com>
  • Loading branch information
neilime committed Mar 26, 2024
1 parent c7b6c2f commit 1a133c6
Show file tree
Hide file tree
Showing 14 changed files with 277 additions and 68 deletions.
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Bug report
about: Create a bug report
title: ""
labels: bug, needs triage
assignees: ""
---

<!--- Please direct any generic questions related to actions to our support community forum at https://gh.neting.ccmunity/c/code-to-cloud/github-actions/41 --->
<!--- Before opening up a new bug report, please make sure to check for similar existing issues -->

**Description:**
A clear and concise description of what the bug is.

**Action version:**
Specify the action version

**Platform:**

- [ ] Ubuntu
- [ ] macOS
- [ ] Windows

**Runner type:**

- [ ] Hosted
- [ ] Self-hosted

**Tools version:**

<!--- Please specify versions of node and package manager (npm, yarn, pnpm and etc)-->

**Repro steps:**
A description with steps to reproduce the issue. If you have a public example or repository to share, please provide the link.

**Expected behavior:**
A description of what you expected to happen.

**Actual behavior:**
A description of what is actually happening.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
42 changes: 42 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This file was generated by the "Generate Dependabot Glob" action. Do not edit it directly.
# Make changes to `.github/dependabot.template.yml` and a PR will be automatically created.
version: 2
updates:
- package-ecosystem: github-actions
directory: /
open-pull-requests-limit: 20
schedule:
interval: weekly
day: friday
time: "04:00"
groups:
github-actions-dependencies:
patterns:
- "*"

- package-ecosystem: npm
directory: "/"
open-pull-requests-limit: 20
versioning-strategy: widen
schedule:
interval: weekly
day: friday
time: "04:00"
groups:
actions-dependencies:
patterns:
- "@actions/*"
npm-dev-dependencies:
dependency-type: development

- package-ecosystem: docker
directory: "/docker"
open-pull-requests-limit: 20
schedule:
interval: weekly
day: friday
time: "04:00"
groups:
docker-dependencies:
patterns:
- "*"
18 changes: 18 additions & 0 deletions .github/workflows/__shared-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Common Continuous Integration tasks

on:
workflow_call:

jobs:
linter:
uses: hoverkraft-tech/ci-github-common/.github/workflows/linter.yml@0.12.1

test-nodejs:
name: Test nodejs
needs: linter
uses: ./.github/workflows/__test-nodejs.yml

test-action:
name: Test action
needs: linter
uses: ./.github/workflows/__test-action.yml
73 changes: 73 additions & 0 deletions .github/workflows/__test-action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Internal - Tests for action

on:
workflow_call:

jobs:
test-action-with-services:
runs-on: ubuntu-latest
name: Test compose action
steps:
- uses: actions/checkout@v4
- uses: hoverkraft-tech/ci-github-nodejs/actions/setup-node@0.3.2

- uses: ./
with:
compose-file: "./docker/docker-compose.yml"
services: |
helloworld2
helloworld3
test-action-with-down-flags:
runs-on: ubuntu-latest
name: Test compose action
steps:
- uses: actions/checkout@v4
- uses: hoverkraft-tech/ci-github-nodejs/actions/setup-node@0.3.2

- uses: ./
with:
compose-file: "./docker/docker-compose.yml"
down-flags: "--volumes"

test-action-with-compose-flags:
runs-on: ubuntu-latest
name: Test compose action
steps:
- uses: actions/checkout@v4
- uses: hoverkraft-tech/ci-github-nodejs/actions/setup-node@0.3.2

- uses: ./
with:
compose-file: "./docker/docker-compose.yml"
compose-flags: "--profile profile-1"
down-flags: "--volumes"

test-action-with-env:
runs-on: ubuntu-latest
name: Test compose action
steps:
- uses: actions/checkout@v4
- uses: hoverkraft-tech/ci-github-nodejs/actions/setup-node@0.3.2

- uses: ./
with:
compose-file: "./docker/docker-compose-with-env.yml"
env:
IMAGE_NAME: hello-world

test-action-with-multiple-compose-files:
runs-on: ubuntu-latest
name: Test compose action
steps:
- uses: actions/checkout@v4
- uses: hoverkraft-tech/ci-github-nodejs/actions/setup-node@0.3.2

- uses: ./
with:
compose-file: |
./docker/docker-compose.yml
./docker/docker-compose.ci.yml
services: |
helloworld2
helloworld4
12 changes: 12 additions & 0 deletions .github/workflows/__test-nodejs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Internal - Tests for nodejs

on:
workflow_call:

jobs:
test-nodejs:
uses: hoverkraft-tech/ci-github-nodejs/.github/workflows/continuous-integration.yml@0.3.2
permissions:
id-token: write
security-events: write
contents: read
14 changes: 14 additions & 0 deletions .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Internal - Main - Continuous Integration

on:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ci:
uses: ./.github/workflows/__shared-ci.yml
secrets: inherit
61 changes: 0 additions & 61 deletions .github/workflows/main.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/need-fix-to-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Need fix to Issue

on:
push:
branches:
- main
workflow_dispatch:
inputs:
manual-commit-ref:
description: "The SHA of the commit to get the diff for"
required: true
manual-base-ref:
description: "By default, the commit entered above is compared to the one directly before it; to go back further, enter an earlier SHA here"
required: false

jobs:
main:
uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@0.12.1
with:
manual-commit-ref: ${{ inputs.manual-commit-ref }}
manual-base-ref: ${{ inputs.manual-base-ref }}
15 changes: 15 additions & 0 deletions .github/workflows/pull-request-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Pull request - Continuous Integration

on:
merge_group:
pull_request:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ci:
uses: ./.github/workflows/__shared-ci.yml
secrets: inherit
12 changes: 12 additions & 0 deletions .github/workflows/semantic-pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: "Pull Request - Semantic Lint"

on:
pull_request_target:
types:
- opened
- edited
- synchronize

jobs:
main:
uses: hoverkraft-tech/ci-github-common/.github/workflows/semantic-pull-request.yml@0.11.2
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16
10 changes: 5 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
name: "Docker Compose Action"
description: "Run your docker-compose file"
inputs:
compose-file: # id of input
compose-file:
description: "relative path to compose file(s)"
required: false
default: "./docker-compose.yml"
compose-flags: # id of input
compose-flags:
description: "additional options to pass to `docker-compose` command"
required: false
default: ""
down-flags: # id of input
down-flags:
description: "additional options to pass to `docker-compose down` command"
required: false
default: ""
services: # id of input
services:
description: "services to perform docker-compose up"
required: false
up-flags: # id of input
up-flags:
description: "additional options to pass to `docker-compose up` command"
required: false
default: ""
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "echo \"No test specified\" && exit 1",
"test:ci": "echo \"No test specified\"",
"lint": "eslint .",
"format": "prettier --write \"**/*.{js,json}\"",
"check-format": "prettier --check \"**/*.{js,json}\""
"check-format": "prettier --check \"**/*.{js,json}\"",
"build": "echo \"No build step\""
},
"keywords": [],
"author": "",
Expand Down

0 comments on commit 1a133c6

Please sign in to comment.