Skip to content

Commit

Permalink
add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
harveyxia committed Oct 29, 2024
1 parent 4d49ea4 commit 0a2f982
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
lint-and-test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version:
- "1.22"
env:
GOPRIVATE: github.com/reddit/achilles-sdk-api

container:
image: golang:${{ matrix.go-version }}

steps:
- uses: actions/checkout@v3

- name: Workaround Git Security Warning
run: |
# Workaround a bug in github actions:
# https://github.com/actions/runner-images/issues/6775.
git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
known_hosts: ${{ secrets.KNOWN_HOSTS }}
key: ${{ secrets.GO_MODULE_PRIVATE_KEY }}

- name: Setup access for private Go modules
run: |
git config --global url."ssh://[email protected]/".insteadOf https://github.com/
- name: Generate
run: |
# needed for running `tar -xJv` for installing shellcheck
apt-get update
apt-get install xz-utils
make generate
test -z '$(git status --porcelain)' || (echo "'make generate' made modifications. ensure 'make generate' has been run:"; git status -s; git --no-pager diff; false)
# lint code
make lint
test -z '$(git status --porcelain)' || (echo "'make lint' made modifications. ensure 'make lint' has been run:"; git status -s; git --no-pager diff; false)
- name: Test
run: make test

0 comments on commit 0a2f982

Please sign in to comment.