빌드시 환경변수 embed되도록 수정 #77
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
test: | |
strategy: | |
matrix: | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
env: | |
INFLUXDB_URL: http://localhost:8086 | |
INFLUXDB_BUCKET: bucket | |
INFLUXDB_TOKEN: token | |
INFLUXDB_ORG: org | |
services: | |
influxdb: | |
image: influxdb:latest | |
ports: | |
- 8086:8086 | |
env: | |
DOCKER_INFLUXDB_INIT_MODE: setup | |
DOCKER_INFLUXDB_INIT_USERNAME: admin | |
DOCKER_INFLUXDB_INIT_PASSWORD: password | |
DOCKER_INFLUXDB_INIT_ORG: ${{ env.INFLUXDB_ORG }} | |
DOCKER_INFLUXDB_INIT_BUCKET: ${{ env.INFLUXDB_BUCKET }} | |
DOCKER_INFLUXDB_INIT_ADMIN_TOKEN: ${{ env.INFLUXDB_TOKEN }} | |
steps: | |
- name: Issue Token | |
run: | | |
sleep 5 | |
CONTAINER_ID=$(docker ps | grep 'influxdb:latest' | awk '{print $1}') | |
OUTPUT=$(docker exec ${CONTAINER_ID} influx auth create --org org --read-buckets --write-buckets --description "New token for testing") | |
INFLUXDB_TOKEN=$(echo ${OUTPUT} | grep 'New token for testing' | awk '{print $6}') | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install cargo-make | |
run: cargo install cargo-make | |
- name: Cache Cargo registry | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-registry- | |
- name: Cache Cargo build | |
uses: actions/cache@v2 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-build- | |
- name: Run tests | |
run: | | |
cargo make test | |
cargo make test-sensitive | |
test-windows: | |
strategy: | |
matrix: | |
platform: [windows-latest] | |
runs-on: ${{ matrix.platform }} | |
env: | |
INFLUXDB_URL: http://localhost:8086 | |
INFLUXDB_BUCKET: sample-bucket | |
INFLUXDB_TOKEN: token | |
INFLUXDB_ORG: goboolean | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Install cargo-make | |
run: cargo install cargo-make | |
- name: Cache Cargo registry | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-registry- | |
- name: Cache Cargo build | |
uses: actions/cache@v2 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-build- | |
- name: Run tests | |
run: | | |
cargo make test | |
cargo make test-sensitive | |
lint: | |
strategy: | |
matrix: | |
platform: [ubuntu-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install cargo-make | |
run: cargo install cargo-make | |
- name: Cache Cargo registry | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-registry- | |
- name: Cache Cargo build | |
uses: actions/cache@v2 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-build- | |
- name: Run build | |
run: cargo make build | |
- name: Run Clippy | |
run: cargo make lint |