thorvg/.github/workflows/build_windows.yml
Josh Soref effb58fc63 infra/workflow: Reduce workflow permissions
By explicitly listing the permissions required in general, repositories
without restrictive permissions will only allocate the specified
permissions which is much safer than the default, fairly wide,
permissions grant.

Most workflows don't appear to need any permissions beyond
`contents: read` which is required for checkout (when a repository is
private). By specifying this permission, it tells GitHub not to include
any of its additional default permissions (when a repository is
configured permissively).

The .github/workflows/memcheck_*.sh scripts called by build_ubuntu.yml
require write permissions in order to post their output to a pull
request (as a comment).

In locked down GitHub repositories, unless a workflow/job asks for
write permissions, it will not have them and such API calls will result
in:

{
  "message": "Resource not accessible by integration",
  "documentation_url": "https://docs.github.com/rest/issues/comments#create-an-issue-comment",
  "status": "403"
}

By specifically requesting the permissions, the workflow will continue
to work as expected.
2024-07-03 13:17:10 +09:00

77 lines
1.6 KiB
YAML

name: Windows
on:
pull_request:
branches:
- main
push:
branches:
- main
permissions:
contents: read
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- name: Install Packages
run: |
pip install meson ninja
- name: Build
run: |
meson setup build -Dlog=true -Dloaders=all -Dsavers=all -Dbindings=capi -Dtools=all
where link
ninja -C build install
- uses: actions/upload-artifact@v4
with:
name: result_windows
path: build/src/thorvg*
compact_test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- name: Install Packages
run: |
pip install meson ninja
- name: Build
run: |
meson setup build -Dlog=true -Dloaders=all -Dsavers=all -Dstatic=true -Dthreads=false
where link
ninja -C build install
- uses: actions/upload-artifact@v4
with:
name: result_windows_static
path: build/src/thorvg*
unit_test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1
- name: Install Packages
run: |
pip install meson ninja
- name: Build
run: |
meson setup build -Dloaders=all -Dsavers=all -Dbindings=capi -Dtests=true --errorlogs
where link
ninja -C build install test
- uses: actions/upload-artifact@v4
with:
name: UnitTestReport
path: build/meson-logs/testlog.txt