Files
metrics/.github/workflows/workflow.yml
2020-12-30 21:51:02 +01:00

58 lines
1.8 KiB
YAML

name: Build, test, analyze and publish
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
paths-ignore:
- '**/*.md'
- '**/*.png'
jobs:
docker:
name: Update GitHub Packages
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, '[rebuild docker image]')
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Publish image to GitHub Packages
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: lowlighter/metrics/metrics
tag_with_ref: true
dockerfile: source/docker/Dockerfile
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Login to GitHub registry
run: docker login docker.pkg.github.com -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
- 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