Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 62 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Rust Setup
id: setup
Expand All @@ -43,9 +43,27 @@
sudo apt-get install -qq -y gcc-aarch64-linux-gnu
fi

- name: Set up Python for PR validation
if: github.event_name == 'pull_request' && matrix.target == 'x86_64-unknown-linux-gnu'
uses: actions/setup-python@v6
with:
python-version: '3.11'
cache: 'pip'
cache-dependency-path: 'scripts/requirements.txt'

- name: Validate release script syntax without running scripts
if: github.event_name == 'pull_request' && matrix.target == 'x86_64-unknown-linux-gnu'
env:
PYTHONPYCACHEPREFIX: ${{ runner.temp }}/znotify-python-cache
run: python -m py_compile scripts/version.py scripts/winget.py

- name: Test CLI on native host
if: startsWith(matrix.target, 'x86_64-')
run: cargo test --locked --bins

- name: Build binary
run: |
cargo build --release --bins --target ${{ matrix.target }}
cargo build --locked --release --bins --target ${{ matrix.target }}
cargo deb --target ${{ matrix.target }}


Expand All @@ -55,7 +73,7 @@
mv -f target/${{ matrix.target }}/release/znotify target/${{ matrix.target }}/release/znotify-${{ matrix.target }}

- name: Upload artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.target }}
path: |
Expand All @@ -71,7 +89,7 @@
- aarch64-apple-darwin

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Rust Setup
id: setup
Expand All @@ -86,31 +104,36 @@
run: |
rustup target add ${{ matrix.target }}

- name: Test CLI on native host
if: startsWith(matrix.target, 'x86_64-')
run: cargo test --locked --bins

- name: Build binary
run: |
cargo build --release --bins --target ${{ matrix.target }}
cargo build --locked --release --bins --target ${{ matrix.target }}

- name: Rename binary
shell: bash
run: |
mv -f target/${{ matrix.target }}/release/znotify target/${{ matrix.target }}/release/znotify-${{ matrix.target }}

- name: Upload artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release/znotify-${{ matrix.target }}

build_binary_windows:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
target:
- x86_64-pc-windows-msvc
- aarch64-pc-windows-msvc

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6

- name: Rust Setup
id: setup
Expand All @@ -125,28 +148,54 @@
run: |
rustup target add ${{ matrix.target }}

- name: Test CLI on native host
if: startsWith(matrix.target, 'x86_64-')
run: cargo test --locked --bins

- name: Build binary
run: |
cargo build --release --bins --target ${{ matrix.target }}
cargo build --locked --release --bins --target ${{ matrix.target }}

- name: Rename binary
shell: bash
run: |
mv -f target/${{ matrix.target }}/release/znotify.exe target/${{ matrix.target }}/release/znotify-${{ matrix.target }}.exe

- name: Upload artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release/znotify-${{ matrix.target }}.exe

verify_artifacts:
if: github.event_name == 'pull_request'
needs: [ build_binary_linux, build_binary_macos, build_binary_windows ]
runs-on: ubuntu-latest
steps:
- name: Download PR artifacts
uses: actions/download-artifact@v7.0.0
with:
path: binary
- name: Verify platform binaries
shell: bash
run: |
for target in x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu; do
test -s "binary/$target/release/znotify-$target"
done
for target in x86_64-apple-darwin aarch64-apple-darwin; do
test -s "binary/$target/znotify-$target"
done
for target in x86_64-pc-windows-msvc aarch64-pc-windows-msvc; do
test -s "binary/$target/znotify-$target.exe"
done

release_nightly:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
if: github.event_name == 'push'
needs: [ build_binary_linux, build_binary_macos, build_binary_windows ]
runs-on: ubuntu-latest
steps:
- name: Get all artifacts
uses: actions/download-artifact@v4.3.0
uses: actions/download-artifact@v7.0.0
with:
path: binary

Expand All @@ -165,11 +214,11 @@
needs: [ build_binary_linux, build_binary_macos, build_binary_windows ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
with:
ref: 'master'

- uses: actions/setup-python@v5
- uses: actions/setup-python@v6
with:
python-version: '3.11'
cache: 'pip'
Expand All @@ -181,7 +230,7 @@
pip install -r scripts/requirements.txt

- name: Get all artifacts
uses: actions/download-artifact@v4.3.0
uses: actions/download-artifact@v7.0.0
with:
path: binary

Expand Down
Loading
Loading