Skip to content

Commit

Permalink
Simplify and tidy Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisdoherty4 committed Dec 23, 2022
1 parent 94f44ed commit 8b97351
Show file tree
Hide file tree
Showing 13 changed files with 145 additions and 224 deletions.
58 changes: 25 additions & 33 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:

- name: make verify
run: make verify

test:
runs-on: ubuntu-latest
steps:
Expand All @@ -45,14 +46,12 @@ jobs:
- name: Generate
run: nix-shell --run 'make generate'

- name: e2etest
run: make e2etest-setup

- name: go test
run: make test

- name: upload codecov
run: bash <(curl -s https://codecov.io/bash)

ci-checks:
runs-on: ubuntu-latest
steps:
Expand All @@ -68,12 +67,14 @@ jobs:
run: nix-shell --run 'true'

- run: PATH=$PWD/bin/:$PATH ./ci-checks.sh

# We preemptively build the binaries for efficiency instead of waiting on unit tests to pass
# hence this doesn't depend on anything.
crosscompile:
runs-on: ubuntu-latest
needs:
- ci-checks
- test
- verify
strategy:
matrix:
platform: [amd64, arm64]
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand All @@ -83,31 +84,16 @@ jobs:
with:
go-version: "1.18.5"

- run: make crosscompile -j$(nproc)

- name: Upload tink-server binaries
uses: actions/upload-artifact@v2
with:
name: tink-server
path: cmd/tink-server/tink-server-*

- name: Upload tink-worker binaries
uses: actions/upload-artifact@v2
with:
name: tink-worker
path: cmd/tink-worker/tink-worker-*
- name: Build linux/${{ matrix.platform }}
run: |
make build -j$(nproc) GOOS=linux GOARCH=${{ matrix.platform }}
- name: Upload virtual-worker binaries
- name: Upload binaries
uses: actions/upload-artifact@v2
with:
name: virtual-worker
path: cmd/virtual-worker/virtual-worker-*
name: binaries
path: bin/*

- name: Upload tink-controller binaries
uses: actions/upload-artifact@v2
with:
name: tink-controller
path: cmd/tink-controller/tink-controller-*
docker-images:
runs-on: ubuntu-latest
needs:
Expand Down Expand Up @@ -146,19 +132,25 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Download ${{ matrix.binary }} artifacts
- name: Download binaries
uses: actions/download-artifact@v2
with:
name: ${{ matrix.binary}}
path: cmd/${{ matrix.binary }}
name: binaries
path: ./bin

- run: |
ls -l .
ls -l bin/
file bin/
- name: Fix Permissions
run: chmod +x cmd/${{ matrix.binary }}/${{ matrix.binary }}*
run: chmod +x bin/*

- name: ${{ matrix.repository }}
uses: docker/build-push-action@v2
with:
context: cmd/${{ matrix.binary }}/
context: .
file: cmd/${{ matrix.binary }}/Dockerfile
cache-from: type=registry,ref=${{ matrix.repository }}:latest
push: ${{ startsWith(github.ref, 'refs/heads/main') }}
tags: ${{ steps.docker-image-tag.outputs.tags }}
Expand Down
Loading

0 comments on commit 8b97351

Please sign in to comment.