diff --git a/.github/workflows/ci-builds.yaml b/.github/workflows/ci-builds.yaml new file mode 100644 index 000000000..b9496720f --- /dev/null +++ b/.github/workflows/ci-builds.yaml @@ -0,0 +1,45 @@ +name: Development Builds + +on: + push: + branches-ignore: [ master, main ] + +jobs: + build-develop: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v2 + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: 7.3 + extensions: opcache, gd + tools: composer:v2 + coverage: none + env: + COMPOSER_TOKEN: ${{ secrets.GLOBAL_TOKEN }} + - name: Install packages + run: | + sudo apt-get -y update -qq < /dev/null > /dev/null + sudo apt-get -y install -qq git zip < /dev/null > /dev/null + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir -d bin/builder)" + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Build Gantry packages + run: composer build-dev + - name: Upload files to S3 + if: success() + uses: ochanje210/s3-upload-action@master + with: + AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY_SECURE}} + AWS_S3_BUCKET: ${{ secrets.S3_BUCKET }} + SOURCE_DIR: 'dist' + DEST_DIR: 'nightly' diff --git a/.github/workflows/build.yaml b/.github/workflows/release.yaml similarity index 98% rename from .github/workflows/build.yaml rename to .github/workflows/release.yaml index a5ab1eb67..2045cbf8b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/release.yaml @@ -8,6 +8,7 @@ jobs: build: if: "!github.event.release.prerelease" runs-on: ubuntu-latest + timeout-minutes: 10 steps: - uses: actions/checkout@v2 - name: Setup PHP diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 4144f91b2..27410004d 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -9,12 +9,11 @@ on: jobs: unit-tests: runs-on: ${{ matrix.os }} - strategy: matrix: php: [ 8.0, 7.4, 7.3] os: [ubuntu-latest] - + timeout-minutes: 10 steps: - uses: actions/checkout@v2 - name: Setup PHP diff --git a/bin/build b/bin/build index 1f539f0ae..6ac03f382 100755 --- a/bin/build +++ b/bin/build @@ -30,23 +30,26 @@ foreach ($argv as $arg) { $base = dirname(__DIR__); if (false === $hasVersion) { + $file = fopen("{$base}/CHANGELOG.md",'rb'); + if (preg_match('/^# (\d\.\d+.\d+(-[a-z0-9.]+)?)\s*$/i', fgets($file), $matches) !== 1) { + echo 'First line of CHANGELOG.md has wrong Gantry version format, aborting'; + return 1; + } + $version = $matches[1]; + if (false === $isProd && is_file("{$base}/.git/HEAD")) { $head = preg_replace('!^ref: (\S+)\s+$!m', '\\1', file_get_contents("{$base}/.git/HEAD")); - $version = substr(is_file("{$base}/.git/{$head}") ? file_get_contents("{$base}/.git/{$head}") : '', 0, 8); $branch = basename($head); + $commit = substr(is_file("{$base}/.git/{$head}") ? file_get_contents("{$base}/.git/{$head}") : '', 0, 8); if ($branch !== 'develop') { - $branch .= '-dev'; + $branch = 'dev-' . $branch; } - $version = 'dev-' . $version; + if (!strpos($version, '-dev')) { + $version .= '-dev'; + } + $version .= '-' . $commit; $argv[] = '-Dstr.fileversion=_' . $branch; - } else { - $file = fopen("{$base}/CHANGELOG.md",'rb'); - if (preg_match('/^# (\d\.\d+.\d+(-[a-z0-9.]+)?)\s*$/i', fgets($file), $matches) !== 1) { - echo 'First line of CHANGELOG.md has wrong Gantry version format, aborting'; - return 1; - } - $version = $matches[1]; } $argv[] = '-Dxml.version=' . $version;