-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |