feat: force all checks to validate a PR + remove dev tests

This commit is contained in:
Pierre Mavro
2021-02-06 16:23:06 +01:00
parent 1fba03e51c
commit 42adf0b12d
3 changed files with 29 additions and 52 deletions

View File

@@ -1,45 +0,0 @@
name: functionnal-tests
on:
push:
branches: [ dev ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: build engine
run: |
export PATH=$GITHUB_WORKSPACE/bin:$PATH
export RUSTC_WRAPPER=$GITHUB_WORKSPACE/bin/sccache
export SCCACHE_REDIS=${{ secrets.SCCACHE_REDIS }}
mkdir -p $GITHUB_WORKSPACE/bin
sccache_release=$(curl --silent "https://github.com/Qovery/sccache-bin/releases/latest" | sed -r 's/^.+tag\/(.+)">.+/\1/')
curl -sLo $GITHUB_WORKSPACE/bin/sccache https://github.com/Qovery/sccache-bin/releases/download/${sccache_release}/sccache
chmod 755 $GITHUB_WORKSPACE/bin/sccache
echo "########## SHARED CACHE STATUS ##########"
sccache --version
sccache --show-stats
echo "########## START BUILD ##########"
cargo build --release --all-features
sccache --show-stats
functionnal-tests:
runs-on: ubuntu-latest
needs: build
env:
GITLAB_PROJECT_ID: ${{ secrets.GITLAB_PROJECT_ID }}
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
GITLAB_PERSONAL_TOKEN: ${{ secrets.GITLAB_PERSONAL_TOKEN }}
steps:
- uses: actions/checkout@v1
- name: Run a multi-line script
timeout-minutes: 120
run: |
branch=$(echo ${{github.ref}} | sed -r 's/^refs\/heads\/(.+)/\1/')
echo "Branch name: $branch"
export GITHUB_BRANCH=$branch
./helper.sh full_tests

View File

@@ -1,4 +1,4 @@
name: functionnal-tests
name: tests
on:
push:
@@ -29,13 +29,13 @@ jobs:
echo "########## START BUILD ##########"
cargo build --release --all-features
sccache --show-stats
functionnal-tests:
selected-functionnal-tests:
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
needs: build
steps:
- uses: actions/checkout@v1
- name: Run a multi-line script
- name: Run selected functional tests
timeout-minutes: 120
env:
GITLAB_PROJECT_ID: ${{ secrets.GITLAB_PROJECT_ID }}
@@ -47,3 +47,20 @@ jobs:
export GITHUB_BRANCH=$branch
export GITHUB_COMMIT_ID=$GITHUB_SHA
./helper.sh autodetect
all-tests:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v1
- name: Only validate PR if all tests have been requested
timeout-minutes: 120
env:
GITLAB_PROJECT_ID: ${{ secrets.GITLAB_PROJECT_ID }}
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
GITLAB_PERSONAL_TOKEN: ${{ secrets.GITLAB_PERSONAL_TOKEN }}
run: |
branch=$(echo ${{github.ref}} | sed -r 's/^refs\/heads\/(.+)/\1/')
echo "Branch name: $branch"
export GITHUB_BRANCH=$branch
export GITHUB_COMMIT_ID=$GITHUB_SHA
./helper.sh check_gh_tags

View File

@@ -39,14 +39,11 @@ function gh_tags_selector_for_gitlab() {
num_labels=$(echo $gh_pr | jq '.labels | length')
all_labels=""
if [ $num_labels -gt 0 ] ; then
if [ "$num_labels" != "0" ] ; then
for i in $(echo $gh_pr | jq -r '.labels[].name' | grep 'test-') ; do
all_labels="$all_labels,$i"
done
all_labels=$(echo $all_labels | sed 's/^,//')
else
# default tests if no test label are specified
all_labels="test-aws-all"
fi
echo $all_labels
@@ -147,9 +144,17 @@ autodetect)
tags=$(gh_tags_selector_for_gitlab)
run_tests $tags
;;
check_gh_tags)
if [ gh_tags_selector_for_gitlab == "$all_labels" ] ; then
exit 0
fi
echo "You need to enable all the tests to validate this PR"
exit 1
;;
*)
echo "Usage:"
echo "$0 autodetect: autodetect tests to run based on tags"
echo "$0 full_tests: run full tests (with cloud providers check)"
echo "$0 check_gh_tags: get defined tags (only working if branch is a PR)"
;;
esac