Correct reset (#29) #72
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: CMake | |
permissions: | |
contents: write | |
pull-requests: write | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
release: | |
types: [ created ] | |
env: | |
BUILD_TYPE: Release | |
jobs: | |
build_linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} -j 4 | |
- name: Test | |
run: ctest --test-dir ${{github.workspace}}/build -C ${{env.BUILD_TYPE}} --output-on-failure | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Linux build | |
path: ${{github.workspace}}/build/dote | |
- name: Rename for upload | |
run: mv ${{github.workspace}}/build/dote ${{github.workspace}}/build/dote_linux | |
- name: Upload release binary | |
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda #v2 | |
if: github.event_name == 'release' && github.event.action == 'created' | |
with: | |
files: ${{github.workspace}}/build/dote_linux | |
build_linux_cross: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
include: | |
- architecture: mips | |
qemu: mips | |
- architecture: arm64 | |
qemu: aarch64 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install cross-compile dependencies | |
run: sudo apt-get install debootstrap qemu-user-static binfmt-support sbuild schroot | |
- name: Make chroot | |
run: | | |
mkdir ${{runner.temp}}/chroot | |
sudo debootstrap --foreign --no-check-gpg --include=fakeroot,build-essential --arch=${{matrix.architecture}} buster ${{runner.temp}}/chroot https://archive.debian.org/debian/ | |
sudo cp /usr/bin/qemu-${{matrix.qemu}}-static ${{runner.temp}}/chroot/usr/bin/ | |
sudo chroot ${{runner.temp}}/chroot ./debootstrap/debootstrap --second-stage | |
sudo sbuild-createchroot --arch=${{matrix.architecture}} --foreign --setup-only buster ${{runner.temp}}/chroot https://archive.debian.org/debian/ | |
- name: Install chroot dependencies | |
run: | | |
sudo chroot ${{runner.temp}}/chroot apt-get update | |
sudo chroot ${{runner.temp}}/chroot apt-get --allow-unauthenticated install -qq -y build-essential libssl-dev cmake g++ | |
- name: Copy source to chroot | |
run: | | |
sudo mkdir ${{runner.temp}}/chroot/workdir | |
sudo cp -r ${{github.workspace}}/* ${{runner.temp}}/chroot/workdir | |
sudo mkdir ${{runner.temp}}/chroot/workdir/build | |
- name: Configure CMake | |
run: sudo chroot ${{runner.temp}}/chroot /bin/sh -c "cd /workdir/build && cmake -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} /workdir" | |
- name: Build | |
run: sudo chroot ${{runner.temp}}/chroot cmake --build /workdir/build --config ${{env.BUILD_TYPE}} -- -j 4 | |
- name: Test | |
run: sudo chroot ${{runner.temp}}/chroot ctest --test-dir /workdir/build -C ${{env.BUILD_TYPE}} --output-on-failure | |
- name: Copy build out of chroot | |
run: | | |
sudo cp -r ${{runner.temp}}/chroot/workdir/build ${{github.workspace}} | |
sudo chown -R $(whoami) ${{github.workspace}}/build | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: Linux ${{matrix.architecture}} build | |
path: ${{github.workspace}}/build/dote | |
- name: Rename for upload | |
run: mv ${{github.workspace}}/build/dote ${{github.workspace}}/build/dote_${{matrix.architecture}} | |
- name: Upload release binary | |
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda #v2 | |
if: github.event_name == 'release' && github.event.action == 'created' | |
with: | |
files: ${{github.workspace}}/build/dote_${{matrix.architecture}} | |
build_mac: | |
runs-on: macos-latest | |
env: | |
OPENSSL_ROOT_DIR: /usr/local/opt/openssl/ | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure CMake | |
run: cmake -B ${{github.workspace}}/build_mac -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} | |
- name: Build | |
run: cmake --build ${{github.workspace}}/build_mac --config ${{env.BUILD_TYPE}} -j 4 | |
- name: Test | |
run: ctest --test-dir ${{github.workspace}}/build_mac -C ${{env.BUILD_TYPE}} --output-on-failure | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: macOS build | |
path: ${{github.workspace}}/build_mac/dote | |
- name: Rename for upload | |
run: mv ${{github.workspace}}/build_mac/dote ${{github.workspace}}/build_mac/dote_mac | |
- name: Upload release binary | |
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda #v2 | |
if: github.event_name == 'release' && github.event.action == 'created' | |
with: | |
files: ${{github.workspace}}/build_mac/dote_mac |