chore(deps): lock file maintenance #9
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: | |
push: | |
pull_request: | |
branches: main | |
jobs: | |
spellcheck: | |
name: 'Spellcheck' | |
permissions: | |
contents: read | |
runs-on: ubuntu-latest | |
if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.base.repo.id != github.event.pull_request.head.repo.id) || github.event_name == 'push' }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'Perform Spellcheck' | |
uses: streetsidesoftware/cspell-action@v6 | |
with: | |
incremental_files_only: true | |
php-build-test: | |
name: 'PHP Build and Test' | |
permissions: | |
contents: read | |
needs: [ spellcheck ] | |
if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.base.repo.id != github.event.pull_request.head.repo.id) || github.event_name == 'push' }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
php: [8.2, 8.3, 8.4] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 'PHP Build' | |
uses: FOSSBilling/.workflows/.github/actions/php-build@3e9ace8872ed7d0961a73e7677d19cd9f58846df | |
with: | |
php-version: ${{ matrix.php }} | |
- name: 'Prepare Test Environment' | |
run: | | |
cp ./src/config-sample.php ./src/config.php | |
mkdir -p ./src/data/{cache,log} | |
echo APP_ENV=test >> $GITHUB_ENV | |
- name: 'PHP Tests (PHPStan and PHPUnit)' | |
uses: FOSSBilling/.workflows/.github/actions/php-test@3e9ace8872ed7d0961a73e7677d19cd9f58846df | |
with: | |
php-version: ${{ matrix.php }} | |
phpstan-enable: 'true' | |
phpstan-php-version: 8.4 | |
phpstan-version: 'latest' | |
phpunit-enable: 'true' | |
phpunit-version: 10 | |
preview-build: | |
name: 'Create Preview Release' | |
permissions: | |
contents: read | |
needs: [ php-build-test ] | |
if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.base.repo.id != github.event.pull_request.head.repo.id) || github.event_name == 'push' }} | |
uses: ./.github/workflows/release-build.yml | |
with: | |
artifact-name: 'preview-build' | |
preview: true | |
upload-preview: | |
name: 'Upload Preview Release' | |
permissions: | |
contents: read | |
needs: [ preview-build ] | |
if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.base.repo.id != github.event.pull_request.head.repo.id) || github.event_name == 'push' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Download Preview Release Archive' | |
uses: actions/download-artifact@v4 | |
with: | |
name: preview-build | |
path: '/tmp' | |
- name: 'Extract Preview Release Archive' | |
run: | | |
mkdir ./src | |
tar -xvf /tmp/build.tar -C ./src | |
- name: 'Create Downloadable Preview' | |
run: zip -r ../FOSSBilling-preview.zip . | |
working-directory: ./src/ | |
- name: 'Move Downloadable Preview for Upload' | |
run: | | |
mkdir ./dist | |
mv ./FOSSBilling-preview.zip ./dist | |
- name: 'Upload Downloadable Preview to S3' | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: '--acl public-read --follow-symlinks' | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_S3_ENDPOINT: ${{ secrets.AWS_S3_ENDPOINT }} | |
AWS_REGION: 'auto' | |
SOURCE_DIR: './dist' | |
- name: 'Upload Downloadable Preview to GitHub' | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: 'error' | |
name: 'FOSSBilling Preview' | |
path: './src/*' | |
retention-days: 14 | |
deploy-preview-docker: | |
name: 'Build and Push Preview to Docker Hub' | |
permissions: | |
contents: read | |
actions: write | |
needs: [ preview-build ] | |
if: ${{ github.ref == 'refs/heads/main' }} | |
uses: FOSSBilling/.workflows/.github/workflows/docker-build-push.yml@3e9ace8872ed7d0961a73e7677d19cd9f58846df | |
secrets: | |
dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }} | |
dockerhub-token: ${{ secrets.DOCKERHUB_TOKEN }} | |
with: | |
download-artifact: 'preview-build' | |
platforms: '["linux/amd64", "linux/arm64"]' | |
repository-name: 'fossbilling/fossbilling' | |
tag-latest: 'false' | |
tag-raw: 'preview' |