🔖Update version #23
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 multi | |
on: | |
workflow_dispatch: | |
push: | |
branches-ignore: | |
- "coverage" | |
pull_request: | |
jobs: | |
test_and_deploy_ubuntu: | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ["3.11"] | |
runs-on: ${{ matrix.os }} | |
env: | |
TZ: "Asia/Tokyo" | |
permissions: | |
contents: write | |
steps: | |
- name: Check is main | |
id: is_main | |
shell: bash | |
run: | | |
if [ "${{ github.ref }}" = "refs/heads/main" ] && [ "${{ matrix.python-version }}" = "3.11" ];then | |
echo "flag=1" >> $GITHUB_OUTPUT | |
else | |
echo "flag=0" >> $GITHUB_OUTPUT | |
fi | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install FFmpeg | |
run: sudo apt-get update && sudo apt-get install -y ffmpeg | |
- name: Install poetry | |
run: | | |
pip install --upgrade pip | |
pip install poetry | |
- name: Poetry setup | |
run: | | |
poetry --version | |
poetry config --list | |
poetry install -vv | |
- name: Run test with HTML report | |
shell: bash | |
run: | | |
mkdir -p ${{ matrix.os }} | |
poetry run pytest --html=${{ matrix.os }}/report_page.html | |
- name: Commit HTML report to ghpages branch | |
shell: bash | |
run: | | |
git config --local user.email "33836132+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
mkdir -p ${{ matrix.os }}_tmp | |
if [ -f ${{ matrix.os }}/report_page.html ]; then | |
mv ${{ matrix.os }}/report_page.html ${{ matrix.os }}_tmp/report_page.html | |
if [ -d ${{ matrix.os }}/assets ]; then | |
cp -r ${{ matrix.os }}/assets ${{ matrix.os }}_tmp/assets | |
rm -rf ${{ matrix.os }}/assets | |
fi | |
git fetch origin ghpages:ghpages | |
git checkout ghpages | |
mkdir -p ${{ matrix.os }} | |
if [ -d ${{ matrix.os }}_tmp/assets ]; then | |
cp -r ${{ matrix.os }}_tmp/assets ${{ matrix.os }}/ | |
rm -rf ${{ matrix.os }}_tmp/assets | |
fi | |
mv ${{ matrix.os }}_tmp/report_page.html ${{ matrix.os }}/report_page.html | |
git add ${{ matrix.os }}/assets ${{ matrix.os }}/report_page.html | |
git commit -m "Add pytest HTML report to ghpages for ${{ matrix.os }}" || echo "No changes to commit" | |
else | |
echo "No HTML report generated. Skipping commit." | |
fi | |
- name: Push to ghpages branch | |
uses: ad-m/github-push-action@v0.6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ghpages | |
force: true | |
- name: line-notify | |
if: ${{ steps.is_main.outputs.flag == '1' }} | |
uses: snow-actions/line-notify@v1.1.0 | |
with: | |
access_token: ${{ secrets.LINE_ACCESS_TOKEN }} | |
message: | | |
Call "test_githubpages_deploy" from Github Action | |
Env: ${{ matrix.os }} / ${{ matrix.python-version }} | |
Check URL: https://7rikazhexde.github.io/video-grid-merge/${{ matrix.os }}/report_page.html | |
test_and_deploy_macos: | |
strategy: | |
matrix: | |
os: [macos-12] | |
python-version: ['3.11'] | |
runs-on: ${{ matrix.os }} | |
needs: [test_and_deploy_ubuntu] | |
env: | |
TZ: 'Asia/Tokyo' | |
permissions: | |
contents: write | |
steps: | |
- name: Check is main | |
id: is_main | |
shell: bash | |
run: | | |
if [ "${{ github.ref }}" = "refs/heads/main" ] && [ "${{ matrix.python-version }}" = "3.11" ];then | |
echo "flag=1" >> $GITHUB_OUTPUT | |
else | |
echo "flag=0" >> $GITHUB_OUTPUT | |
fi | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install FFmpeg | |
run: brew install ffmpeg | |
- name: Install poetry | |
run: | | |
pip install --upgrade pip | |
pip install poetry | |
- name: Poetry setup | |
run: | | |
poetry --version | |
poetry config --list | |
poetry install -vv | |
- name: Run test with HTML report | |
shell: bash | |
run: | | |
mkdir -p ${{ matrix.os }} | |
poetry run pytest --html=${{ matrix.os }}/report_page.html | |
- name: Commit HTML report to ghpages branch | |
shell: bash | |
run: | | |
git config --local user.email "33836132+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
mkdir -p ${{ matrix.os }}_tmp | |
if [ -f ${{ matrix.os }}/report_page.html ]; then | |
mv ${{ matrix.os }}/report_page.html ${{ matrix.os }}_tmp/report_page.html | |
if [ -d ${{ matrix.os }}/assets ]; then | |
cp -r ${{ matrix.os }}/assets ${{ matrix.os }}_tmp/assets | |
rm -rf ${{ matrix.os }}/assets | |
fi | |
git fetch origin ghpages:ghpages | |
git checkout ghpages | |
mkdir -p ${{ matrix.os }} | |
if [ -d ${{ matrix.os }}_tmp/assets ]; then | |
cp -r ${{ matrix.os }}_tmp/assets ${{ matrix.os }}/ | |
rm -rf ${{ matrix.os }}_tmp/assets | |
fi | |
mv ${{ matrix.os }}_tmp/report_page.html ${{ matrix.os }}/report_page.html | |
git add ${{ matrix.os }}/assets ${{ matrix.os }}/report_page.html | |
git commit -m "Add pytest HTML report to ghpages for ${{ matrix.os }}" || echo "No changes to commit" | |
else | |
echo "No HTML report generated. Skipping commit." | |
fi | |
- name: Push to ghpages branch | |
uses: ad-m/github-push-action@v0.6.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ghpages | |
force: true | |
- name: line-notify | |
if: ${{ steps.is_main.outputs.flag == '1' }} | |
uses: snow-actions/line-notify@v1.1.0 | |
with: | |
access_token: ${{ secrets.LINE_ACCESS_TOKEN }} | |
message: | | |
Call "test_githubpages_deploy" from Github Action | |
Env: ${{ matrix.os }} / ${{ matrix.python-version }} | |
Check URL: https://7rikazhexde.github.io/video-grid-merge/${{ matrix.os }}/report_page.html |