Bump tough-cookie and npm #54
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build, test and deploy | |
on: | |
push: | |
branches: | |
- '**' | |
tags: | |
- 'v*.*.*' | |
pull_request: | |
paths-ignore: | |
- "*.md" | |
env: | |
DOCKER_REPOSITORY: acouvreur/ssh-log-to-influx | |
CI: true | |
jobs: | |
build: | |
name: Build, test, Docker artifact and deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: | | |
${{ env.DOCKER_REPOSITORY }} | |
tags: | | |
type=ref,event=branch | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Install Dependencies | |
run: npm ci | |
- name: Test | |
run: npm test | |
- name: Build integration docker image | |
run: docker build -t acouvreur/ssh-log-to-influx:integration . | |
- name: Integration tests | |
run: | | |
set -ex | |
docker network create integration | |
echo "Starting influxdb..." | |
docker run -d --net integration --name influx influxdb:latest | |
echo "Starting acouvreur/ssh-log-to-influx:integration" | |
docker run -d --net integration --name sshlogtoinflux -p 7070:7070 -e INFLUX_URL=influx -e INFLUX_DB=integration -e DEBUG_LEVEL=debug acouvreur/ssh-log-to-influx:integration | |
sleep 1s | |
echo "Failed password for username from 213.111.245.224 port 61832 ssh2" - | netcat 127.0.0.1 7070 | |
sleep 1s | |
docker logs sshlogtoinflux | |
[ $(docker inspect -f '{{.State.Running}}' sshlogtoinflux) == "true" ] | |
- name: install buildx | |
if: github.ref == 'refs/heads/master' | |
id: buildx | |
uses: crazy-max/ghaction-docker-buildx@v1 | |
with: | |
version: latest | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v1 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to DockerHub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Multiarch Docker build and push | |
uses: docker/build-push-action@v2 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm/v7,linux/arm64 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |