Skip to content

[patch] fix: switch pending status to pr trigger step #332

[patch] fix: switch pending status to pr trigger step

[patch] fix: switch pending status to pr trigger step #332

Workflow file for this run

name: Build and test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build-test:
name: Build & Test
runs-on: ubuntu-20.04
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
CI: true
KUBECONFIG: /tmp/s2h/k3s-kubeconfig
POD_NAMESPACE: default
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
TEST_GIT_USERNAME: ${{ secrets.TEST_GIT_USERNAME }}
TEST_GIT_PASSWORD: ${{ secrets.TEST_GIT_PASSWORD }}
steps:
- name: Checking credentials
run: |
if [ -z "$TEST_GIT_USERNAME" ]; then
echo "No TEST_GIT_USERNAME env variable set"
exit 1
elif [ -z "$TEST_GIT_PASSWORD" ]; then
echo "No TEST_GIT_PASSWORD env variable set"
exit 1
fi
# BUILD
- uses: actions/setup-go@v1
with:
go-version: '1.17.2'
- uses: actions/checkout@v1
with:
path: go/src/github.com/agoda-com/samsahai
- name: Prepare ENV
run: |
export GOPATH=/home/runner/work/samsahai/go
echo "::set-env name=GOROOT::$GOROOT"
echo "::set-env name=GOPATH::$GOPATH"
echo "::set-env name=INSTALL_DIR::$GOPATH/bin/"
- uses: actions/cache@v1
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Install Dependencies
run: |
sudo mkdir -p $GOPATH/bin
sudo chmod -R ugo+rw $GOPATH/bin
make install-dep SUDO="sudo " DEBUG=1
echo "::set-env name=GO111MODULE::on"
echo "::add-path::/usr/local/kubebuilder/bin:$GOPATH/bin:$GOROOT/bin"
go mod tidy
# TEST
## run unit test
- name: Run Unit Test
run: |
make unit-test
- name: Unit Test Coverage
run: |
make overall-coverage
## run e2e test
- name: Prepare E2E Test Environment
run: |
make prepare-env-e2e-k3d
- name: Run E2E Test
run: |
kubectl version
kubectl cluster-info
helm version
make e2e-test-k3d DEBUG=1
timeout-minutes: 30
- name: E2E Test Coverage
run: |
make overall-coverage
curl -s https://codecov.io/bash | bash -s - -t $CODECOV_TOKEN
- name: Save test results
if: always()
run: |
mkdir -p ./test/result/
find . -type f -regex "./.*unit-test.xml" -exec cp {} ./test/result/ \;
ls -al ./test/result/
- name: Store artifacts
if: always()
uses: actions/upload-artifact@v1
with:
name: test-result
path: ./test/result