Skip to content

Commit

Permalink
Add a GitHub action for continuous integration
Browse files Browse the repository at this point in the history
Signed-off-by: Toby Cabot <toby@acnodal.io>
  • Loading branch information
caboteria committed Sep 8, 2023
1 parent 183d276 commit 9a77890
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
with: {submodules: recursive}

- uses: actions/setup-go@v4
with: {go-version: '=1.19.8'}

- name: Decide what we're going to call this
run: |
TAG_SPECIFIC=${{ github.ref_name }}
# if we're building from a branch (i.e., not a tag) then add
# the short sha so we can have more than one build per branch
if [[ ${{ github.ref }} != refs/tags/* ]]; then
TAG_SPECIFIC=${TAG_SPECIFIC}-$(git rev-parse --short HEAD)
fi
echo $TAG_SPECIFIC
echo "TAG_SPECIFIC=$TAG_SPECIFIC" >> $GITHUB_ENV
cat $GITHUB_ENV
- name: Make
run: |
make SUFFIX=${TAG_SPECIFIC} all docker-build
- name: Push
run: |
docker login -u epic-gateway+github_actions -p ${{ secrets.QUAY_EPIC_GATEWAY }} quay.io
make SUFFIX=${TAG_SPECIFIC} go-push docker-push
if: startsWith(github.ref, 'refs/tags/')
3 changes: 1 addition & 2 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ manifest:
- apt-get install -y gettext-base

script:
- make SUFFIX=${TAG_SPECIFIC} all
- make SUFFIX=${TAG_SPECIFIC} all go-push
- tar czf epic-install.tar.gz config deploy
- 'curl --silent --show-error --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file epic-install.tar.gz "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/manifest-package/${TAG_SPECIFIC}/epic-install.tar.gz"'
- 'curl --silent --show-error --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file deploy/epic-resource-model.yaml "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/manifest-package/${TAG_SPECIFIC}/epic-resource-model.yaml"'
- 'curl --silent --show-error --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file bin/manager "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/manifest-package/${TAG_SPECIFIC}/manager"'
- 'curl --silent --show-error --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file deploy/manager.service "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/manifest-package/${TAG_SPECIFIC}/manager.service"'
- 'curl --silent --show-error --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file deploy/manager-restart.service "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/manifest-package/${TAG_SPECIFIC}/manager-restart.service"'
- 'curl --silent --show-error --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file deploy/manager-restart.path "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/manifest-package/${TAG_SPECIFIC}/manager-restart.path"'
# FIXME: "go list" this module to add it to the checksum db

docker:
image: docker:20.10.5
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ fmt:
vet:
go vet ./...

.PHONY: go-push
go-push:
GOPROXY=proxy.golang.org go list -m epic-gateway.org/${PREFIX}@${SUFFIX}

# Generate code
.PHONY: generate
generate: controller-gen
Expand Down

0 comments on commit 9a77890

Please sign in to comment.