-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Github Actions Workflow - One Step Out of Many
1. Improve go linting and decouple it from pre-commits 2. Create the Notion of a pipeline in github actions, and not just standalone workflows 3. Use CI built binaries in Test Containers Suite Linear: https://linear.app/expanso/issue/ENG-292/bring-back-lint and https://linear.app/expanso/issue/ENG-286/unify-our-cicd-location Github: #4639 and #4650
- Loading branch information
Showing
18 changed files
with
220 additions
and
192 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,77 @@ | ||
name: Build Bacalhau Binaries | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
build: | ||
name: Build Binary | ||
runs-on: ubuntu-latest | ||
outputs: | ||
status: ${{ job.status }} | ||
strategy: | ||
matrix: | ||
include: | ||
- os: linux | ||
goarch: amd64 | ||
- os: linux | ||
goarch: arm64 | ||
- os: linux | ||
goarch: armv7 | ||
- os: linux | ||
goarch: armv6 | ||
- os: darwin | ||
goarch: amd64 | ||
- os: darwin | ||
goarch: arm64 | ||
- os: windows | ||
goarch: amd64 | ||
|
||
steps: | ||
- name: Install earthly | ||
uses: earthly/actions-setup@v1 | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: "0" # Need to fetch all due to how bacalhau constructs semver | ||
|
||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.work | ||
|
||
- name: Build | ||
env: | ||
GOOS: ${{ matrix.os }} | ||
GOARCH: ${{ matrix.goarch }} | ||
PRIVATE_PEM: ${{ secrets.PRIVATE_PEM }} | ||
PUBLIC_PEM: ${{ secrets.PUBLIC_PEM }} | ||
PRIVATE_KEY_PASSPHRASE: ${{ secrets.PRIVATE_KEY_PASSPHRASE }} | ||
run: | | ||
# Add Keys to expected files | ||
echo "${PRIVATE_PEM}" > /tmp/private.pem && chmod 600 /tmp/private.pem | ||
echo "${PUBLIC_PEM}" > /tmp/public.pem && chmod 600 /tmp/public.pem | ||
# Start build | ||
echo "==> Building bacalhau binary for: ${GOOS} ${GOARCH}..." | ||
make build-bacalhau-tgz | ||
echo "===> Done building bacalhau binary." | ||
# Listing Builds | ||
echo "===> Built Artifacts:" | ||
ls -lh dist/ | ||
# Remove keys, good security practice | ||
rm /tmp/private.pem /tmp/public.pem | ||
- name: Upload binary artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.os }}-${{ matrix.goarch }} | ||
path: "dist/bacalhau_*" | ||
retention-days: 1 # Short retention since these are intermediate artifacts, also save money | ||
|
||
- name: Report build status | ||
if: always() | ||
run: | | ||
echo "Build completed for ${{ matrix.os }}-${{ matrix.goarch }}" | ||
echo "Status: ${{ job.status }}" |
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
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
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,31 @@ | ||
name: Main Pipeline | ||
|
||
on: | ||
push: | ||
branches: ["eng-292/jamlo/improve-go-linting-in-ci"] | ||
# pull_request: | ||
# branches: [main] | ||
# repository_dispatch: | ||
# types: [ok-to-test] | ||
|
||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yml | ||
secrets: inherit | ||
|
||
lint: | ||
uses: ./.github/workflows/lint.yml | ||
|
||
swagger-validation: | ||
uses: ./.github/workflows/swagger-validation.yml | ||
|
||
cspell: | ||
uses: ./.github/workflows/cspell.yml | ||
|
||
testcontainers-suite: | ||
needs: [build, lint, swagger-validation, cspell] | ||
if: success() | ||
uses: ./.github/workflows/testcontainers-suite.yml | ||
with: | ||
os: linux | ||
arch: amd64 |
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
This file was deleted.
Oops, something went wrong.
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,41 @@ | ||
name: TestContainers Suite | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
os: | ||
required: true | ||
type: string | ||
arch: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Download compiled binary | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: ${{ inputs.os }}-${{ inputs.arch }} | ||
path: compiled-artifacts/ | ||
|
||
- name: Install Golang | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.work | ||
|
||
- name: Run Go tests in integration test directory | ||
shell: bash | ||
run: | | ||
echo "===> Copy compiled artifact to use in docker images..." | ||
cd compiled-artifacts | ||
tar -xzf bacalhau_*.tar.gz | ||
cp ./bacalhau ../test_integration/common_assets/bacalhau_bin | ||
echo "===> Running tests..." | ||
cd ../test_integration | ||
go test -v -count=1 ./... |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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
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
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
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 |
---|---|---|
|
@@ -38,5 +38,5 @@ Then: | |
|
||
```shell | ||
cd test_integration | ||
go test -v -count=1 ./... | ||
./run_locally.sh | ||
``` |
Oops, something went wrong.