-
Notifications
You must be signed in to change notification settings - Fork 136
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
5 changed files
with
206 additions
and
147 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
name: Code Build and Tests | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
branches: [master] | ||
|
||
permissions: | ||
contents: read | ||
checks: write | ||
|
||
jobs: | ||
unit-tests: | ||
name: Unit Tests | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Golang with Cache | ||
uses: magnetikonline/action-golang-cache@v4 | ||
with: | ||
go-version: "1.20" | ||
|
||
- name: Setup dependencies | ||
shell: bash | ||
run: make download | ||
|
||
- name: Unit Tests | ||
id: unit_test | ||
run: make tests | ||
|
||
- name: Publish JUnit Report | ||
uses: mikepenz/action-junit-report@v3 | ||
if: always() | ||
with: | ||
report_paths: test-reports/unit-tests.xml | ||
fail_on_failure: true | ||
require_tests: true | ||
detailed_summary: true | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Upload Test Reports Artifacts | ||
if: always() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: unit-test-reports | ||
path: test-reports/ | ||
if-no-files-found: error | ||
|
||
- name: Send Coverage Report to Codecov | ||
if: always() | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
file: ./test-reports/coverage.out | ||
flags: unittests | ||
name: codecov-armada-unit-tests | ||
verbose: true | ||
|
||
integration-tests: | ||
name: Integration Tests | ||
runs-on: ubuntu-22.04 | ||
|
||
env: | ||
ARMADA_EXECUTOR_INGRESS_URL: "http://localhost" | ||
ARMADA_EXECUTOR_INGRESS_PORT: 5001 | ||
# Cache Docker layers in the GitHub actions cache. | ||
# These variables are picked up by the goreleaser config. | ||
DOCKER_BUILDX_CACHE_FROM: "type=gha" | ||
DOCKER_BUILDX_CACHE_TO: "type=gha,mode=max" | ||
DOCKER_BUILDX_BUILDER: "builder" | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Create Docker Buildx Builder | ||
run: docker buildx create --name ${DOCKER_BUILDX_BUILDER} --driver docker-container --use | ||
|
||
- name: Install Docker Buildx | ||
run: docker buildx install | ||
|
||
- name: Setup Golang with Cache | ||
uses: magnetikonline/action-golang-cache@v4 | ||
with: | ||
go-version: "1.20" | ||
|
||
- name: Setup dependencies | ||
shell: bash | ||
run: make download | ||
|
||
- name: Setup and Run Integration Tests | ||
run: | | ||
# Manually create folders to ensure perms are correct. | ||
mkdir -p .kube/internal | ||
mkdir -p .kube/external | ||
go run github.com/magefile/mage@v1.14.0 -v CiIntegrationTests | ||
- name: Upload JUnit Report Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: integration-rest-reports | ||
path: junit.xml | ||
if-no-files-found: error | ||
|
||
- name: Publish JUnit Report | ||
uses: mikepenz/action-junit-report@v3 | ||
if: always() | ||
with: | ||
report_paths: junit.xml | ||
fail_on_failure: true | ||
require_tests: true | ||
detailed_summary: true | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
go-mod-up-to-date: | ||
name: Go Mod Up To Date | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Golang with Cache | ||
uses: magnetikonline/action-golang-cache@v4 | ||
with: | ||
go-version: "1.20" | ||
|
||
- name: Download all Go modules | ||
run: go mod download | ||
|
||
- name: Check for tidyness of go.mod and go.sum | ||
run: | | ||
go mod tidy | ||
changed=$(git status -s -uno | wc -l) | ||
echo -e "### Git status" >> $GITHUB_STEP_SUMMARY | ||
if [[ "$changed" -gt 0 ]]; then | ||
echo -e "Go modules are not synchronized. Please run 'go mod tidy' and commit the changes." >> $GITHUB_STEP_SUMMARY | ||
git status -s -uno >> $GITHUB_STEP_SUMMARY | ||
echo -e >> $GITHUB_STEP_SUMMARY | ||
echo -e "### Git diff" >> $GITHUB_STEP_SUMMARY | ||
git --no-pager diff >> $GITHUB_STEP_SUMMARY | ||
else | ||
echo -e "Go modules are synchronized." >> $GITHUB_STEP_SUMMARY | ||
echo -e >> $GITHUB_STEP_SUMMARY | ||
fi | ||
exit $changed | ||
proto-up-to-date: | ||
name: Proto Up To Date | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Protoc | ||
uses: arduino/setup-protoc@v1 | ||
with: | ||
version: '3.17.3' | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Set up Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ matrix.go }} | ||
|
||
- name: Setup dependencies | ||
shell: bash | ||
run: make download | ||
|
||
# TODO(JayF): Consider moving this into its own job, that runs under a larger set of circumstances | ||
# since it's possible for this to fail without any go changes being made. | ||
- name: Validate no changes in generated proto files | ||
run: | | ||
make proto | ||
make dotnet | ||
changed=$(git status -s -uno | wc -l) | ||
echo -e "### Git status" >> $GITHUB_STEP_SUMMARY | ||
if [[ "$changed" -gt 0 ]]; then | ||
echo -e "Generated proto files are out of date. Please run 'make proto' and commit the changes." >> $GITHUB_STEP_SUMMARY | ||
git status -s -uno >> $GITHUB_STEP_SUMMARY | ||
echo -e >> $GITHUB_STEP_SUMMARY | ||
echo -e "### Git diff" >> $GITHUB_STEP_SUMMARY | ||
git --no-pager diff >> $GITHUB_STEP_SUMMARY | ||
else | ||
echo -e "Generated proto files are up to date." >> $GITHUB_STEP_SUMMARY | ||
echo -e >> $GITHUB_STEP_SUMMARY | ||
fi | ||
exit $changed |
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