Skip to content

Merge pull request #1086 from morucci/1085 #581

Merge pull request #1086 from morucci/1085

Merge pull request #1086 from morucci/1085 #581

jobs:
publish-master-container:
if: "github.repository_owner == 'change-metrics'"
name: publish-master-container
runs-on: ubuntu-latest
steps:
- uses: "actions/[email protected]"
- 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'"
- 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:latest
name: Publish Master Container
on:
push:
branches:
- master