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

Chore/GitHub actions 3 #12

Closed
wants to merge 71 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
b0aec54
Update
jannfis May 29, 2020
d7c1eef
Update
jannfis May 29, 2020
878c843
Update
jannfis May 29, 2020
57ac6e9
Update
jannfis May 29, 2020
c741244
Update
jannfis May 29, 2020
e92f47f
Update
jannfis May 29, 2020
03969d5
Update
jannfis May 29, 2020
d7af7c1
Update
jannfis May 29, 2020
3cb28fd
Update
jannfis May 29, 2020
0c370e0
Update
jannfis May 29, 2020
ab79229
Update
jannfis May 29, 2020
36a2a48
Update
jannfis May 29, 2020
92b1713
Update
jannfis May 29, 2020
aacddb9
Merge branch 'master' of https://github.com/argoproj/argo-cd into cho…
jannfis May 29, 2020
9cd4096
Update
jannfis May 29, 2020
d571d7f
Update go.mod
jannfis May 29, 2020
880ab24
Update
jannfis May 29, 2020
8863ef3
Update
jannfis May 29, 2020
96ced31
Reflect new controller-gen version
jannfis May 29, 2020
884d5fe
Update
jannfis May 29, 2020
92b3f57
Update
jannfis May 29, 2020
9083c08
Update
jannfis May 29, 2020
f1d1c70
Update
jannfis May 29, 2020
0730b98
Update
jannfis May 29, 2020
67338d5
Update
jannfis May 29, 2020
1332e90
Update
jannfis May 29, 2020
3add4ae
Update
jannfis May 29, 2020
6526641
Update
jannfis May 29, 2020
72d7691
Update
jannfis May 29, 2020
d1e5a05
Update
jannfis May 29, 2020
5c77028
Update
jannfis May 29, 2020
871a960
Update
jannfis May 29, 2020
68491ce
Update
jannfis May 29, 2020
dad96e1
Update
jannfis May 29, 2020
2c38461
Update
jannfis May 29, 2020
0975632
Update
jannfis May 29, 2020
8c469c7
Update
jannfis May 29, 2020
996eedd
Update
jannfis May 29, 2020
21e74dd
Update
jannfis May 29, 2020
f8da7af
Update
jannfis May 29, 2020
720f1d3
Update
jannfis May 29, 2020
6f5493f
Update
jannfis May 29, 2020
dabd610
Update
jannfis May 29, 2020
fe45cb6
Merge branch 'master' of https://github.com/argoproj/argo-cd into cho…
jannfis May 29, 2020
a6e952f
Update
jannfis May 29, 2020
032dca8
Update
jannfis May 29, 2020
5f0a515
Update
jannfis May 30, 2020
be7ead1
Merge branch 'master' of https://github.com/argoproj/argo-cd into cho…
jannfis May 30, 2020
9dec21b
Add linter
jannfis May 30, 2020
c3c3fc8
Merge branch 'chore/20200530-lint' into chore/github-actions-2
jannfis May 30, 2020
5046081
Remove golangci-lint from required build tools
jannfis May 30, 2020
4a123ab
Update
jannfis May 30, 2020
e9a6706
Update
jannfis May 30, 2020
930fa2f
Update
jannfis May 30, 2020
74b83b7
Update
jannfis May 30, 2020
ceea17d
Update
jannfis May 30, 2020
8a95cc6
Update
jannfis May 30, 2020
7b8b3da
Update
jannfis May 30, 2020
228aff4
Update
jannfis May 30, 2020
9208965
Update
jannfis May 30, 2020
f70139b
Update
jannfis May 30, 2020
f0107c5
Update
jannfis May 30, 2020
e0e59e8
Update
jannfis May 30, 2020
a10927e
Update
jannfis May 30, 2020
27ce977
Update
jannfis May 30, 2020
c45135a
Update
jannfis May 30, 2020
761b1ce
Update
jannfis May 30, 2020
549cb78
Update
jannfis May 30, 2020
125f00b
Update
jannfis May 30, 2020
caba573
Update
jannfis May 30, 2020
21efb58
Build
jannfis May 30, 2020
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
38 changes: 19 additions & 19 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -302,22 +302,22 @@ orbs:
workflows:
version: 2
workflow:
jobs:
- build
- test:
requires:
- build
- codegen:
requires:
- build
- ui:
requires:
- build
- sonarcloud:
context: SonarCloud
requires:
- test
- ui
- e2e:
requires:
- build
jobs: []
# - build
# - test:
# requires:
# - build
# - codegen:
# requires:
# - build
# - ui:
# requires:
# - build
# - sonarcloud:
# context: SonarCloud
# requires:
# - test
# - ui
# - e2e:
# requires:
# - build
314 changes: 314 additions & 0 deletions .github/workflows/ci-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,314 @@
name: Integration tests
on:
push:
branches:
- 'master'
pull_request:
branches:
- 'master'

