Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: move to GitHub Actions, add workflow for building and pushing docker images #74

Merged
merged 2 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Docker image build

on:
push:
tags:
- 'v*'


defaults:
run:
shell: bash

env:
DOCKER_REPO: lightninglabs
DOCKER_IMAGE: lndmon

jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: lightninglabs/gh-actions/setup-qemu-action@39555064b3ae5c6d5c71a8ab304355faeaf3f4d4

- name: Set up Docker Buildx
uses: lightninglabs/gh-actions/setup-buildx-action@39555064b3ae5c6d5c71a8ab304355faeaf3f4d4

- name: Login to DockerHub
uses: lightninglabs/gh-actions/login-action@39555064b3ae5c6d5c71a8ab304355faeaf3f4d4
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_API_KEY }}

- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

- name: Build and push
id: docker_build
uses: lightninglabs/gh-actions/build-push-action@39555064b3ae5c6d5c71a8ab304355faeaf3f4d4
with:
push: true
platforms: linux/amd64,linux/arm64
tags: "${{ env.DOCKER_REPO }}/${{ env.DOCKER_IMAGE }}:${{ env.RELEASE_VERSION }}"
build-args: checkout=${{ env.RELEASE_VERSION }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
52 changes: 52 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CI

on:
push:
branches:
- "master"
pull_request:
branches:
- "*"

defaults:
run:
shell: bash

env:
# go needs absolute directories, using the $HOME variable doesn't work here.
GOCACHE: /home/runner/work/go/pkg/build
GOPATH: /home/runner/work/go
GO_VERSION: 1.16.8

jobs:
########################
# lint and build code
########################
lint:
name: lint and build code
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v2

- name: go cache
uses: actions/cache@v1
with:
path: /home/runner/work/go
key: lndmon-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
lndmon-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
lndmon-${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ github.job }}-
lndmon-${{ runner.os }}-go-${{ env.GO_VERSION }}-
lndmon-${{ runner.os }}-go-

- name: setup go ${{ env.GO_VERSION }}
uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'

- name: lint
run: make lint

- name: build
run: make build
23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.