Bump version: 2024.18.0 → 2024.19.0 #46
Workflow file for this run
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: Release | |
on: | |
push: | |
tags: | |
- "*.*.*" | |
jobs: | |
build-python-wheels: | |
env: | |
# Note that we want to build only for a single python version | |
# since we're targeting abi3. Sync changes with setup.cfg and | |
# the "abi3-pyXX" PyO3 feature in Cargo.toml | |
CIBW_SKIP: "cp36-* cp37-* cp38-* cp310-* cp311-* pp* *i686 *win32" | |
CIBW_ARCHS_LINUX: ${{matrix.arch}} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
arch: [x86_64, aarch64] | |
exclude: | |
- os: ubuntu-latest | |
arch: aarch64 | |
- os: macos-latest | |
arch: aarch64 | |
- os: windows-latest | |
arch: aarch64 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/setup-python@v5 | |
name: Setup python | |
with: | |
python-version: '3.x' | |
- uses: docker/setup-qemu-action@v3 | |
if: ${{ matrix.arch == 'aarch64' }} | |
name: Set up QEMU | |
- name: Install cibuildwheel | |
run: python -m pip install cibuildwheel setuptools_rust | |
- name: Build wheels on Linux and macOS | |
if: runner.os != 'Windows' | |
run: | | |
export CIBW_BEFORE_BUILD='pip install setuptools-rust && curl -o /tmp/rustup.sh https://sh.rustup.rs && sh /tmp/rustup.sh -y' | |
# shellcheck disable=SC2016 | |
export CIBW_ENVIRONMENT='PATH="$HOME"/.cargo/bin:"$PATH"' | |
if [ "$(uname)" = Darwin ]; then | |
export MACOSX_DEPLOYMENT_TARGET=10.12 | |
export CIBW_BEFORE_BUILD="$CIBW_BEFORE_BUILD && rustup target add aarch64-apple-darwin x86_64-apple-darwin" | |
export CIBW_ARCHS_MACOS="universal2" | |
fi | |
python -m cibuildwheel --output-dir wheelhouse crates/python | |
- name: Build wheels on Windows | |
if: runner.os == 'Windows' | |
env: | |
CIBW_BEFORE_BUILD: "python3 -m pip install setuptools_rust" | |
run: | | |
python3 -m cibuildwheel --output-dir wheelhouse crates/python | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: wheels-${{ matrix.arch }}-${{ matrix.os }} | |
path: ./wheelhouse/*.whl | |
release-core-docker-image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: cargo install cross | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to docker hub | |
run: docker login -u fredrikfornwall -p "$DOCKER_ACCESS_TOKEN" | |
env: | |
DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
- name: Install aarch64 strip | |
run: sudo apt-get update && sudo apt-get -y install binutils-aarch64-linux-gnu | |
- name: Build and push docker image | |
working-directory: crates/core | |
env: | |
DOCKER_IMAGE_NAME: fredrikfornwall/advent-of-code | |
run: | | |
NEW_VERSION=$(cargo metadata --format-version 1 | jq --raw-output '.packages[0].version') | |
cross build --release --target aarch64-unknown-linux-musl | |
cross build --release --target x86_64-unknown-linux-musl | |
strip -s ../../target/x86_64-unknown-linux-musl/release/advent-of-code | |
aarch64-linux-gnu-strip -s ../../target/aarch64-unknown-linux-musl/release/advent-of-code | |
IMAGE_WITH_VERSION=${DOCKER_IMAGE_NAME}:${NEW_VERSION} | |
IMAGE_WITH_LATEST=${DOCKER_IMAGE_NAME}:latest | |
mkdir -p target/linux/{arm64,amd64} | |
cp ../../target/x86_64-unknown-linux-musl/release/advent-of-code target/linux/amd64/ | |
cp ../../target/aarch64-unknown-linux-musl/release/advent-of-code target/linux/arm64/ | |
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag "${IMAGE_WITH_VERSION}" --tag "${IMAGE_WITH_LATEST}" . | |
release-npm-packages: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/*' | |
registry-url: 'https://registry.npmjs.org' | |
- uses: Homebrew/actions/setup-homebrew@master | |
- name: Install wasm-opt | |
run: brew update && brew install binaryen | |
- name: Publish npm packages | |
run: | | |
make install-wasm-bindgen | |
. "${HOME}"/.cargo/env | |
make npm-publish | |
env: | |
# It needs to be named 'NODE_AUTH_TOKEN' as it's referenced | |
# by the .npmrc created by setup-node: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
release-rust-crate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- name: Login to cargo | |
run: cargo login "${CRATES_API_TOKEN}" | |
env: | |
CRATES_API_TOKEN: ${{secrets.CRATES_API_TOKEN}} | |
- name: Publish svgplot crate | |
run: cd crates/svgplot && cargo publish | |
- name: Publish core crate | |
run: cd crates/core && cargo publish | |
release-pypi-package: | |
needs: [build-python-wheels] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download built wheels | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: wheels-* | |
merge-multiple: true | |
path: dist | |
- name: List files | |
run: ls -lha dist | |
- name: Publish package to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
build-jni-libraries: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
if: runner.os == 'macOS' | |
- name: List sdks | |
run: xcodebuild -showsdks | |
if: runner.os == 'macOS' | |
- run: cargo install cross | |
if: runner.os == 'Linux' | |
- name: Install aarch64-apple-darwin rust target | |
run: rustup target add aarch64-apple-darwin | |
if: runner.os == 'macOS' | |
- name: Install aarch64 strip | |
run: sudo apt-get update && sudo apt-get -y install binutils-aarch64-linux-gnu | |
if: runner.os == 'Linux' | |
- name: Build JNI libraries | |
working-directory: crates/java | |
run: ./build-jni-libs.sh | |
shell: bash | |
- name: Test java | |
working-directory: crates/java/java-src | |
run: gradle test | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: jnilibs-${{ matrix.os }} | |
path: ./crates/java/java-src/src/main/resources/* | |
build-and-upload-man-page: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: Homebrew/actions/setup-homebrew@master | |
- run: brew install pandoc | |
- run: make man-page | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: man-page | |
path: target/man/advent-of-code.1 | |
build-and-upload-linux-brew-binaries: | |
runs-on: ubuntu-latest | |
needs: [build-and-upload-man-page] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: cargo install cross | |
- name: Install aarch64 strip | |
run: sudo apt-get update && sudo apt-get -y install binutils-aarch64-linux-gnu | |
- uses: actions/download-artifact@v4 | |
with: | |
name: man-page | |
path: crates/core | |
- run: | | |
cross build --release --target aarch64-unknown-linux-musl | |
cross build --release --target x86_64-unknown-linux-musl | |
strip -s ../../target/x86_64-unknown-linux-musl/release/advent-of-code | |
aarch64-linux-gnu-strip -s ../../target/aarch64-unknown-linux-musl/release/advent-of-code | |
cp advent-of-code.1 ../../target/x86_64-unknown-linux-musl/release | |
cp advent-of-code.1 ../../target/aarch64-unknown-linux-musl/release | |
cd ../../target/x86_64-unknown-linux-musl/release && tar cfJ advent-of-code-linux-x86_64.tar.xz advent-of-code advent-of-code.1 && mv ./*.tar.xz ../../../ | |
cd ../../aarch64-unknown-linux-musl/release && tar cfJ advent-of-code-linux-aarch64.tar.xz advent-of-code advent-of-code.1 && mv ./*.tar.xz ../../../ | |
working-directory: crates/core | |
- name: Upload Linux x86_64 binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-x86_64-binary | |
path: advent-of-code-linux-x86_64.tar.xz | |
- name: Upload Linux aarch64 binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-aarch64-binary | |
path: advent-of-code-linux-aarch64.tar.xz | |
build-and-upload-mac-brew-binaries: | |
runs-on: macos-latest | |
needs: [build-and-upload-man-page] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- uses: actions/download-artifact@v4 | |
with: | |
name: man-page | |
path: crates/core | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: latest-stable | |
- run: rustup target add aarch64-apple-darwin | |
- run: | | |
cargo build --release | |
SDKROOT=$(xcrun -sdk "$MACOS_SDK" --show-sdk-path) MACOSX_DEPLOYMENT_TARGET=10.12 cargo build --release --target=aarch64-apple-darwin | |
strip ../../target/release/advent-of-code | |
strip ../../target/aarch64-apple-darwin/release/advent-of-code | |
cp advent-of-code.1 ../../target/release | |
cp advent-of-code.1 ../../target/aarch64-apple-darwin/release | |
cd ../../target/release && tar cfJ advent-of-code-mac-x86_64.tar.xz advent-of-code advent-of-code.1 && mv advent-of-code-mac-x86_64.tar.xz ../../ | |
cd ../aarch64-apple-darwin/release && tar cfJ advent-of-code-mac-aarch64.tar.xz advent-of-code advent-of-code.1 && mv advent-of-code-mac-aarch64.tar.xz ../../../ | |
working-directory: crates/core | |
- name: Upload mac x86_64 binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mac-x86_64-binary | |
path: advent-of-code-mac-x86_64.tar.xz | |
- name: Upload mac aarch64 binary | |
uses: actions/upload-artifact@v4 | |
with: | |
name: mac-aarch64-binary | |
path: advent-of-code-mac-aarch64.tar.xz | |
publish-to-maven-central: | |
needs: [build-jni-libraries] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Download JNI libraries | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: jnilibs-* | |
merge-multiple: true | |
path: crates/java/java-src/src/main/resources/ | |
- name: Publish to Maven Central | |
working-directory: crates/java/java-src | |
run: | | |
echo "${{ secrets.OSSRH_GPG_SECRING_BASE64 }}" | base64 -d > secring.gpg | |
gradle --info \ | |
-PsonatypeUsername=${{ secrets.SONATYPE_USERNAME }} \ | |
-PsonatypePassword=${{ secrets.SONATYPE_PASSWORD }} \ | |
-Psigning.keyId=6D8D0AE7 \ | |
-Psigning.password=${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} \ | |
-Psigning.secretKeyRingFile=secring.gpg \ | |
publishToSonatype \ | |
closeAndReleaseSonatypeStagingRepository | |
github-release: | |
needs: [build-and-upload-linux-brew-binaries, build-and-upload-mac-brew-binaries] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: mac-x86_64-binary | |
- uses: actions/download-artifact@v4 | |
with: | |
name: mac-aarch64-binary | |
- uses: actions/download-artifact@v4 | |
with: | |
name: linux-x86_64-binary | |
- uses: actions/download-artifact@v4 | |
with: | |
name: linux-aarch64-binary | |
- uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
advent-of-code-linux-aarch64.tar.xz | |
advent-of-code-linux-x86_64.tar.xz | |
advent-of-code-mac-aarch64.tar.xz | |
advent-of-code-mac-x86_64.tar.xz | |
publish-homebrew: | |
runs-on: ubuntu-latest | |
needs: [github-release] | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- run: | | |
NEW_VERSION=$(./.github/workflows/current-version) | |
curl -X POST -H "Authorization: Bearer ${{ secrets.HOMEBREW_TAP_GITHUB_ACCESS_TOKEN }} " -H "Accept:application/vnd.github" "https://api.github.com/repos/fornwall/homebrew-tap/actions/workflows/publish.yml/dispatches" -d "{\"ref\":\"main\", \"inputs\":{\"formula\":\"advent-of-code\",\"version\":\"$NEW_VERSION\"}}" | |
publish-grpc-server: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: cargo install cross | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to docker hub | |
run: docker login -u fredrikfornwall -p "$DOCKER_ACCESS_TOKEN" | |
env: | |
DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
- name: Install aarch64 strip | |
run: sudo apt-get update && sudo apt-get -y install binutils-aarch64-linux-gnu | |
- name: Build and push docker image | |
working-directory: crates/grpc-server | |
env: | |
DOCKER_IMAGE_NAME: fredrikfornwall/advent-of-code-grpc-server | |
run: | | |
NEW_VERSION=$(cargo metadata --format-version 1 | jq --raw-output '.packages[0].version') | |
cross build --release --target aarch64-unknown-linux-musl | |
cross build --release --target x86_64-unknown-linux-musl | |
strip -s ../../target/x86_64-unknown-linux-musl/release/advent-of-code-grpc-server | |
aarch64-linux-gnu-strip -s ../../target/aarch64-unknown-linux-musl/release/advent-of-code-grpc-server | |
IMAGE_WITH_VERSION=${DOCKER_IMAGE_NAME}:${NEW_VERSION} | |
IMAGE_WITH_LATEST=${DOCKER_IMAGE_NAME}:latest | |
mkdir -p target/linux/{arm64,amd64} | |
cp ../../target/x86_64-unknown-linux-musl/release/advent-of-code-grpc-server target/linux/amd64/ | |
cp ../../target/aarch64-unknown-linux-musl/release/advent-of-code-grpc-server target/linux/arm64/ | |
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag "${IMAGE_WITH_VERSION}" --tag "${IMAGE_WITH_LATEST}" . | |
publish-http-server: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
- run: cargo install cross | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to docker hub | |
run: docker login -u fredrikfornwall -p "$DOCKER_ACCESS_TOKEN" | |
env: | |
DOCKER_ACCESS_TOKEN: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
- name: Install aarch64 strip | |
run: sudo apt-get update && sudo apt-get -y install binutils-aarch64-linux-gnu | |
- name: Build and push docker image | |
working-directory: crates/http-server | |
env: | |
DOCKER_IMAGE_NAME: fredrikfornwall/advent-of-code-http-server | |
run: | | |
NEW_VERSION=$(cargo metadata --format-version 1 | jq --raw-output '.packages[0].version') | |
cross build --release --target aarch64-unknown-linux-musl | |
cross build --release --target x86_64-unknown-linux-musl | |
strip -s ../../target/x86_64-unknown-linux-musl/release/advent-of-code-server | |
aarch64-linux-gnu-strip -s ../../target/aarch64-unknown-linux-musl/release/advent-of-code-server | |
IMAGE_WITH_VERSION=${DOCKER_IMAGE_NAME}:${NEW_VERSION} | |
IMAGE_WITH_LATEST=${DOCKER_IMAGE_NAME}:latest | |
mkdir -p target/linux/{arm64,amd64} | |
cp ../../target/x86_64-unknown-linux-musl/release/advent-of-code-server target/linux/amd64/ | |
cp ../../target/aarch64-unknown-linux-musl/release/advent-of-code-server target/linux/arm64/ | |
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag "${IMAGE_WITH_VERSION}" --tag "${IMAGE_WITH_LATEST}" . |