Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add new test workflow #2602

Merged
merged 25 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
23b7ed1
add new test workflow
dejanzele Jun 22, 2023
9f6acce
fix integration test target
dejanzele Jun 22, 2023
ec1aebd
fix unit test filter
dejanzele Jun 22, 2023
c808cfa
exclude jobservice test
dejanzele Jun 22, 2023
b790921
Merge branch 'master' into feat/test-workflow
kannon92 Jun 23, 2023
60b75de
add lint workflow
dejanzele Jun 27, 2023
b6560b5
Merge branch 'master' into feat/test-workflow
dejanzele Jun 27, 2023
f46166a
Merge branch 'feat/test-workflow' of github.com:dejanzele/armada into…
dejanzele Jun 27, 2023
4d4082b
remove branches condition for test workflow on pr
dejanzele Jun 27, 2023
325580b
Merge branch 'master' into feat/test-workflow
dejanzele Jun 28, 2023
8984404
add aggregate workflow for CI
dejanzele Jun 28, 2023
a062acb
Merge branch 'feat/test-workflow' of github.com:dejanzele/armada into…
dejanzele Jun 28, 2023
be1ca4d
make test job after lint job
dejanzele Jun 28, 2023
0ef06c0
add codeql job to ci
dejanzele Jun 28, 2023
7ff9ec3
fix permissions in ci workflow
dejanzele Jun 28, 2023
4535fc7
make codeql job run after lint job
dejanzele Jun 28, 2023
5fb890f
remove needs from ci workflow jobs
dejanzele Jun 28, 2023
397b126
run job on ubuntu 22.04
dejanzele Jun 28, 2023
dcea1da
move ts workflows to ci workflow
dejanzele Jun 28, 2023
9278fdf
rename jobs in ci workflow
dejanzele Jun 28, 2023
18c2e31
remove obsolete workflows
dejanzele Jun 28, 2023
1050e31
add junit report for ts tests
dejanzele Jun 28, 2023
ae97e4a
Merge branch 'master' into feat/test-workflow
dejanzele Jun 28, 2023
38ed669
Merge branch 'master' into feat/test-workflow
dejanzele Jun 29, 2023
ddd5aeb
Merge branch 'master' into feat/test-workflow
dejanzele Jun 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 0 additions & 73 deletions .github/workflows/go-integration.yml

This file was deleted.

66 changes: 0 additions & 66 deletions .github/workflows/go.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: "Lint"

on:
push:
branches:
- master
pull_request:

permissions:
contents: read
pull-requests: read

jobs:
lint-go:
name: Lint Go
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: Lint using golangci-lint
uses: golangci/golangci-lint-action@v3
with:
skip-pkg-cache: true
skip-build-cache: true
version: v1.52.2
only-new-issues: true
args: --timeout=10m --issues-exit-code=1 --sort-results ./...
203 changes: 203 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
name: Code Build and Tests

on:
push:
branches: [master]
pull_request:

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 localdev minimal testsuite

- 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ bin/
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
test-reports
*.out

# Dependency directories (remove the comment below to include it)
Expand Down
Loading