-
Notifications
You must be signed in to change notification settings - Fork 24
51 lines (49 loc) · 1.45 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
on:
pull_request: {}
push: {}
name: Continuous integration
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '^1.16'
- name: go build
run: |
go build ./...
- name: go install
run: |
GOBIN=$(pwd)/install go install ./...
- name: go test
run: |
PATH=$PATH:$(pwd)/install go test -tags llama.runtime ./...
- name: Check license headers
run: |
./scripts/dev/check-license
build-image:
runs-on: ubuntu-latest
env:
GHCR_TOKEN: ${{secrets.GHCR_TOKEN}}
steps:
- uses: actions/checkout@v2
- name: Login to GitHub Container Registry
if: env.GHCR_TOKEN
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Build docker image
run: |
docker build -t "ghcr.io/nelhage/llama:$GITHUB_SHA" .
- name: Push docker image
if: env.GHCR_TOKEN
run: |
docker push "ghcr.io/nelhage/llama:$GITHUB_SHA"
- name: Tag "latest" docker container
if: ${{github.event_name == 'push' && github.ref == 'refs/heads/main'}}
run: |
docker tag "ghcr.io/nelhage/llama:$GITHUB_SHA" "ghcr.io/nelhage/llama:latest"
docker push "ghcr.io/nelhage/llama:latest"