ci: update workflows [skip ci]
This commit is contained in:
5
.github/scripts/files/examples.yml
vendored
5
.github/scripts/files/examples.yml
vendored
@@ -1,8 +1,11 @@
|
|||||||
name: Examples
|
# THIS WORKFLOW IS AUTO-GENERATED
|
||||||
|
name: Publish examples
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 8 1/2 * *"
|
- cron: "0 8 1/2 * *"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
# ======================================================================================
|
# ======================================================================================
|
||||||
|
|||||||
4
.github/workflows/clean.yml
vendored
4
.github/workflows/clean.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Clean untagged docker images from ghcr.io
|
name: Clean untagged docker images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
@@ -8,7 +8,7 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
clean:
|
clean:
|
||||||
name: Clean untagged docker images from ghcr.io
|
name: Clean untagged docker images
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
4
.github/workflows/examples.yml
vendored
4
.github/workflows/examples.yml
vendored
@@ -3,6 +3,8 @@ on:
|
|||||||
schedule:
|
schedule:
|
||||||
- cron: "0 8 1/2 * *"
|
- cron: "0 8 1/2 * *"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
# ======================================================================================
|
# ======================================================================================
|
||||||
@@ -1035,7 +1037,7 @@ jobs:
|
|||||||
output_action: none
|
output_action: none
|
||||||
delay: 120
|
delay: 120
|
||||||
if: ${{ success() || failure() }}
|
if: ${{ success() || failure() }}
|
||||||
|
|
||||||
|
|
||||||
- name: Publish examples
|
- name: Publish examples
|
||||||
if: ${{ success() || failure() }}
|
if: ${{ success() || failure() }}
|
||||||
|
|||||||
2
.github/workflows/stale.yml
vendored
2
.github/workflows/stale.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Stale issues, pull requests and workflow runs
|
name: Stale issues, pr and runs
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
|
|||||||
64
.github/workflows/test.yml
vendored
Normal file
64
.github/workflows/test.yml
vendored
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
name: Build, test and analyze
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
workflow_call:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
# Run linter to ensure new code respect coding rules
|
||||||
|
lint:
|
||||||
|
name: Lint code
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Setup NodeJS
|
||||||
|
uses: actions/setup-node@v2
|
||||||
|
with:
|
||||||
|
node-version: 17
|
||||||
|
- name: Setup metrics
|
||||||
|
run: npm ci
|
||||||
|
- name: Check contributions requirements
|
||||||
|
run: npm test -- ci.test.js --noStackTrace
|
||||||
|
- name: Run linter
|
||||||
|
run: npm run linter
|
||||||
|
|
||||||
|
# Build docker image from branch and run tests
|
||||||
|
build:
|
||||||
|
name: Build and test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ lint ]
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Format code with dprint
|
||||||
|
run: |
|
||||||
|
curl -fsSL https://dprint.dev/install.sh | sh
|
||||||
|
cp /home/runner/.dprint/bin/dprint /usr/local/bin/dprint
|
||||||
|
npm install -g eslint
|
||||||
|
dprint fmt --config .github/config/dprint.json
|
||||||
|
npm run format
|
||||||
|
- name: Build lowlighter/metrics:${{ github.head_ref || 'master' }}
|
||||||
|
run: docker build -t lowlighter/metrics:$(echo ${{ github.head_ref || 'master' }} | sed 's/\//-/g') .
|
||||||
|
- name: Run tests
|
||||||
|
run: docker run --workdir=/metrics --entrypoint="" lowlighter/metrics:$(echo ${{ github.head_ref || 'master' }} | sed 's/\//-/g') npm test -- metrics.test.js
|
||||||
|
|
||||||
|
# Run CodeQL on branch
|
||||||
|
analyze:
|
||||||
|
name: Analyze code
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ lint ]
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Setup CodeQL
|
||||||
|
uses: github/codeql-action/init@v1
|
||||||
|
with:
|
||||||
|
languages: javascript
|
||||||
|
config-file: ./.github/config/codeql.yml
|
||||||
|
- name: Analyze code
|
||||||
|
uses: github/codeql-action/analyze@v1
|
||||||
101
.github/workflows/workflow.yml
vendored
101
.github/workflows/workflow.yml
vendored
@@ -3,77 +3,22 @@ name: Build, test, analyze and publish
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches: [ master ]
|
||||||
pull_request:
|
|
||||||
branches: [ master ]
|
|
||||||
paths-ignore:
|
|
||||||
- '**/*.md'
|
|
||||||
- '**/*.png'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
# Run linter to ensure new code respect coding rules
|
# Build, test and analyze
|
||||||
lint:
|
build-test-analyze:
|
||||||
name: Lint code
|
if: "!contains(github.event.head_commit.message, '[skip test]')"
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Build, test and analyze
|
||||||
uses: actions/checkout@v2
|
uses: lowlighter/metrics/.github/workflows/test.yml@master
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Setup NodeJS
|
|
||||||
uses: actions/setup-node@v2
|
|
||||||
with:
|
|
||||||
node-version: 17
|
|
||||||
- name: Setup metrics
|
|
||||||
run: npm ci
|
|
||||||
- name: Check contributions requirements
|
|
||||||
run: npm test -- ci.test.js --noStackTrace
|
|
||||||
- name: Run linter
|
|
||||||
run: npm run linter
|
|
||||||
|
|
||||||
# Build docker image from branch and run tests
|
|
||||||
build:
|
|
||||||
name: Build and test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [ lint ]
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Format code with dprint
|
|
||||||
run: |
|
|
||||||
curl -fsSL https://dprint.dev/install.sh | sh
|
|
||||||
cp /home/runner/.dprint/bin/dprint /usr/local/bin/dprint
|
|
||||||
npm install -g eslint
|
|
||||||
dprint fmt --config .github/config/dprint.json
|
|
||||||
npm run format
|
|
||||||
- name: Build lowlighter/metrics:${{ github.head_ref || 'master' }}
|
|
||||||
run: docker build -t lowlighter/metrics:$(echo ${{ github.head_ref || 'master' }} | sed 's/\//-/g') .
|
|
||||||
- name: Run tests
|
|
||||||
run: docker run --workdir=/metrics --entrypoint="" lowlighter/metrics:$(echo ${{ github.head_ref || 'master' }} | sed 's/\//-/g') npm test -- metrics.test.js
|
|
||||||
|
|
||||||
# Run CodeQL on branch
|
|
||||||
analyze:
|
|
||||||
name: Analyze code
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [ lint ]
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
- name: Setup CodeQL
|
|
||||||
uses: github/codeql-action/init@v1
|
|
||||||
with:
|
|
||||||
languages: javascript
|
|
||||||
config-file: ./.github/config/codeql.yml
|
|
||||||
- name: Analyze code
|
|
||||||
uses: github/codeql-action/analyze@v1
|
|
||||||
|
|
||||||
# Format code
|
# Format code
|
||||||
format:
|
format:
|
||||||
name: Format code
|
name: Format code
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ build, analyze ]
|
needs: [ build-test-analyze ]
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -93,9 +38,10 @@ jobs:
|
|||||||
- name: Publish formatted code
|
- name: Publish formatted code
|
||||||
run: |
|
run: |
|
||||||
set +e
|
set +e
|
||||||
git status
|
git config user.name github-actions[bot]
|
||||||
git add --update
|
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
|
||||||
git commit -m "Auto-format code"
|
git add --all
|
||||||
|
git commit -m "chore: code formatting"
|
||||||
git push
|
git push
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
@@ -103,8 +49,7 @@ jobs:
|
|||||||
update-indexes:
|
update-indexes:
|
||||||
name: Publish rebuilt metrics indexes
|
name: Publish rebuilt metrics indexes
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ build, analyze, format ]
|
needs: [ format ]
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -122,7 +67,6 @@ jobs:
|
|||||||
name: Rebase main on master
|
name: Rebase main on master
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ update-indexes ]
|
needs: [ update-indexes ]
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -146,7 +90,6 @@ jobs:
|
|||||||
name: Publish master to GitHub registry
|
name: Publish master to GitHub registry
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ update-indexes ]
|
needs: [ update-indexes ]
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -177,7 +120,6 @@ jobs:
|
|||||||
name: Test lowlighter/metrics@master
|
name: Test lowlighter/metrics@master
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ docker-master ]
|
needs: [ docker-master ]
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
||||||
steps:
|
steps:
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
uses: lowlighter/metrics@master
|
uses: lowlighter/metrics@master
|
||||||
@@ -194,7 +136,7 @@ jobs:
|
|||||||
name: Publish release to GitHub registry
|
name: Publish release to GitHub registry
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ action-master-test ]
|
needs: [ action-master-test ]
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[release]')
|
if: contains(github.event.head_commit.message, '[release]')
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -211,12 +153,19 @@ jobs:
|
|||||||
- name: Publish latest to GitHub registry
|
- name: Publish latest to GitHub registry
|
||||||
run: docker push ghcr.io/lowlighter/metrics:latest
|
run: docker push ghcr.io/lowlighter/metrics:latest
|
||||||
|
|
||||||
|
# Publish examples
|
||||||
|
publish-examples:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ docker-release ]
|
||||||
|
steps:
|
||||||
|
- name: Publish examples
|
||||||
|
uses: lowlighter/metrics/.github/workflows/examples.yml@master
|
||||||
|
|
||||||
# Rebase latest branch on master
|
# Rebase latest branch on master
|
||||||
update-latest:
|
update-latest:
|
||||||
name: Rebase latest on master
|
name: Rebase latest on master
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ docker-release ]
|
needs: [ docker-release ]
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[release]')
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -242,7 +191,6 @@ jobs:
|
|||||||
name: Test lowlighter/metrics@latest
|
name: Test lowlighter/metrics@latest
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ update-latest ]
|
needs: [ update-latest ]
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[release]')
|
|
||||||
steps:
|
steps:
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
uses: lowlighter/metrics@latest
|
uses: lowlighter/metrics@latest
|
||||||
@@ -258,7 +206,6 @@ jobs:
|
|||||||
name: Publish release
|
name: Publish release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ action-latest-test ]
|
needs: [ action-latest-test ]
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[release]')
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
@@ -276,11 +223,11 @@ jobs:
|
|||||||
GITHUB_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
GITHUB_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
|
||||||
|
|
||||||
# Deploy to metrics.lecoq.io
|
# Deploy to metrics.lecoq.io
|
||||||
deploy-master:
|
deploy-latest:
|
||||||
name: Deploy lowlighter/metrics@master
|
name: Deploy lowlighter/metrics@latest
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [ action-master-test ]
|
needs: [ action-latest-test ]
|
||||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[deploy]')
|
if: contains(github.event.head_commit.message, '[deploy]')
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy web instance
|
- name: Deploy web instance
|
||||||
run: "curl -H 'Content-Type: application/json' --data '${{ secrets.WEB_DEPLOY_TOKEN }}' -X POST https://deploy.metrics.lecoq.io"
|
run: "curl -H 'Content-Type: application/json' --data '${{ secrets.WEB_DEPLOY_TOKEN }}' -X POST https://deploy.metrics.lecoq.io"
|
||||||
|
|||||||
Reference in New Issue
Block a user