Skip to content

Merge pull request #1114 from morucci/1.11.1 #23

Merge pull request #1114 from morucci/1.11.1

Merge pull request #1114 from morucci/1.11.1 #23

Workflow file for this run

jobs:
publish-tag-container:
if: "github.repository_owner == 'change-metrics'"
name: publish-tag-container
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@v2.4.0"
- uses: "cachix/install-nix-action@v20"
with:
nix_path: nixpkgs=channel:nixos-unstable
- uses: "cachix/cachix-action@v12"
with:
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
name: change-metrics
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Set write permission for data directory
run: "chmod o+w data"
- name: Create a config.yaml file
run: |
cat > etc/config.yaml << EOF
---
workspaces:
- name: monocle
crawlers:
- name: github-tekton
update_since: "2020-01-01"
provider:
github_organization: tekton
EOF
- name: Create a secret.yaml file
run: |
cat > .secrets << EOF
CRAWLERS_API_KEY=secret
GITHUB_TOKEN=123
EOF
- name: Build monocle-exe container
run: "nix build .#containerMonocle; docker load < ./result"
- name: Build docker image
run: docker build -t quay.io/change-metrics/monocle:latest .
- name: Set Monocle compose image to latest
run: "echo \"COMPOSE_MONOCLE_VERSION=latest\" > .env"
- name: Start Monocle compose
run: docker-compose up -d
- name: Wait for services to start
run: sleep 45
- name: Display docker-compose ps
run: docker-compose ps
- name: Display docker-compose logs
run: docker-compose logs
- name: Check services are running
run: "test -z \"$(sudo docker-compose ps -a | grep Exit)\""
- name: Check api service through nginx
run: "curl -s --fail -H 'Content-type: application/json' http://localhost:8080/api/2/get_workspaces -d '{}' | grep 'workspaces'"
- name: Check web service to fetch web app
run: "curl -s http://localhost:8080/index.html | grep 'window.document.title'"
- id: tagName
name: Discover GIT tag
uses: "olegtarasov/get-tag@v2.1"
- name: Display tag name
run: "echo \"Discovered tag: $GIT_TAG_NAME\""
- name: Tag the container image
run: "docker tag quay.io/change-metrics/monocle:latest quay.io/change-metrics/monocle:$GIT_TAG_NAME"
- name: Login on quay.io
run: "docker login -u \"${{ secrets.QUAYIO_USERNAME }}\" -p \"${{ secrets.QUAYIO_PASSWORD }}\" quay.io"
- name: Publish image to quay.io
run: "docker push quay.io/change-metrics/monocle:$GIT_TAG_NAME"
name: Publish Tag Container
on:
push:
tags:
- "*"