Update CI
* add `workflow_dispatch` for manual running * add `fail-fast` false in matrix * specify `persist-credentials: false` for actions/checkout * update actions to the latest versions * move cache before installing the toolchain * cache more stuff * limit deploy to shssoichiro/oxipng repository * reindent
This commit is contained in:
parent
be19ed592d
commit
e88b9be12b
2 changed files with 108 additions and 95 deletions
176
.github/workflows/deploy.yml
vendored
176
.github/workflows/deploy.yml
vendored
|
|
@ -6,8 +6,9 @@ on:
|
||||||
- 'v*.*.*'
|
- 'v*.*.*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
create-windows-binaries:
|
create-windows-binaries:
|
||||||
|
runs-on: windows-latest
|
||||||
|
if: github.repository == 'shssoichiro/oxipng'
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
|
@ -16,51 +17,53 @@ jobs:
|
||||||
# and I don't have a Windows machine set up to experiment with fixing it.
|
# and I don't have a Windows machine set up to experiment with fixing it.
|
||||||
# conf: [x86_64, i686]
|
# conf: [x86_64, i686]
|
||||||
|
|
||||||
runs-on: windows-latest
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Install stable
|
- name: Install stable
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
profile: minimal
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
target: ${{ matrix.conf }}-pc-windows-msvc
|
target: ${{ matrix.conf }}-pc-windows-msvc
|
||||||
override: true
|
override: true
|
||||||
|
|
||||||
- name: Build oxipng
|
- name: Build oxipng
|
||||||
run: |
|
run: |
|
||||||
cargo build --release --target ${{ matrix.conf }}-pc-windows-msvc
|
cargo build --release --target ${{ matrix.conf }}-pc-windows-msvc
|
||||||
|
|
||||||
- name: Get the version
|
- name: Get the version
|
||||||
shell: bash
|
shell: bash
|
||||||
id: tagName
|
id: tagName
|
||||||
run: |
|
run: |
|
||||||
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
|
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
|
||||||
echo "::set-output name=tag::$VERSION"
|
echo "::set-output name=tag::$VERSION"
|
||||||
|
|
||||||
- name: Build package
|
- name: Build package
|
||||||
id: package
|
id: package
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
ARCHIVE_TARGET="${{ matrix.conf }}-pc-windows-msvc"
|
ARCHIVE_TARGET="${{ matrix.conf }}-pc-windows-msvc"
|
||||||
ARCHIVE_NAME="oxipng-${{ steps.tagName.outputs.tag }}-$ARCHIVE_TARGET"
|
ARCHIVE_NAME="oxipng-${{ steps.tagName.outputs.tag }}-$ARCHIVE_TARGET"
|
||||||
ARCHIVE_FILE="${ARCHIVE_NAME}.zip"
|
ARCHIVE_FILE="${ARCHIVE_NAME}.zip"
|
||||||
mv LICENSE LICENSE.txt
|
mv LICENSE LICENSE.txt
|
||||||
7z a ${ARCHIVE_FILE} \
|
7z a ${ARCHIVE_FILE} \
|
||||||
./target/${{ matrix.conf }}-pc-windows-msvc/release/oxipng.exe \
|
./target/${{ matrix.conf }}-pc-windows-msvc/release/oxipng.exe \
|
||||||
./CHANGELOG.md ./LICENSE.txt ./README.md
|
./CHANGELOG.md ./LICENSE.txt ./README.md
|
||||||
echo "::set-output name=file::${ARCHIVE_FILE}"
|
echo "::set-output name=file::${ARCHIVE_FILE}"
|
||||||
echo "::set-output name=name::${ARCHIVE_NAME}.zip"
|
echo "::set-output name=name::${ARCHIVE_NAME}.zip"
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ steps.package.outputs.name }}
|
name: ${{ steps.package.outputs.name }}
|
||||||
path: ${{ steps.package.outputs.file }}
|
path: ${{ steps.package.outputs.file }}
|
||||||
|
|
||||||
create-unix-binaries:
|
create-unix-binaries:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
if: github.repository == 'shssoichiro/oxipng'
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
|
@ -71,67 +74,68 @@ jobs:
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
target: x86_64-apple-darwin
|
target: x86_64-apple-darwin
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
profile: minimal
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
target: ${{ matrix.target }}
|
target: ${{ matrix.target }}
|
||||||
override: true
|
override: true
|
||||||
|
|
||||||
- name: Install musl
|
- name: Install musl
|
||||||
if: contains(matrix.target, 'linux-musl')
|
if: contains(matrix.target, 'linux-musl')
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get install musl-tools
|
sudo apt-get install musl-tools
|
||||||
|
|
||||||
- name: Build oxipng
|
- name: Build oxipng
|
||||||
run: |
|
run: |
|
||||||
cargo build --release --target ${{ matrix.target }}
|
cargo build --release --target ${{ matrix.target }}
|
||||||
|
|
||||||
- name: Strip binary
|
- name: Strip binary
|
||||||
run: |
|
run: |
|
||||||
strip target/${{ matrix.target }}/release/oxipng
|
strip target/${{ matrix.target }}/release/oxipng
|
||||||
|
|
||||||
- name: Get the version
|
- name: Get the version
|
||||||
id: tagName
|
id: tagName
|
||||||
run: |
|
run: |
|
||||||
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
|
VERSION=$(cargo pkgid | cut -d# -f2 | cut -d: -f2)
|
||||||
echo "::set-output name=tag::$VERSION"
|
echo "::set-output name=tag::$VERSION"
|
||||||
|
|
||||||
- name: Build package
|
- name: Build package
|
||||||
id: package
|
id: package
|
||||||
run: |
|
run: |
|
||||||
ARCHIVE_TARGET=${{ matrix.target }}
|
ARCHIVE_TARGET=${{ matrix.target }}
|
||||||
ARCHIVE_NAME="oxipng-${{ steps.tagName.outputs.tag }}-$ARCHIVE_TARGET"
|
ARCHIVE_NAME="oxipng-${{ steps.tagName.outputs.tag }}-$ARCHIVE_TARGET"
|
||||||
ARCHIVE_FILE="${ARCHIVE_NAME}.tar.gz"
|
ARCHIVE_FILE="${ARCHIVE_NAME}.tar.gz"
|
||||||
mkdir "/tmp/${ARCHIVE_NAME}"
|
mkdir "/tmp/${ARCHIVE_NAME}"
|
||||||
cp README.md CHANGELOG.md LICENSE \
|
cp README.md CHANGELOG.md LICENSE \
|
||||||
target/${{ matrix.target }}/release/oxipng \
|
target/${{ matrix.target }}/release/oxipng \
|
||||||
/tmp/${ARCHIVE_NAME}
|
/tmp/${ARCHIVE_NAME}
|
||||||
tar -czf ${PWD}/${ARCHIVE_FILE} -C /tmp/ ${ARCHIVE_NAME}
|
tar -czf ${PWD}/${ARCHIVE_FILE} -C /tmp/ ${ARCHIVE_NAME}
|
||||||
echo ::set-output "name=file::${ARCHIVE_FILE}"
|
echo ::set-output "name=file::${ARCHIVE_FILE}"
|
||||||
echo ::set-output "name=name::${ARCHIVE_NAME}.tar.gz"
|
echo ::set-output "name=name::${ARCHIVE_NAME}.tar.gz"
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ steps.package.outputs.name }}
|
name: ${{ steps.package.outputs.name }}
|
||||||
path: ${{ steps.package.outputs.file }}
|
path: ${{ steps.package.outputs.file }}
|
||||||
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: github.repository == 'shssoichiro/oxipng'
|
||||||
needs: [create-windows-binaries, create-unix-binaries]
|
needs: [create-windows-binaries, create-unix-binaries]
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
|
|
||||||
- name: Get version and release description
|
- name: Get version and release description
|
||||||
id: tagName
|
id: tagName
|
||||||
|
|
@ -141,7 +145,7 @@ jobs:
|
||||||
echo "::set-output name=tag::$VERSION"
|
echo "::set-output name=tag::$VERSION"
|
||||||
|
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: ./binaries
|
path: ./binaries
|
||||||
|
|
||||||
|
|
|
||||||
27
.github/workflows/oxipng.yml
vendored
27
.github/workflows/oxipng.yml
vendored
|
|
@ -7,10 +7,13 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
target:
|
target:
|
||||||
- x86_64-unknown-linux-gnu
|
- x86_64-unknown-linux-gnu
|
||||||
|
|
@ -45,12 +48,25 @@ jobs:
|
||||||
toolchain: beta
|
toolchain: beta
|
||||||
- target: x86_64-unknown-linux-musl
|
- target: x86_64-unknown-linux-musl
|
||||||
toolchain: nightly
|
toolchain: nightly
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
with:
|
||||||
|
persist-credentials: false
|
||||||
- name: Install musl tools
|
- name: Install musl tools
|
||||||
run: sudo apt-get install musl-tools
|
run: sudo apt-get install musl-tools
|
||||||
if: "contains(matrix.target, 'musl')"
|
if: "contains(matrix.target, 'musl')"
|
||||||
|
- name: Cache cargo registry
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/bin/
|
||||||
|
~/.cargo/registry/index/
|
||||||
|
~/.cargo/registry/cache/
|
||||||
|
~/.cargo/git/db/
|
||||||
|
key: ${{ runner.os }}-${{ matrix.toolchain }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-${{ matrix.toolchain }}-cargo-registry-
|
||||||
- name: Install ${{ matrix.toolchain }}
|
- name: Install ${{ matrix.toolchain }}
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
|
|
@ -58,13 +74,6 @@ jobs:
|
||||||
toolchain: ${{ matrix.toolchain }}
|
toolchain: ${{ matrix.toolchain }}
|
||||||
override: true
|
override: true
|
||||||
components: clippy, rustfmt
|
components: clippy, rustfmt
|
||||||
- name: Cache cargo registry
|
|
||||||
uses: actions/cache@v1
|
|
||||||
with:
|
|
||||||
path: ~/.cargo/registry/cache
|
|
||||||
key: ${{ matrix.target }}-${{ matrix.toolchain }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
restore-keys: |
|
|
||||||
${{ matrix.target }}-${{ matrix.toolchain }}-cargo-registry-
|
|
||||||
- name: Run rustfmt
|
- name: Run rustfmt
|
||||||
if: matrix.toolchain == 'stable'
|
if: matrix.toolchain == 'stable'
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue