?
Some checks failed
CI/CD Pipeline / setup-environment (push) Successful in 0s
CI/CD Pipeline / build (push) Failing after 2s
CI/CD Pipeline / test (push) Has been skipped
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped

This commit is contained in:
philipp 2023-11-18 21:46:00 +01:00
parent cf257c5f65
commit f96086753d

View File

@ -13,19 +13,32 @@ env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
jobs: jobs:
setup-environment:
runs-on: ubuntu-latest
outputs:
cache-key: ${{ steps.cache-keys.outputs.cache-key }}
steps:
- name: Calculate Cache Keys
id: cache-keys
run: echo "::set-output name=cache-key::$(date +%s)"
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: rust:latest needs: setup-environment
container: my-custom-container:latest
steps: steps:
- name: Setup Environment
run: |
rustup target add $CARGO_TARGET
apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Restore Cache
uses: actions/cache@v3
with:
path: |
~/.cargo
./frontend/node_modules
key: ${{ needs.setup-environment.outputs.cache-key }}
- name: Run Test DB Script - name: Run Test DB Script
run: ./test_db.sh run: ./test_db.sh
@ -46,36 +59,28 @@ jobs:
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: rust:latest needs: build
container: my-custom-container:latest
steps: steps:
- name: Setup Environment
run: |
apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
- name: Run Test DB Script - name: Restore Cache
run: ./test_db.sh uses: actions/cache@v3
- name: Download Artifacts
uses: actions/download-artifact@v3
with: with:
name: build-artifacts path: ~/.cargo
key: ${{ needs.setup-environment.outputs.cache-key }}
- name: Run Tests - name: Run Tests
run: cargo test --verbose run: cargo test --verbose
deploy-staging: deploy-staging:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [build, test] needs: test
if: github.ref == 'refs/heads/staging' if: github.ref == 'refs/heads/staging'
steps:
- name: Setup Environment
run: |
apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y
steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -102,13 +107,10 @@ jobs:
deploy-main: deploy-main:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [build, test] needs: test
if: github.ref == 'refs/heads/main' if: github.ref == 'refs/heads/main'
steps:
- name: Setup Environment
run: |
apt-get update -qq && apt-get install -y -qq sshpass musl musl-tools sqlite3 curl gnupg && mkdir -p /etc/apt/keyrings | curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list && apt-get update && apt-get install nodejs -y && apt-get install npm -y
steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3