Skip to content

Commit

Permalink
Merge pull request #6 from simpledotorg/add-cd
Browse files Browse the repository at this point in the history
Add ci/cd
  • Loading branch information
roypeter authored Sep 20, 2024
2 parents 58ae6d1 + 2b3b800 commit 3cc3894
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 28 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Build and deploy

on:
push:
branches:
- 'master'

jobs:
build:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/add-cd'
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_SIMPLEDOTORG_USERNAME }}
password: ${{ secrets.DOCKERHUB_SIMPLEDOTORG_ACCESS_TOCKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: simpledotorg/rtsl_exporter:${{ github.sha }}, simpledotorg/rtsl_exporter:latest

deploy:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/add-cd'
steps:
- uses: clowdhaus/argo-cd-action/@main
with:
version: 2.7.3
command: login ${{ secrets.SANDBOX_ARGOCD_ENDPOINT }}
options: --username ${{ secrets.ARGOCD_USERNAME }} --password ${{ secrets.SANDBOX_ARGOCD_PASSWORD }}
- uses: clowdhaus/argo-cd-action/@main
with:
version: 2.7.3
command: app set rtsl-exporter --helm-set image.tag=${{ github.sha }}
- uses: clowdhaus/argo-cd-action/@main
with:
version: 2.7.3
command: app wait rtsl-exporter --timeout 600
28 changes: 0 additions & 28 deletions .github/workflows/docker.yml

This file was deleted.

19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Test

on:
pull_request:
branches:
- '*'

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21.1'
- name: Run tests
run: go test ./... -v

0 comments on commit 3cc3894

Please sign in to comment.