mirror of
https://github.com/jlengrand/engine.git
synced 2026-03-10 08:11:21 +00:00
88 lines
3.3 KiB
YAML
88 lines
3.3 KiB
YAML
name: tests
|
|
|
|
on:
|
|
push:
|
|
branches-ignore: [ main, dev ]
|
|
pull_request:
|
|
branches-ignore: [ main, dev ]
|
|
|
|
concurrency:
|
|
cancel-in-progress: true
|
|
group: ${{ github.ref }}
|
|
|
|
jobs:
|
|
build-linter-utests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: 1.60.0
|
|
components: rustfmt, clippy
|
|
|
|
- uses: hashicorp/setup-terraform@v1
|
|
with:
|
|
terraform_version: 0.14.10
|
|
- uses: sergeysova/jq-action@v2
|
|
id: sccache_release
|
|
with:
|
|
cmd: 'curl --silent "https://api.github.com/repos/Qovery/sccache-bin/releases/latest" | jq .tag_name'
|
|
multiline: false
|
|
- name: build-linter-utests
|
|
run: |
|
|
echo "########## LINTER ##########"
|
|
cargo fmt --all -- --check --color=always || (echo "Use cargo fmt to format your code"; exit 1)
|
|
cargo clippy --all --all-features --lib -- -D warnings || (echo "Solve your clippy warnings to continue"; exit 1)
|
|
export PATH=$GITHUB_WORKSPACE/bin:$PATH
|
|
export RUSTC_WRAPPER=$GITHUB_WORKSPACE/bin/sccache
|
|
export TF_PLUGIN_CACHE_DIR=$HOME/.terraform.d/plugin-cache
|
|
export SCCACHE_REDIS=${{ secrets.SCCACHE_REDIS }}
|
|
mkdir -p $GITHUB_WORKSPACE/bin $HOME/.terraform.d/plugin-cache
|
|
curl -sLo $GITHUB_WORKSPACE/bin/sccache https://github.com/Qovery/sccache-bin/releases/download/${{ steps.sccache_release.outputs.value }}/sccache
|
|
chmod 755 $GITHUB_WORKSPACE/bin/sccache
|
|
echo "########## SHARED CACHE STATUS ##########"
|
|
sccache --version
|
|
sccache --show-stats
|
|
echo "########## START BUILD ##########"
|
|
cargo build --all-features --tests
|
|
sccache --show-stats
|
|
echo "########## START UNIT TESTS ##########"
|
|
cargo test
|
|
selected-functional-tests:
|
|
runs-on: ubuntu-latest
|
|
if: github.event.pull_request.draft == false
|
|
needs: build-linter-utests
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: Run selected functional tests
|
|
timeout-minutes: 180
|
|
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
|
|
trap "./helper.sh stop_gitlab_pipeline" SIGTERM SIGINT
|
|
./helper.sh autodetect &
|
|
wait $!
|
|
all-tests-enabled:
|
|
runs-on: ubuntu-latest
|
|
needs: build-linter-utests
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- name: Only validate PR if all tests have been requested
|
|
timeout-minutes: 180
|
|
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
|