jobs:
# build-go:
# name: Build & cache Go code
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Setup Golang
# uses: actions/setup-go@v1
# with:
# go-version: '1.14.2'
# - name: Restore go build cache
# uses: actions/cache@v1
# with:
# path: ~/.cache/go-build
# key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
# - name: Download all Go modules
# run: |
# go mod download
# - name: Compile all packages
# run: make build-local
lint-go:
name: Lint Go code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v1
with:
version: v1.26
args: --timeout 5m
test-go:
name: Run unit tests for Go packages
runs-on: ubuntu-latest
steps:
- name: Create checkout directory
run: mkdir -p ~/go/src/github.com/argoproj
- name: Checkout code
uses: actions/checkout@v2
- name: Create symlink in GOPATH
run: ln -s $(pwd) ~/go/src/github.com/argoproj/argo-cd
- name: Setup Golang
uses: actions/setup-go@v1
with:
go-version: '1.14.2'
- name: Install required packages
run: |
sudo apt-get install git -y
- name: Switch to temporal branch so we re-attach head
run: |
git switch -c temporal-pr-branch
git status
- name: Fetch complete history for blame information
run: |
git fetch --prune --no-tags --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- name: Add ~/go/bin to PATH
run: echo "::add-path::/home/runner/go/bin"
- name: Add /usr/local/bin to PATH
run: echo "::add-path::/usr/local/bin"
- name: Restore go build cache
uses: actions/cache@v1
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
- name: Install tools required for local execution
run: make install-tools-local
- name: Setup git username and email
run: |
git config --global user.name "John Doe"
git config --global user.email "[email protected]"
- name: Download and vendor all required packages
run: |
go mod download
- name: Compile all packages
run: make build-local
- name: Run all unit tests
run: make test-local
- name: Generate code coverage artifacts
uses: actions/upload-artifact@v2
with:
name: code-coverage
path: coverage.out
- name: Generate test results artifacts
uses: actions/upload-artifact@v2
with:
name: test-results
path: test-results/
codegen:
name: Check changes to generated code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Golang
uses: actions/setup-go@v1
with:
go-version: '1.14.2'
- name: Create symlink in GOPATH
run: |
mkdir -p ~/go/src/github.com/argoproj
cp -a ../argo-cd ~/go/src/github.com/argoproj
- name: Add /usr/local/bin to PATH
run: echo "::add-path::/usr/local/bin"
- name: Add ~/go/bin to PATH
run: echo "::add-path::/home/runner/go/bin"
- name: Download & vendor dependencies
run: |
go mod download
go mod vendor -v
working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
- name: Install tools required for local execution
run: make install-tools-local
working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
- name: Initialize local Helm
run: |
helm2 init --client-only
- name: Run codegen
run: |
set -x
export GOPATH=$(go env GOPATH)
make codegen-local
working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
- name: Check nothing has changed
run: |
set -xo pipefail
git diff --exit-code -- . ':!go.sum' ':!go.mod' ':!assets/swagger.json' | tee codegen.patch
working-directory: /home/runner/go/src/github.com/argoproj/argo-cd
build-ui:
name: Build, test & lint UI code
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup NodeJS
uses: actions/setup-node@v1
with:
node-version: '11.15.0'
- name: Restore node dependency cache
id: cache-dependencies
uses: actions/cache@v1
with:
path: ui/node_modules
key: ${{ runner.os }}-node-dep-v2-${{ hashFiles('**/yarn.lock') }}
- name: Install node dependencies
run: |
cd ui && yarn install --frozen-lockfile --ignore-optional --non-interactive
- name: Build UI code
run: |
yarn test
yarn build
env:
NODE_ENV: production
working-directory: ui/
- name: Run ESLint
run: yarn lint
working-directory: ui/
analyze:
name: Perform static code analysis
runs-on: ubuntu-latest
needs:
- test-go
- build-ui
env:
sonar_secret: ${{ secrets.SONAR_TOKEN }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Restore node dependency cache
id: cache-dependencies
uses: actions/cache@v1
with:
path: ui/node_modules
key: ${{ runner.os }}-node-dep-v2-${{ hashFiles('**/yarn.lock') }}
- name: Remove other node_modules directory
run: |
rm -rf ui/node_modules/argo-ui/node_modules
- name: Create test-results directory
run: |
mkdir -p test-results
- name: Get code coverage artifiact
uses: actions/download-artifact@v2
with:
name: code-coverage
- name: Get test result artifact
uses: actions/download-artifact@v2
with:
name: test-results
path: test-results
- name: Display working directory
run: ls -la
- name: Run SonarCloud scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SCANNER_VERSION: 4.2.0.1873
SCANNER_PATH: /tmp/cache/scanner
OS: linux
run: |
set -e
mkdir -p ${SCANNER_PATH}
export SONAR_USER_HOME=${SCANNER_PATH}/.sonar
if [[ ! -x "${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/bin/sonar-scanner" ]]; then
curl -Ol https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SCANNER_VERSION}-${OS}.zip
unzip -qq -o sonar-scanner-cli-${SCANNER_VERSION}-${OS}.zip -d ${SCANNER_PATH}
fi

