diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 9fa6c2a33..c8a7f21c6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -24,10 +24,15 @@ }, "ghcr.io/devcontainers/features/github-cli:1": { "version": "latest" + }, + "ghcr.io/devcontainers/features/sshd:1": { + "version": "latest" } }, - // add labels to ports + // add labels to ports that are being used + // this will make it easier to identify what is running on each port + // it's also used by nightly builds to check all services are running as expected "portsAttributes": { "4280": { "label": "Portal App", @@ -48,10 +53,15 @@ "4300": { "label": "Web PubSub API", "onAutoForward": "notify" + }, + "4200": { + "label": "Angular", + "onAutoForward": "notify" } }, // Use 'forwardPorts' to make a list of ports inside the container available locally. + // Note: do not forward 4200 as it's being proxied by 4280 "forwardPorts": [4280, 4242, 3000, 1337], // Use 'postCreateCommand' to run commands after the container is created. @@ -90,7 +100,4 @@ "memory": "8gb", "storage": "32gb" } - - // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. - // "remoteUser": "root" } diff --git a/.github/workflows/codespaces-ci.sh b/.github/workflows/codespaces-ci.sh new file mode 100755 index 000000000..8484e7a3c --- /dev/null +++ b/.github/workflows/codespaces-ci.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +GITHUB_REPOSITORY="Azure-Samples/contoso-real-estate" +BRANCH="codespaces-ci" +APP_PORT="4280" + +# gh auth login --with-token $GITHUB_TOKEN +gh codespace create \ + --repo $GITHUB_REPOSITORY \ + --branch $BRANCH \ + --retention-period "1h" \ + --display-name "Contoso Real Estate Nightly" \ + --idle-timeout "30m" \ + --machine "largePremiumLinux" \ + --status \ + --default-permissions + +# gh codespace stop -R $GITHUB_REPOSITORY +# gh codespace delete -R $GITHUB_REPOSITORY diff --git a/.github/workflows/codespaces-ci.yml b/.github/workflows/codespaces-ci.yml new file mode 100644 index 000000000..e7450fb63 --- /dev/null +++ b/.github/workflows/codespaces-ci.yml @@ -0,0 +1,21 @@ +name: Nightly Codespace CI + +on: + push: + branches: + - main + schedule: + # Runs every day at 4:00 AM pacific (UTC-7) + - cron: '0 12 * * *' + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Deploy to Codespace + env: + GITHUB_TOKEN: ${{ secrets.CODESPACES_TOKEN }} + run: ./.github/workflows/codespaces-ci.sh \ No newline at end of file