Run integration tests in GH Actions #1482
Workflow file for this run
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
name: CI | |
on: | |
- pull_request | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: | | |
echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ env.cache_dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: | | |
${{ runner.os }}-composer- | |
- name: Install dependencies | |
run: | | |
composer install --no-dev --no-interaction --no-scripts | |
cd vendor-bin/box | |
composer install --no-interaction | |
- name: Symlink vendor/bin/box | |
run: | | |
mkdir -p vendor/bin | |
ln -s "$(realpath vendor-bin/box/vendor/bin/box)" vendor/bin/box | |
- name: Build platform.phar | |
env: | |
CI_COMMIT_SHA: ${{ github.event.after }} | |
CI_COMMIT_REF_NAME: ${{ github.head_ref }} | |
run: | | |
CI_COMMIT_SHORT_SHA=$(echo $CI_COMMIT_SHA | head -c8) | |
./bin/platform self:build --no-composer-rebuild --yes --replace-version "$CI_COMMIT_REF_NAME"-"$CI_COMMIT_SHORT_SHA" --output platform.phar | |
- name: Clone main CLI repository | |
run: git clone https://github.com/platformsh/cli.git ./cli | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.22 | |
cache-dependency-path: cli/go.sum | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: cli-phar | |
path: platform.phar | |
- name: Run integration tests | |
working-directory: ./cli | |
run: | | |
export TEST_CLI_PATH=$(realpath "./platform.phar") | |
chmod +x "$TEST_CLI_PATH" | |
go test ./tests -v | |
# TODO run these when upgraded for PHP 8+ compatibility | |
# - name: Run unit tests | |
# run: | | |
# # Install PHPUnit | |
# composer install --no-interaction --no-scripts | |
# ./scripts/test/unit.sh |