-
Notifications
You must be signed in to change notification settings - Fork 3
94 lines (83 loc) · 2.88 KB
/
latest.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: 'latest'
on:
push:
branches: [ 'main' ]
jobs:
tests:
runs-on: ubuntu-latest
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
steps:
- uses: actions/checkout@v2
id: code-checkout
- name: Validate composer.json and composer.lock
id: composer-validate
run: composer validate
- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
id: install-dependencies
uses: php-actions/composer@v5
with:
php_version: 8.0
args: --prefer-dist --no-progress --no-suggest
- name: PHP Unit Test
id: php-unit-test
uses: php-actions/phpunit@v3
with:
php_version: 8.0.27
version: 9.5.21
- uses: act10ns/slack@v1
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#wordpress-bmlt-workflow'
if: failure()
package:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
# needs: [ tests ] # tmp let job run if tests fail
steps:
- uses: actions/checkout@v2
id: code-checkout
- name: Build package
id: build-package
run: |
export ARTIFACT_FILE=bmlt-workflow-${GITHUB_RUN_NUMBER}-${GITHUB_SHA}
export ARTIFACT_FILENAME=${ARTIFACT_FILE}.zip
echo "ARTIFACT_FILENAME=${ARTIFACT_FILENAME}" >> $GITHUB_ENV
git archive --format=zip --output=${ARTIFACT_FILENAME} --prefix=${ARTIFACT_FILE}/ HEAD
unzip ${ARTIFACT_FILENAME}
rm ${ARTIFACT_FILENAME}
echo ${GITHUB_SHA} > ${ARTIFACT_FILE}/build.txt
find ./${ARTIFACT_FILE} -type d | xargs chmod 755
find ./${ARTIFACT_FILE} -name '*.php' | xargs chmod 644
zip -r -9 ${ARTIFACT_FILENAME} ${ARTIFACT_FILE}
mkdir artifacts/
mv ${ARTIFACT_FILENAME} artifacts/
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/github-actions/gh-ci-s3-artifact
role-session-name: gh-actions-bmlt-workflow
aws-region: us-east-1
- name: copy artifact to s3
run: |
aws s3 cp artifacts/${ARTIFACT_FILENAME} s3://${{ secrets.S3_BUCKET }}/bmlt-workflow/${ARTIFACT_FILENAME}
- uses: act10ns/slack@v1
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
channel: '#wordpress-bmlt-workflow'
if: failure()