54 lines
1.6 KiB
YAML
54 lines
1.6 KiB
YAML
name: Build, test, analyze and publish
|
|
|
|
on:
|
|
push:
|
|
branches: [ master ]
|
|
pull_request:
|
|
branches: [ master ]
|
|
paths-ignore:
|
|
- '**/*.md'
|
|
- '**/*.png'
|
|
|
|
jobs:
|
|
|
|
docker-master:
|
|
name: Update GitHub Packages
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
- name: Login to GitHub registry
|
|
run: echo ${{ secrets.CONTAINER_REGISTRY_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
|
|
- name: Build docker image
|
|
run: docker build -t ghcr.io/lowlighter/metrics:master .
|
|
- name: Publish to GitHub registry
|
|
run: docker push ghcr.io/lowlighter/metrics:master
|
|
|
|
build:
|
|
name: Build and test
|
|
runs-on: ubuntu-latest
|
|
needs: [ docker-master ]
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v2
|
|
- name: Build lowlighter/metrics:${{ github.head_ref || 'master' }}
|
|
run: docker build -t lowlighter/metrics:${{ github.head_ref || 'master' }} .
|
|
- name: Run tests
|
|
run: docker run --workdir=/metrics --entrypoint="" lowlighter/metrics:${{ github.head_ref || 'master' }} npm test
|
|
|
|
analyze:
|
|
name: Analyze code
|
|
runs-on: ubuntu-latest
|
|
needs: [ build ]
|
|
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
|