feat: Add CDK to Nix shell #859
Workflow file for this run
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: Build | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4.0.0 | |
with: | |
fetch-depth: 0 | |
- name: Get Python version | |
run: echo "python_version=$(cat .python-version)" >> "$GITHUB_ENV" | |
- name: Setup Python ${{ matrix.python }} | |
uses: actions/setup-python@v4.7.0 | |
with: | |
python-version: ${{ env.python_version }} | |
- uses: actions/cache@v3.3.2 | |
with: | |
path: ~/.cache/pip | |
key: | |
${{ runner.os }}-pip-${{ secrets.CACHE_SEED }}-${{ env.python_version }}-${{ | |
hashFiles('./poetry.lock') }} | |
restore-keys: ${{ runner.os }}-pip-${{ secrets.CACHE_SEED }}-${{ env.python_version }}- | |
- name: Upgrade pip | |
run: python -m pip install --upgrade pip | |
- name: Install Poetry | |
run: python -m pip install poetry | |
- name: Install Python dependencies | |
run: python -m poetry install | |
- name: Use Node.js for CDK deployment | |
uses: actions/setup-node@v3.8.1 | |
with: | |
node-version-file: '.nvmrc' | |
registry-url: https://registry.npmjs.org | |
- name: Cache Node.js packages | |
uses: actions/cache@v3.3.2 | |
with: | |
path: ~/.npm | |
key: | |
${{ runner.os }}-node-${{ secrets.CACHE_SEED }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-${{ secrets.CACHE_SEED }}- | |
- name: Install Node.js dependencies | |
run: npm ci --production | |
- name: Add local Node packages to PATH | |
run: echo "./node_modules/.bin:$PATH" >> $GITHUB_PATH | |
- name: Lint Last Commit | |
if: github.event_name == 'push' | |
run: poetry run gitlint | |
- name: Lint All Commits on Pull Request | |
if: github.event_name == 'pull_request' | |
run: poetry run gitlint --commits "origin/${{ github.base_ref }}...HEAD" | |
- name: Format | |
run: poetry run pre-commit run --all-files | |
- name: Test CDK stacks synthesize | |
run: poetry run cdk synthesize | |
build-nix-shell: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4.0.0 | |
- uses: cachix/install-nix-action@v23 | |
- uses: cachix/cachix-action@v12 | |
with: | |
name: linz | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
- run: nix-shell --pure --run true | |
finalise: | |
if: always() | |
needs: | |
- build | |
- build-nix-shell | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@v1.2.2 | |
with: | |
jobs: ${{ toJSON(needs) }} |