|
| 1 | +name: movabletype/mt-plugin-shared-preview |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - "**/*" |
| 6 | + pull_request: |
| 7 | + schedule: |
| 8 | + - cron: '30 0 * * 0' # Sunday Only |
| 9 | +concurrency: |
| 10 | +# # This item has no matching transformer |
| 11 | +# maximum_number_of_builds: 0 |
| 12 | + group: "${{ github.ref }}" |
| 13 | + cancel-in-progress: true |
| 14 | +env: |
| 15 | + MT_TEST_IGNORE_FIXTURE: '0' |
| 16 | +jobs: |
| 17 | + shared-preview: |
| 18 | + env: |
| 19 | + TEST_IMAGE_NAME: fedora39 # Perl 5.38 / PHP 8.2 / MySQL 8.0 |
| 20 | + if: ${{ always() }} |
| 21 | + runs-on: ubuntu-latest |
| 22 | + strategy: |
| 23 | + matrix: |
| 24 | + test: |
| 25 | + - "plugins/SharedPreview/t" |
| 26 | + steps: |
| 27 | + - name: checkout |
| 28 | + uses: actions/checkout@v4.1.0 |
| 29 | + - name: docker login |
| 30 | + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 |
| 31 | + with: |
| 32 | + registry: ghcr.io |
| 33 | + username: ${{ github.actor }} |
| 34 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 35 | + - name: core checkout |
| 36 | + run: | |
| 37 | + git clone -b develop --depth 1 https://github.com/movabletype/movabletype.git movabletype |
| 38 | + cp -r movabletype/* . |
| 39 | + cp movabletype/.perlcriticrc . |
| 40 | + - name: test |
| 41 | + run: docker run -t -v $PWD:/mt -w /mt ghcr.io/movabletype/movabletype/test:$TEST_IMAGE_NAME bash -c "prove -lr -j4 -PMySQLPool=MT::Test::Env -It/lib ${{ matrix.test }}" |
| 42 | + |
| 43 | + core: |
| 44 | + needs: [shared-preview] |
| 45 | + if: >- |
| 46 | + ${{ |
| 47 | + github.event_name == 'schedule' |
| 48 | + || (github.ref_name == 'master') |
| 49 | + }} |
| 50 | + runs-on: ubuntu-latest |
| 51 | + env: |
| 52 | + TEST_IMAGE_NAME: cloud7 |
| 53 | + strategy: |
| 54 | + matrix: |
| 55 | + test: |
| 56 | + - "t/*.t" |
| 57 | + - "t/mt7/[^td]*" |
| 58 | + - "t/mt7/d*" |
| 59 | + - "t/mt7/t*" |
| 60 | + - "t/admin_theme_id/ t/app/ t/class/ t/cms/ t/model/ t/mt_object/ t/object_driver/ t/task/ t/template/ t/tools t/util t/upgrade" |
| 61 | + - "t/cms_permission/" |
| 62 | + - "t/data_api/" |
| 63 | + - "t/tag/" |
| 64 | + - "plugins/*/t" |
| 65 | + - php |
| 66 | + steps: |
| 67 | + - name: checkout |
| 68 | + uses: actions/checkout@v4.1.0 |
| 69 | + - name: docker login |
| 70 | + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 |
| 71 | + with: |
| 72 | + registry: ghcr.io |
| 73 | + username: ${{ github.actor }} |
| 74 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 75 | + - name: core checkout |
| 76 | + run: | |
| 77 | + git clone -b develop --depth 1 https://github.com/movabletype/movabletype.git movabletype |
| 78 | + cp -r movabletype/* . |
| 79 | + cp movabletype/.perlcriticrc . |
| 80 | + - name: test |
| 81 | + if: ${{ matrix.test != 'php' }} |
| 82 | + run: docker run -t -v $PWD:/mt -w /mt ghcr.io/movabletype/movabletype/test:$TEST_IMAGE_NAME bash -c "prove -lr -j4 -PMySQLPool=MT::Test::Env -It/lib ${{ matrix.test }}" |
| 83 | + - name: test php |
| 84 | + if: ${{ matrix.test == 'php' }} |
| 85 | + run: docker run -t -v $PWD:/mt -w /mt ghcr.io/movabletype/movabletype/test:$TEST_IMAGE_NAME bash -c "phpunit && make test-php-lint" |
| 86 | + |
| 87 | + notify_slack: |
| 88 | + runs-on: ubuntu-latest |
| 89 | + needs: |
| 90 | + - shared-preview |
| 91 | + - core |
| 92 | + if: ${{ always() }} |
| 93 | + steps: |
| 94 | + - name: Install jq |
| 95 | + run: | |
| 96 | + sudo apt-get update |
| 97 | + sudo apt-get install -y jq |
| 98 | + - name: Filters if the "needs" context has "failure" |
| 99 | + run: | |
| 100 | + HAS_FAILURE=$(echo '${{ toJSON(needs) }}' | jq '[.[] | select(.result == "failure") | .result] | join(",")' | sed -e 's/"//g') |
| 101 | + echo "HAS_FAILURE=${HAS_FAILURE}" >> "$GITHUB_ENV" |
| 102 | + - name: SLACK_COLOR is danger |
| 103 | + if: ${{ env.HAS_FAILURE }} |
| 104 | + run: | |
| 105 | + echo "SLACK_COLOR=danger" >> "$GITHUB_ENV" |
| 106 | + - name: SLACK_COLOR is good |
| 107 | + if: ${{ ! env.HAS_FAILURE }} |
| 108 | + run: | |
| 109 | + echo "SLACK_COLOR=good" >> "$GITHUB_ENV" |
| 110 | + - uses: rtCamp/action-slack-notify@v2.2.1 |
| 111 | + env: |
| 112 | + SLACK_WEBHOOK: "${{ secrets.SLACK_WEBHOOK }}" |
| 113 | + SLACK_USERNAME: "GitHub Actions ${{ github.repository }}" |
| 114 | + SLACK_TITLE: 'Workflow #${{ github.run_number }}' |
| 115 | + SLACK_ICON: https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png |
| 116 | + SLACK_COLOR: "${{ env.SLACK_COLOR }}" |
0 commit comments