Files
firezone/.github/workflows/ci.yml
Jamil Bou Kheir 4675a89b86 Come on postgres
2021-06-30 15:51:05 -07:00

179 lines
5.3 KiB
YAML

name: CI
on:
- push
defaults:
run:
shell: bash
jobs:
unit-integration-test:
runs-on: ubuntu-18.04
env:
MIX_ENV: test
POSTGRES_HOST: localhost
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MATRIX_OS: ubuntu-18.04
arch: amd64
services:
postgres:
image: postgres:13
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Install package dependencies
run: sudo apt-get install net-tools wireguard unzip gdebi
- uses: actions/checkout@v2
- name: Install Runtimes
run: |
sudo -E bash -c '.ci/install_runtimes.sh'
- name: Install Dependencies
run: .ci/install_dependencies.sh
- uses: actions/cache@v2
with:
path: |
deps
_build
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: |
${{ runner.os }}-mix-
- 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/cf_http/screenshots
build-linux:
needs: unit-integration-test
runs-on: ubuntu-18.04
name: Build on {{ matrix.arch }}
env:
arch: ${{ matrix.arch }}
MIX_ENV: prod
strategy:
matrix:
include:
- arch: amd64
- arch: arm64
steps:
- uses: actions/checkout@v2
# amd64 build
- if: ${{ matrix.arch == 'amd64' }}
run: |
sudo apt-get install -q -y zstd gdebi
sudo -E bash -c '.ci/install_runtimes.sh'
sudo -E bash -c '.ci/build_release.sh'
# arm64 build
# XXX: This currently takes upwards of 10 minutes or more. Disabling for
# now.
# - uses: uraimo/run-on-arch-action@v2.0.10
# if: ${{ matrix.arch == 'arm64' }}
# name: Run on arm64
# with:
# arch: aarch64
# install: |
# # No obvious way to load a script file here, so needs inlining :-(
# apt-get update -q -y
# apt-get install -q -y gcc g++ make curl gdebi zstd
#
# curl -O https://packages.erlang-solutions.com/erlang/debian/pool/esl-erlang_24.0.2-1~ubuntu~bionic_arm64.deb
# curl -O https://packages.erlang-solutions.com/erlang/debian/pool/elixir_1.12.0-1~ubuntu~bionic_all.deb
# gdebi --non-interactive esl-erlang_24.0.2-1~ubuntu~bionic_arm64.deb
# gdebi --non-interactive elixir_1.12.0-1~ubuntu~bionic_all.deb
#
# curl -sL https://deb.nodesource.com/setup_14.x | bash -
# apt-get install -y -q nodejs
# dockerRunArgs: |
# --volume "${PWD}:/app"
# distro: ubuntu18.04
# env: |
# arch: arm64
# githubToken: ${{ github.token }}
# run: |
# cd /app
# bash -c '.ci/build_release.sh'
- uses: actions/upload-artifact@v2
with:
name: cloudfire-${{ matrix.arch }}
path: _build/prod/rel/bakeware/cloudfire
functional-test:
needs: build-linux
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04]
env:
MATRIX_OS: ${{ matrix.os }}
services:
postgres:
image: postgres:13
ports:
- 5432:5432
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: cloudfire-amd64
- run: sudo apt-get install -q -y wireguard
- 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: cloudfire-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: ./cloudfire_${{ github.sha }}-1_${{ matrix.os }}_amd64.deb
# asset_name: cloudfire_${{ matrix.os }}_amd64.deb
# asset_content_type: application/vnd.debian.binary-package