1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00
qTox/.github/workflows/build-test-deploy.yaml
Anthony Bilinski 1bc72ab1a4
fix(CI): Grant action content write permission for release upload
By default our organization on GH only grants a more restricted read
permission to actions for content APIs, which include both writing to
repo for nightly tag creation, and writing to releases for nightly and
tag release creation or updates.
2022-02-17 09:01:01 -08:00

522 lines
20 KiB
YAML

name: Build, test, and deploy
on: [pull_request, push]
jobs:
update-nightly-tag:
name: Update nightly release tag
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- name: Move nightly tag to head for nightly release
run: git tag -f nightly && git push origin nightly -f
build-flatpak-docker:
name: Build flatpak docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/build-docker-image
name: "Build docker image"
with:
docker_image_name: flatpak
build-ubuntu-lts-docker:
name: Build ubuntu LTS docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/build-docker-image
name: "Build docker image"
with:
docker_image_name: ubuntu_lts
build-debian-docker:
name: Build debian docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/build-docker-image
name: "Build docker image"
with:
docker_image_name: debian
build-debian-old-docker:
name: Build old debian docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/build-docker-image
name: "Build docker image"
with:
docker_image_name: debian_old
build-almalinux-docker:
name: Build almalinux docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/build-docker-image
name: "Build docker image"
with:
docker_image_name: almalinux
build-fedora-docker:
name: Build fedora docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/build-docker-image
name: "Build docker image"
with:
docker_image_name: fedora
build-opensuse-docker:
name: Build opensuse docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/build-docker-image
name: "Build docker image"
with:
docker_image_name: opensuse
build-windows-docker:
name: Build windows docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/build-docker-image
name: "Build docker image"
with:
docker_image_name: windows_builder
build-windows-i686-docker:
name: Build 32 bit windows docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/build-docker-image
name: "Build docker image"
with:
docker_image_name: windows_builder.i686
build-almalinux:
name: Almalinux
runs-on: ubuntu-latest
needs: build-almalinux-docker
strategy:
matrix:
features: [full, minimal]
build_type: [Debug, Release]
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/load-docker-image
name: Load docker image
with:
docker_image_name: almalinux
- name: Run build
run: docker-compose run --rm almalinux ./.travis/build-qtox-linux.sh --build-type ${{ matrix.build_type }} --${{ matrix.features }}
build-fedora:
name: Fedora
runs-on: ubuntu-latest
needs: build-fedora-docker
strategy:
matrix:
features: [full, minimal]
build_type: [Debug, Release]
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/load-docker-image
name: Load docker image
with:
docker_image_name: fedora
- name: Run build
run: docker-compose run --rm fedora ./.travis/build-qtox-linux.sh --build-type ${{ matrix.build_type }} --${{ matrix.features }}
build-opensuse:
name: Opensuse
runs-on: ubuntu-latest
needs: build-opensuse-docker
strategy:
matrix:
features: [full, minimal]
build_type: [Debug, Release]
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/load-docker-image
name: Load docker image
with:
docker_image_name: opensuse
- name: Run build
run: docker-compose run --rm opensuse ./.travis/build-qtox-linux.sh --build-type ${{ matrix.build_type }} --${{ matrix.features }}
build-debian:
name: Debian
runs-on: ubuntu-latest
needs: build-debian-docker
strategy:
matrix:
features: [full, minimal]
build_type: [Debug, Release]
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/load-docker-image
name: Load docker image
with:
docker_image_name: debian
- name: Run build
run: docker-compose run --rm debian ./.travis/build-qtox-linux.sh --build-type ${{ matrix.build_type }} --${{ matrix.features }}
build-debian-old:
name: Debian Old
runs-on: ubuntu-latest
needs: build-debian-old-docker
strategy:
matrix:
features: [full, minimal]
build_type: [Debug, Release]
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/load-docker-image
name: Load docker image
with:
docker_image_name: debian_old
- name: Run build
run: docker-compose run --rm debian_old ./.travis/build-qtox-linux.sh --build-type ${{ matrix.build_type }} --${{ matrix.features }}
build-ubuntu:
name: Ubuntu LTS
runs-on: ubuntu-latest
needs: build-ubuntu-lts-docker
strategy:
matrix:
features: [full, minimal]
build_type: [Debug, Release]
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/load-docker-image
name: Load docker image
with:
docker_image_name: ubuntu_lts
- name: Run build
run: docker-compose run --rm ubuntu_lts ./.travis/build-qtox-linux.sh --build-type ${{ matrix.build_type }} --${{ matrix.features }}
- name: Code coverage
run: |
# https://github.com/actions/runner/issues/491
if [ "${{ matrix.build_type }}" == "Release" ] && [ "${{ matrix.features }}" == "full" ]; then
docker-compose run --rm ubuntu_lts ./.travis/lcov.sh
# Upload report to codecov.io
bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports"
fi
build-appimage:
name: Appimage
runs-on: ubuntu-latest
needs: [build-ubuntu-lts-docker, update-nightly-tag]
if: |
always() &&
needs.build-ubuntu-lts-docker.result == 'success' &&
(needs.update-nightly-tag.result == 'success' ||
needs.update-nightly-tag.result == 'skipped')
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/load-docker-image
name: Load docker image
with:
docker_image_name: ubuntu_lts
- name: Run build
run: docker-compose run --rm ubuntu_lts ./appimage/build.sh --src-dir /qtox
- name: Upload appimage
uses: actions/upload-artifact@v2
with:
name: qTox-${{ github.sha }}.x86_64.AppImage
path: qTox-*.x86_64.AppImage
- name: Get tag name for appimage release file name
if: contains(github.ref, 'refs/tags/v')
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Rename appimage for release upload
if: contains(github.ref, 'refs/tags/v')
run: |
cp qTox-*.x86_64.AppImage qTox-${{ steps.get_version.outputs.VERSION }}.x86_64.AppImage
sha256sum qTox-${{ steps.get_version.outputs.VERSION }}.x86_64.AppImage > qTox-${{ steps.get_version.outputs.VERSION }}.x86_64.AppImage.sha256
cp qTox-*.x86_64.AppImage.zsync qTox-${{ steps.get_version.outputs.VERSION }}.x86_64.AppImage.zsync
- name: Upload to versioned release
if: contains(github.ref, 'refs/tags/v')
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "qTox-${{ steps.get_version.outputs.VERSION }}.x86_64.AppImage,qTox-${{ steps.get_version.outputs.VERSION }}.x86_64.AppImage.sha256,qTox-${{ steps.get_version.outputs.VERSION }}.x86_64.AppImage.zsync"
- name: Rename artifact for nightly upload
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: cp qTox-*.x86_64.AppImage qTox-nightly.x86_64.AppImage
- name: Upload to nightly release
uses: ncipollo/release-action@v1
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
with:
allowUpdates: true
tag: nightly
prerelease: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "qTox-nightly.x86_64.AppImage"
build-flatpak:
name: Flatpak
runs-on: ubuntu-latest
needs: [build-flatpak-docker, update-nightly-tag]
if: |
always() &&
needs.build-flatpak-docker.result == 'success' &&
(needs.update-nightly-tag.result == 'success' ||
needs.update-nightly-tag.result == 'skipped')
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/load-docker-image
name: Load docker image
with:
docker_image_name: flatpak
- name: Run build
run: docker-compose run --rm flatpak ./flatpak/build.sh
- name: Upload flatpak
uses: actions/upload-artifact@v2
with:
name: qTox-${{ github.sha }}.x86_64.flatpak
path: qtox.flatpak
- name: Get tag name for flatpak release file name
if: contains(github.ref, 'refs/tags/v')
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- name: Rename flatpak for release upload
if: contains(github.ref, 'refs/tags/v')
run: |
cp qtox.flatpak qTox-${{ steps.get_version.outputs.VERSION }}.x86_64.flatpak
sha256sum qTox-${{ steps.get_version.outputs.VERSION }}.x86_64.flatpak > qTox-${{ steps.get_version.outputs.VERSION }}.x86_64.flatpak.sha256
- name: Upload to versioned release
if: contains(github.ref, 'refs/tags/v')
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "qTox-${{ steps.get_version.outputs.VERSION }}.x86_64.flatpak,qTox-${{ steps.get_version.outputs.VERSION }}.x86_64.flatpak.sha256"
- name: Rename artifact for nightly upload
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: cp qtox.flatpak qTox-nightly.flatpak
- name: Upload to nightly release
uses: ncipollo/release-action@v1
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
with:
allowUpdates: true
tag: nightly
prerelease: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "qTox-nightly.flatpak"
build-windows:
name: Windows
runs-on: ubuntu-latest
needs: [build-windows-docker, update-nightly-tag]
if: |
always() &&
needs.build-windows-docker.result == 'success' &&
(needs.update-nightly-tag.result == 'success' ||
needs.update-nightly-tag.result == 'skipped')
permissions:
contents: write
strategy:
matrix:
build_type: [debug, release]
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/load-docker-image
name: Load docker image
with:
docker_image_name: windows_builder
- name: Run build
run: docker-compose run --rm windows_builder ./windows/cross-compile/build.sh --arch x86_64 --build-type ${{ matrix.build_type }} --src-dir /qtox
- name: Upload installer
uses: actions/upload-artifact@v2
with:
name: setup-qtox-x86_64-${{ matrix.build_type }}.exe
path: package-prefix/setup-qtox.exe
- name: Upload zip
uses: actions/upload-artifact@v2
with:
name: setup-qtox-x86_64-${{ matrix.build_type }}.zip
path: install-prefix/qtox-x86_64-${{ matrix.build_type }}.zip
if-no-files-found: ignore
- name: Rename exe for release upload
if: contains(github.ref, 'refs/tags/v') && matrix.build_type == 'release'
run: |
cp package-prefix/setup-qtox.exe setup-qtox-x86_64-release.exe
sha256sum setup-qtox-x86_64-release.exe > setup-qtox-x86_64-release.exe.sha256
- name: Upload to versioned release
if: contains(github.ref, 'refs/tags/v') && matrix.build_type == 'release'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "setup-qtox-x86_64-release.exe,setup-qtox-x86_64-release.exe.sha256"
- name: Rename zip for nightly upload
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: cp install-prefix/qtox-x86_64-${{ matrix.build_type }}.zip setup-qtox-nightly-x86_64-${{ matrix.build_type }}.zip
- name: Upload zip to nightly release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
tag: nightly
prerelease: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "setup-qtox-nightly-x86_64-${{ matrix.build_type }}.zip"
- name: Rename exe for nightly upload
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.build_type == 'release'
run: cp package-prefix/setup-qtox.exe setup-qtox-nightly-x86_64-release.exe
- name: Upload exe to nightly release
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.build_type == 'release'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
tag: nightly
prerelease: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "setup-qtox-nightly-x86_64-release.exe"
build-windows-i686:
name: Windows i686
runs-on: ubuntu-latest
needs: [build-windows-i686-docker, update-nightly-tag]
if: |
always() &&
needs.build-windows-i686-docker.result == 'success' &&
(needs.update-nightly-tag.result == 'success' ||
needs.update-nightly-tag.result == 'skipped')
permissions:
contents: write
strategy:
matrix:
build_type: [debug, release]
steps:
- uses: actions/checkout@v2
- uses: ./.github/actions/load-docker-image
name: Load docker image
with:
docker_image_name: windows_builder.i686
- name: Run build
run: docker-compose run --rm windows_builder.i686 ./windows/cross-compile/build.sh --arch i686 --build-type ${{ matrix.build_type }} --src-dir /qtox
- name: Upload installer
uses: actions/upload-artifact@v2
with:
name: setup-qtox-i686-${{ matrix.build_type }}.exe
path: package-prefix/setup-qtox.exe
- name: Upload zip
uses: actions/upload-artifact@v2
with:
name: setup-qtox-i686-${{ matrix.build_type }}.zip
path: install-prefix/qtox-i686-${{ matrix.build_type }}.zip
if-no-files-found: ignore
- name: Rename exe for release upload
if: contains(github.ref, 'refs/tags/v') && matrix.build_type == 'release'
run: |
cp package-prefix/setup-qtox.exe setup-qtox-i686-release.exe
sha256sum setup-qtox-i686-release.exe > setup-qtox-i686-release.exe.sha256
- name: Upload to versioned release
if: contains(github.ref, 'refs/tags/v') && matrix.build_type == 'release'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "setup-qtox-i686-release.exe,setup-qtox-i686-release.exe.sha256"
- name: Rename zip for nightly upload
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: cp install-prefix/qtox-i686-${{ matrix.build_type }}.zip setup-qtox-nightly-i686-${{ matrix.build_type }}.zip
- name: Upload zip to nightly release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
tag: nightly
prerelease: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "setup-qtox-nightly-i686-${{ matrix.build_type }}.zip"
- name: Rename exe for nightly upload
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.build_type == 'release'
run: cp package-prefix/setup-qtox.exe setup-qtox-nightly-i686-release.exe
- name: Upload exe to nightly release
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.build_type == 'release'
uses: ncipollo/release-action@v1
with:
allowUpdates: true
tag: nightly
prerelease: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "setup-qtox-nightly-i686-release.exe"
build-osx:
name: macOS
runs-on: macos-10.15
needs: update-nightly-tag
if: |
always() &&
(needs.update-nightly-tag.result == 'success' ||
needs.update-nightly-tag.result == 'skipped')
permissions:
contents: write
env:
TRAVIS: true
TRAVIS_BUILD_DIR: ${{ github.workspace }}
steps:
- uses: actions/checkout@v2
- name: homebrew
run: brew upgrade && brew bundle --file ./osx/Brewfile
- name: Install toxcore and toxext
run: buildscripts/build_toxcore_linux.sh
- name: Build qTox
run: ./.travis/build-osx.sh
- name: Upload dmg
uses: actions/upload-artifact@v2
with:
name: qTox-${{ github.sha }}.dmg
path: qTox.dmg
- name: Create shasum for versioned release
if: contains(github.ref, 'refs/tags/v')
run: sha256sum qTox.dmg > qTox.dmg.sha256
- name: Upload to versioned release
if: contains(github.ref, 'refs/tags/v')
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "qTox.dmg,qTox.dmg.sha256"
- name: Rename artifact for nightly upload
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: cp qTox.dmg qTox-nightly.dmg
- name: Upload to nightly release
uses: ncipollo/release-action@v1
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
with:
allowUpdates: true
tag: nightly
prerelease: true
replacesArtifacts: true
token: ${{ secrets.GITHUB_TOKEN }}
artifacts: "qTox-nightly.dmg"
build-docs:
name: Docs
runs-on: ubuntu-18.04
env:
DOXYGEN_CONFIG_FILE: doxygen.conf
steps:
- uses: actions/checkout@v2
- name: Run
run: ./.travis/build-docs.sh
build-gitstats:
name: Gitstats
runs-on: ubuntu-18.04
env:
GITSTATS_DIR: gitstats
steps:
- uses: actions/checkout@v2
- name: Install gitstats
run: sudo apt-get install gitstats
- name: Run
run: ./.travis/build-gitstats.sh