1
0
mirror of https://github.com/h7x4/Jisho-Study-Tool.git synced 2024-12-21 13:37:29 +01:00

Add .circleci/config.yml

This commit is contained in:
Oystein Kristoffer Tveit 2021-03-03 21:15:03 +01:00
parent 5eaf220683
commit 0e54e73bb5

90
.circleci/config.yml Normal file
View File

@ -0,0 +1,90 @@
# Author @mvxt
version: 2.1
# Simple YAML anchors
aliases:
- &project_dir "~/project"
commands:
dependencies:
description: "Download dependencies and setup global packages"
parameters:
shell:
type: string
default: "/bin/bash --login -eo pipefail"
pub-cache:
type: string
default: "~/.pub-cache"
steps:
- checkout
- restore_cache:
keys:
- v1.4-dependencies-{{ arch }}-{{ checksum "pubspec.lock" }}
- v1.4-dependencies-{{ arch }}-
- run:
name: Download deps
shell: << parameters.shell >>
command: pub get
- run:
name: Get junitreporter
shell: << parameters.shell >>
command: pub global activate junitreport
- save_cache:
key: v1.4-dependencies-{{ arch }}-{{ checksum "pubspec.lock" }}
paths:
- .dart_tool
- << parameters.pub-cache >>
###### ################
# Workflow definition
###### ################
workflows:
version: 2.1
test-and-build:
jobs:
- test
- build-linux:
requires:
- test
##################
# Job Definitions
##################
jobs:
test:
docker:
- image: google/dart:2.9.1
auth:
username: $DOCKER_USERNAME
password: $DOCKER_PASSWORD # context / project UI env-var reference
steps:
- dependencies:
shell: "/bin/bash -eo pipefail"
- run:
name: Make folder for test results
command: mkdir -p test-results/dart-tests
- run:
name: Run tests
command: pub run test --reporter json | tojunit --output test-results/dart-tests/circleci_dart_demo_test-report.xml
- store_test_results:
path: test-results
build-linux:
machine: true
steps:
- run:
name: Install Dart SDK
shell: /bin/bash --login -eo pipefail
command: |
# Setup repo & signing key
sudo apt update
sudo apt install apt-transport-https
sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
# Update again and install
sudo apt update
sudo apt install dart
# Set PATH in profile for downstream commands
echo "export PATH=$PATH:/usr/lib/dart/bin" >> $BASH_ENV
- dependencies