This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
ci: Migrate tests to GitHub actions #2940
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3d604f3
ci: run unit tests in GitHub Actions
stefanprodan 650c61c
ci: add probes to gitsrv to avoid random failures
stefanprodan 1cd900a
ci: run e2e tests in GitHub Actions
stefanprodan 36deaa8
ci: disable e2e tests in CircleCI
stefanprodan 61b5ce8
ci: disable unit tests in CircleCI
stefanprodan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,19 @@ | ||
name: artifacts-cleanup | ||
|
||
on: | ||
schedule: | ||
# Every day at 1am | ||
- cron: '0 1 * * *' | ||
|
||
jobs: | ||
remove-old-artifacts: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
steps: | ||
- name: Remove old artifacts | ||
uses: c-hive/gha-remove-artifacts@v1 | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
age: '1 day' | ||
skip-tags: false |
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,73 @@ | ||
name: ci | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
unit-testing: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: niden/actions-memcached@v7 | ||
- name: Restore Go cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Setup Go | ||
uses: actions/setup-go@v2-beta | ||
with: | ||
go-version: 1.14.x | ||
- name: Run tests | ||
run: make test TEST_FLAGS="-race -tags integration -timeout 5m" | ||
- name: Check codegen | ||
run: make check-generated | ||
- name: Build binaries | ||
run: make all | ||
- name: Prepare cache | ||
run: | | ||
cp "$(go env GOPATH)/bin/fluxctl" cache/fluxctl | ||
docker save -o cache/flux-latest.tar fluxcd/flux:latest | ||
- name: Upload cache | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: cache | ||
path: cache | ||
e2e-testing: | ||
runs-on: ubuntu-latest | ||
needs: unit-testing | ||
strategy: | ||
matrix: | ||
test: ['10_* 11_* 12_*', '13_* 14_*', '15_* 16_* 17_*', '20_* 21_* 22_*'] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: engineerd/[email protected] | ||
- name: Restore Go cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- name: Setup Go | ||
uses: actions/setup-go@v2-beta | ||
with: | ||
go-version: 1.14.x | ||
- name: Download cache | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: cache | ||
- name: Load cache | ||
run: | | ||
chmod +x cache/fluxctl | ||
sudo mv cache/fluxctl /usr/local/bin/fluxctl | ||
docker load --input cache/flux-latest.tar -q | ||
kind load docker-image fluxcd/flux:latest | ||
- name: Run tests | ||
run: | | ||
E2E_TESTS='${{ matrix.test }}' make e2e-gh |
12 changes: 9 additions & 3 deletions
12
.github/workflows/check-links.yaml → .github/workflows/docs.yaml
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
|
||
# This script runs the bats tests | ||
|
||
# Directory paths we need to be aware of | ||
FLUX_ROOT_DIR="$(git rev-parse --show-toplevel)" | ||
E2E_DIR="${FLUX_ROOT_DIR}/test/e2e" | ||
CACHE_DIR="${FLUX_ROOT_DIR}/cache/$CURRENT_OS_ARCH" | ||
|
||
KIND_VERSION=v0.7.0 | ||
KUBE_VERSION=v1.14.10 | ||
GITSRV_VERSION=v1.0.0 | ||
KIND_CACHE_PATH="${CACHE_DIR}/kind-$KIND_VERSION" | ||
KIND_CLUSTER_PREFIX=flux-e2e | ||
BATS_EXTRA_ARGS="" | ||
|
||
# shellcheck disable=SC1090 | ||
source "${E2E_DIR}/lib/defer.bash" | ||
trap run_deferred EXIT | ||
|
||
mkdir -p "${FLUX_ROOT_DIR}/cache" | ||
curl -sL "https://github.com/fluxcd/gitsrv/releases/download/${GITSRV_VERSION}/known_hosts.txt" > "${FLUX_ROOT_DIR}/cache/known_hosts" | ||
|
||
echo '>>> Running the tests' | ||
# Run all tests by default but let users specify which ones to run, e.g. with E2E_TESTS='11_*' make e2e | ||
E2E_TESTS=${E2E_TESTS:-.} | ||
( | ||
cd "${E2E_DIR}" | ||
# shellcheck disable=SC2086 | ||
"${E2E_DIR}/bats/bin/bats" -t ${BATS_EXTRA_ARGS} ${E2E_TESTS} | ||
) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would something like
be an option (with additional logic added to
run-gh.bash
)? This would make (newly) added tests run without (forgetting) to add them here.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've balanced the tests to take the same amount of time, for example running 15 in shard 2 will take 18m
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should refactor the tests and have the balancing logic in bash, but this can come later.