mirror of
https://github.com/outbackdingo/firezone.git
synced 2026-02-06 01:06:29 +00:00
124 lines
3.3 KiB
YAML
124 lines
3.3 KiB
YAML
name: CI
|
|
on:
|
|
- push
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
unit-integration-test:
|
|
runs-on: ubuntu-20.04
|
|
env:
|
|
MIX_ENV: test
|
|
POSTGRES_HOST: localhost
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
MATRIX_OS: ubuntu-20.04
|
|
services:
|
|
postgres:
|
|
image: postgres:13
|
|
ports:
|
|
- 5432:5432
|
|
env:
|
|
POSTGRES_USER: fireguard
|
|
POSTGRES_PASSWORD: postgres
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
steps:
|
|
- run: which chromedriver
|
|
- name: Install package dependencies
|
|
run: sudo apt-get install net-tools wireguard unzip
|
|
- uses: actions/checkout@v2
|
|
- name: Install Runtimes
|
|
run: .ci/install_runtimes.sh
|
|
- name: Install Dependencies
|
|
run: .ci/install_dependencies.sh
|
|
- name: Setup Database
|
|
run: |
|
|
mix ecto.create
|
|
mix ecto.migrate
|
|
- name: Run Tests and Upload Coverage Report
|
|
run: mix coveralls.github --umbrella
|
|
- uses: actions/upload-artifact@v2
|
|
if: ${{ always() }}
|
|
with:
|
|
name: test screenshots
|
|
path: apps/fg_http/screenshots
|
|
|
|
build:
|
|
needs: unit-integration-test
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-20.04]
|
|
env:
|
|
MATRIX_OS: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Install runtimes
|
|
run: .ci/install_runtimes.sh
|
|
- name: Build release
|
|
env:
|
|
MIX_ENV: prod
|
|
run: .ci/build_release.sh
|
|
- name: Build deb
|
|
run: .ci/build_deb.sh
|
|
- name: Rename Built Artifacts
|
|
run: .ci/rename_artifacts.sh
|
|
- uses: actions/upload-artifact@v2
|
|
with:
|
|
name: fireguard-deb
|
|
path: "fireguard*.deb"
|
|
|
|
functional-test:
|
|
needs: build
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-20.04]
|
|
env:
|
|
MATRIX_OS: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: fireguard-deb
|
|
- name: Test Install package
|
|
env:
|
|
DEBIAN_FRONTEND: noninteractive
|
|
run: .ci/functional_test.sh
|
|
|
|
publish:
|
|
needs: functional-test
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-20.04]
|
|
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
|
|
steps:
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ github.ref }}
|
|
release_name: Release ${{ github.ref }}
|
|
draft: false
|
|
prerelease: true
|
|
- uses: actions/download-artifact@v2
|
|
with:
|
|
name: fireguard-deb
|
|
- name: Upload Release Asset
|
|
id: upload-release-asset
|
|
uses: actions/upload-release-asset@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./fireguard_${{ github.sha }}-1_${{ matrix.os }}_amd64.deb
|
|
asset_name: fireguard_${{ matrix.os }}_amd64.deb
|
|
asset_content_type: application/vnd.debian.binary-package
|