Skip to content

test: cover project users, organization users and teams #877

test: cover project users, organization users and teams

test: cover project users, organization users and teams #877

Workflow file for this run

name: CI
on:
push:
branches:
- main
pull_request:
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v7
- name: Setup Go
uses: actions/setup-go@v7
with:
go-version-file: ./go.mod
- name: Create fake PHP and .phar files
run: |
# These are needed so that the linter does not complain
mkdir -p internal/legacy/archives
touch internal/legacy/archives/platform.phar
touch internal/legacy/archives/commands-upsun.json internal/legacy/archives/commands-platformsh.json internal/legacy/archives/commands-vendor.json
touch internal/legacy/archives/php_windows_amd64
touch internal/legacy/archives/php_linux_amd64
touch internal/legacy/archives/php_linux_arm64
touch internal/legacy/archives/php_darwin_amd64
touch internal/legacy/archives/php_darwin_arm64
touch internal/config/embedded-config.yaml
- name: Check go.mod is tidy
run: go mod tidy -diff
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v9
with:
version: v2.14
args: --timeout=5m
- name: Run tests
run: make test-go
- name: Check goreleaser config
run: make goreleaser-check
# Checks that the embedded image registry matches upstream.
# Fails when upstream publishes changes; run `make update-registry` to refresh.
# Non-blocking, since upstream changes are unrelated to the pull request.
image-registry:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Check out repository code
uses: actions/checkout@v7
- name: Setup Go
uses: actions/setup-go@v7
with:
go-version-file: ./go.mod
- name: Check the embedded image registry is up to date
run: make check-registry
legacy-php:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v7
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
extensions: curl, openssl, phar, zlib
tools: composer:v2
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config --global cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('legacy/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: make composer-dev
- name: Lint PHP
run: make lint-php
- name: Run PHPUnit tests
run: make test-php
- name: Build platform.phar
run: make internal/legacy/archives/platform.phar
integration-test:
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@v7
- name: Setup Go
uses: actions/setup-go@v7
with:
go-version-file: ./go.mod
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.5'
extensions: curl, openssl, phar, zlib
tools: composer:v2
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config --global cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('legacy/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Download PHP binary
run: make php
- name: Build platform.phar
run: make phar
- name: Build CLI
run: make single
- name: Install shells for completion tests
run: sudo apt-get update && sudo apt-get install -y bash-completion zsh fish
# Not `make test-integration`, which would build the CLI again.
- name: Run integration tests
run: cd integration-tests && go test -count=1 ./...
- name: Run integration tests with Go auth
run: cd integration-tests && go test -count=1 ./...
env:
TEST_CLI_GO_AUTH: '1'
# The only Windows coverage: which certificates the embedded PHP trusts.
windows-cert-store:
runs-on: windows-latest
steps:
- name: Check out repository code
uses: actions/checkout@v7
- name: Setup Go
uses: actions/setup-go@v7
with:
go-version-file: ./go.mod
- name: Download embedded PHP files
shell: bash
run: |
php_version=$(grep -m1 '^PHP_VERSION' Makefile | cut -d' ' -f3)
mkdir -p internal/legacy/archives
curl -fSL "https://github.com/upsun/cli-php-builds/releases/download/php-$php_version/php-$php_version-windows-amd64.exe" \
-o internal/legacy/archives/php_windows.exe
curl -fSL https://curl.se/ca/cacert.pem -o internal/legacy/archives/cacert.pem
# Only needed so that the package builds.
touch internal/legacy/archives/platform.phar
touch internal/legacy/archives/commands-upsun.json internal/legacy/archives/commands-platformsh.json
- name: Run Windows tests
shell: bash
env:
CLI_TEST_MODIFY_CERT_STORE: '1'
run: go test -v -count=1 -timeout 3m -run TestWindows ./internal/legacy/
# Reading the certificate store happens before every legacy command.
- name: Measure building the CA bundle
if: always()
shell: bash
run: go test -run '^$' -bench BenchmarkWindows -benchmem ./internal/legacy/