deps: aws sdk #947
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: Test and Deploy | |
on: | |
push: | |
branches: | |
- "main" | |
- "development" | |
pull_request: | |
jobs: | |
test: | |
name: Tests | |
runs-on: ubuntu-latest | |
concurrency: | |
group: flow-test-${{ github.ref }} | |
cancel-in-progress: true | |
strategy: | |
fail-fast: false | |
matrix: | |
php: ["8.2"] | |
composer: ["v2"] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Checkout Discord Service | |
uses: actions/checkout@v4 | |
with: | |
repository: ecfmp/discord | |
path: ecfmp-discord | |
- name: Move Discord Service | |
run: mv ecfmp-discord ../ecfmp-discord | |
- name: Build Protobuf | |
run: (cd protobuf && make pull_builder && make discord_proto) | |
- name: Configure PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ matrix.php }} | |
coverage: pcov | |
tools: composer:${{ matrix.composer }} | |
extensions: grpc | |
# Setting up composer dependencies | |
- name: Get Composer Cache Directory | |
id: composer-cache | |
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
- name: Restore Composer Cache | |
uses: actions/cache@v1 | |
with: | |
path: ${{ steps.composer-cache.outputs.dir }} | |
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
restore-keys: ${{ runner.os }}-composer- | |
- name: Install Composer Dependencies | |
run: composer install --prefer-dist --no-interaction --optimize-autoloader --no-suggest | |
# Setting up NPM dependencies | |
- name: Get npm cache directory | |
id: npm-cache-dir | |
run: | | |
echo "::set-output name=dir::$(npm config get cache)" | |
- uses: actions/cache@v3 | |
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true' | |
with: | |
path: ${{ steps.npm-cache-dir.outputs.dir }} | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: NPM Build | |
run: | | |
npm ci | |
npm run build | |
cat public/build/manifest.json # See asset versions in log | |
- name: Copy Env | |
run: cp .env.example .env | |
- name: Cache Docker Images | |
uses: ScribeMD/[email protected] | |
with: | |
key: docker-${{ runner.os }}-${{ hashFiles('docker-compose.yml', '.env.example') }} | |
- name: Build and Start Containers | |
run: ./vendor/bin/sail up -d | |
- name: Generate Application Key | |
run: ./vendor/bin/sail artisan key:generate | |
- name: Migrate Database | |
run: ./vendor/bin/sail artisan migrate | |
- name: Run Tests | |
run: ./vendor/bin/sail artisan test | |
release: | |
name: "Release" | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/main') | |
needs: [ test ] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v2 | |
with: | |
persist-credentials: false | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Semantic Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npx semantic-release | |
update-deploy-reference: | |
name: "Trigger Docker Build" | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/development' || github.ref == 'refs/heads/main') | |
needs: [ test ] | |
steps: | |
- name: Dispatch | |
uses: benc-uk/workflow-dispatch@v1 | |
with: | |
workflow: build.yml | |
repo: ECFMP/flow_docker | |
token: ${{ secrets.DOCKER_WORKFLOW_TOKEN }} |