chmod +x ${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/bin/sonar-scanner
chmod +x ${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/jre/bin/java

# Explicitly set NODE_MODULES
export NODE_MODULES=${PWD}/ui/node_modules
export NODE_PATH=${PWD}/ui/node_modules

${SCANNER_PATH}/sonar-scanner-${SCANNER_VERSION}-${OS}/bin/sonar-scanner

if: env.sonar_secret != ''
test-e2e:
name: Run end-to-end tests
runs-on: ubuntu-latest
# needs:
# - build-go
env:
GOPATH: /home/runner/go
ARGOCD_FAKE_IN_CLUSTER: "true"
ARGOCD_SSH_DATA_PATH: "/tmp/argo-e2e/app/config/ssh"
ARGOCD_TLS_DATA_PATH: "/tmp/argo-e2e/app/config/tls"
ARGOCD_E2E_SSH_KNOWN_HOSTS: "../fixture/certs/ssh_known_hosts"
ARGOCD_E2E_K3S: "true"
ARGOCD_IN_CI: "true"
ARGOCD_E2E_APISERVER_PORT: "8088"
ARGOCD_SERVER: "127.0.0.1:8088"
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Golang
uses: actions/setup-go@v1
with:
go-version: '1.14.2'
- name: Install K3S
env:
INSTALL_K3S_VERSION: v0.5.0
run: |
set -x
curl -sfL https://get.k3s.io | sh -
sudo chmod -R a+rw /etc/rancher/k3s
sudo mkdir -p $HOME/.kube && sudo chown -R runner $HOME/.kube
sudo k3s kubectl config view --raw > $HOME/.kube/config
sudo chown runner $HOME/.kube/config
kubectl version
- name: Restore go build cache
uses: actions/cache@v1
with:
path: ~/.cache/go-build
key: ${{ runner.os }}-go-build-v1-${{ github.run_id }}
- name: Add /usr/local/bin to PATH
run: echo "::add-path::/usr/local/bin"
- name: Add ~/go/bin to PATH
run: echo "::add-path::/home/runner/go/bin"
- name: Download Go dependencies
run: |
# No vendoring here
go mod download
- name: Install tools required for local execution
run: make install-tools-local
- name: Install goreman
run: |
go get github.com/mattn/goreman

- name: Setup git username and email
run: |
git config --global user.name "John Doe"
git config --global user.email "[email protected]"

- name: Pull Docker image required for tests
run: |
docker pull quay.io/dexidp/dex:v2.22.0
docker pull argoproj/argo-cd-ci-builder:v1.0.0
docker pull redis:5.0.3-alpine

- name: Run E2E server and wait for it being available
timeout-minutes: 30
run: |
set -x
# Something is weird in GH runners -- there's a phantom listener for
# port 8080 which is not visible in netstat -tulpen, but still there
# with a HTTP listener. We have API server listening on port 8088
# instead.
make start-e2e-local &
count=1
until curl -f http://127.0.0.1:8088/healthz; do
sleep 10;
if test $count -ge 60; then
echo "Timeout"
exit 1
fi
count=$((count+1))
done

- name: Run E2E testsuite
run: |
set -x
make test-e2e-local
Loading