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 3cee051
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 report to help us improve
title: ""
labels: ""
assignees: ""
---

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

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Mobile phone (please complete the following information):**

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
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.
43 changes: 43 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 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
versioning-strategy: widen
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
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "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 3cee051

Please sign in to comment.