|
| 1 | +name: CREATOR workflow CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "master" ] |
| 6 | + pull_request: |
| 7 | + branches: [ "master" ] |
| 8 | + |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + packages: write |
| 12 | + pages: write # to deploy to Pages |
| 13 | + id-token: write # to verify the deployment originates from an appropriate source |
| 14 | + |
| 15 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 16 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 17 | +concurrency: |
| 18 | + group: "pages" |
| 19 | + cancel-in-progress: false |
| 20 | + |
| 21 | +jobs: |
| 22 | + build: |
| 23 | + name: Build CREATOR |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - name: Checkout |
| 27 | + uses: actions/checkout@v4 |
| 28 | + - name: Build static files |
| 29 | + id: build |
| 30 | + run: ./mk_min.sh |
| 31 | + - name: Upload artifact |
| 32 | + uses: actions/upload-pages-artifact@v3 |
| 33 | + with: |
| 34 | + path: '.' |
| 35 | + |
| 36 | + creator-checker: |
| 37 | + name: Execute CREATOR Checker |
| 38 | + needs: build |
| 39 | + |
| 40 | + runs-on: ubuntu-latest |
| 41 | + |
| 42 | + strategy: |
| 43 | + matrix: |
| 44 | + node-version: [20.x] |
| 45 | + |
| 46 | + steps: |
| 47 | + - uses: pyTooling/download-artifact@v4 |
| 48 | + with: |
| 49 | + name: github-pages |
| 50 | + tarball-name: artifact.tar |
| 51 | + path: . |
| 52 | + - name: Use Node.js ${{ matrix.node-version }} |
| 53 | + uses: actions/setup-node@v4 |
| 54 | + with: |
| 55 | + node-version: ${{ matrix.node-version }} |
| 56 | + cache: 'npm' |
| 57 | + - name: Install dependencies |
| 58 | + run: npm ci |
| 59 | + - run: npm run build --if-present |
| 60 | + - run: npm run test-creator-node |
| 61 | + |
| 62 | + deploy-pages-beta: |
| 63 | + name: Deploy CREATOR to GitHub Pages (development) |
| 64 | + runs-on: ubuntu-latest |
| 65 | + needs: build |
| 66 | + if: github.event_name != 'pull_request' && github.repository != 'creatorsim/creator' |
| 67 | + # Deploy to the github-pages environment |
| 68 | + environment: |
| 69 | + name: github-pages |
| 70 | + url: ${{ steps.deployment.outputs.page_url }} |
| 71 | + steps: |
| 72 | + - name: Deploy to GitHub Pages |
| 73 | + uses: actions/deploy-pages@v4 |
| 74 | + |
| 75 | + deploy-pages-stable: |
| 76 | + name: Deploy CREATOR to GitHub Pages (stable) |
| 77 | + runs-on: ubuntu-latest |
| 78 | + needs: creator-checker |
| 79 | + if: github.event_name != 'pull_request' && github.repository == 'creatorsim/creator' |
| 80 | + # Deploy to the github-pages environment |
| 81 | + environment: |
| 82 | + name: github-pages |
| 83 | + url: ${{ steps.deployment.outputs.page_url }} |
| 84 | + steps: |
| 85 | + - name: Deploy to GitHub Pages |
| 86 | + uses: actions/deploy-pages@v4 |
| 87 | + |
| 88 | + build-creator-cl: |
| 89 | + name: Build creator_cl Docker Image |
| 90 | + needs: creator-checker |
| 91 | + if: github.event_name != 'pull_request' |
| 92 | + |
| 93 | + runs-on: ubuntu-latest |
| 94 | + |
| 95 | + steps: |
| 96 | + - name: Free Disk Space (Ubuntu) |
| 97 | + uses: jlumbroso/free-disk-space@main |
| 98 | + with: |
| 99 | + tool-cache: false |
| 100 | + android: true |
| 101 | + dotnet: true |
| 102 | + haskell: true |
| 103 | + large-packages: true |
| 104 | + docker-images: false |
| 105 | + swap-storage: true |
| 106 | + - uses: pyTooling/download-artifact@v4 |
| 107 | + with: |
| 108 | + name: github-pages |
| 109 | + tarball-name: artifact.tar |
| 110 | + path: . |
| 111 | + - name: Set up QEMU |
| 112 | + uses: docker/setup-qemu-action@v3 |
| 113 | + with: |
| 114 | + image: tonistiigi/binfmt:qemu-v7.0.0-28 |
| 115 | + - name: Set up Docker Buildx |
| 116 | + uses: docker/setup-buildx-action@v3 |
| 117 | + - name: Login to GitHub Package Registry |
| 118 | + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin |
| 119 | + - name: Build & Push Docker image |
| 120 | + run: cd ./dockers/command_line/ && docker buildx build -t ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}_creator_cl:${GITHUB_SHA} -t ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}_creator_cl -f ./Dockerfile --push --platform=linux/amd64,linux/arm64,linux/arm/v7 . |
| 121 | + |
| 122 | + push-creator-cl: |
| 123 | + name: Push creator_cl Docker Image |
| 124 | + needs: build-creator-cl |
| 125 | + if: github.event_name != 'pull_request' && github.repository == 'creatorsim/creator' |
| 126 | + |
| 127 | + runs-on: ubuntu-latest |
| 128 | + |
| 129 | + steps: |
| 130 | + - name: Login to Docker Hub |
| 131 | + env: |
| 132 | + DH_TOKEN: ${{ secrets.DOCKER_HUB_PASSWORD }} |
| 133 | + run: docker login -u creatorsim -p ${DH_TOKEN} |
| 134 | + - name: Re-tag & Push Docker Image to Docker Hub |
| 135 | + run: | |
| 136 | + chmod +r $HOME/.docker/config.json |
| 137 | + docker container run --rm --network host -v regctl-conf:/home/appuser/.regctl/ -v $HOME/.docker/config.json:/home/appuser/.docker/config.json regclient/regctl:v0.3.9 image copy ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}_creator_cl:${GITHUB_SHA} docker.io/creatorsim/creator_cl:${GITHUB_SHA} |
| 138 | + docker container run --rm --network host -v regctl-conf:/home/appuser/.regctl/ -v $HOME/.docker/config.json:/home/appuser/.docker/config.json regclient/regctl:v0.3.9 image copy ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}_creator_cl docker.io/creatorsim/creator_cl |
| 139 | + |
| 140 | + build-creator-gateway: |
| 141 | + name: Build creator_gateway Docker Image |
| 142 | + needs: creator-checker |
| 143 | + if: github.event_name != 'pull_request' |
| 144 | + |
| 145 | + runs-on: ubuntu-latest |
| 146 | + |
| 147 | + steps: |
| 148 | + - name: Free Disk Space (Ubuntu) |
| 149 | + uses: jlumbroso/free-disk-space@main |
| 150 | + with: |
| 151 | + tool-cache: false |
| 152 | + android: true |
| 153 | + dotnet: true |
| 154 | + haskell: true |
| 155 | + large-packages: true |
| 156 | + docker-images: false |
| 157 | + swap-storage: true |
| 158 | + - uses: pyTooling/download-artifact@v4 |
| 159 | + with: |
| 160 | + name: github-pages |
| 161 | + tarball-name: artifact.tar |
| 162 | + path: . |
| 163 | + - name: Set up QEMU |
| 164 | + uses: docker/setup-qemu-action@v3 |
| 165 | + with: |
| 166 | + image: tonistiigi/binfmt:qemu-v7.0.0-28 |
| 167 | + - name: Set up Docker Buildx |
| 168 | + uses: docker/setup-buildx-action@v3 |
| 169 | + - name: Login to GitHub Package Registry |
| 170 | + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin |
| 171 | + - name: Build & Push Docker image |
| 172 | + run: cd ./dockers/gateway/ && docker buildx build -t ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}_creator_gateway:${GITHUB_SHA} -t ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}_creator_gateway -f ./Dockerfile --push --platform=linux/amd64,linux/arm64,linux/arm/v7 . |
| 173 | + |
| 174 | + push-creator-gateway: |
| 175 | + name: Push creator_gateway Docker Image |
| 176 | + needs: build-creator-gateway |
| 177 | + if: github.event_name != 'pull_request' && github.repository == 'creatorsim/creator' |
| 178 | + |
| 179 | + runs-on: ubuntu-latest |
| 180 | + |
| 181 | + steps: |
| 182 | + - name: Login to Docker Hub |
| 183 | + env: |
| 184 | + DH_TOKEN: ${{ secrets.DOCKER_HUB_PASSWORD }} |
| 185 | + run: docker login -u creatorsim -p ${DH_TOKEN} |
| 186 | + - name: Re-tag & Push Docker Image to Docker Hub |
| 187 | + run: | |
| 188 | + chmod +r $HOME/.docker/config.json |
| 189 | + docker container run --rm --network host -v regctl-conf:/home/appuser/.regctl/ -v $HOME/.docker/config.json:/home/appuser/.docker/config.json regclient/regctl:v0.3.9 image copy ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}_creator_gateway:${GITHUB_SHA} docker.io/creatorsim/creator_gateway:${GITHUB_SHA} |
| 190 | + docker container run --rm --network host -v regctl-conf:/home/appuser/.regctl/ -v $HOME/.docker/config.json:/home/appuser/.docker/config.json regclient/regctl:v0.3.9 image copy ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}_creator_gateway docker.io/creatorsim/creator_gateway |
| 191 | +
|
| 192 | + build-creator-hw-lab: |
| 193 | + name: Build creator_remote_lab Docker Image |
| 194 | + needs: creator-checker |
| 195 | + if: github.event_name != 'pull_request' |
| 196 | + |
| 197 | + runs-on: ubuntu-latest |
| 198 | + |
| 199 | + steps: |
| 200 | + - name: Free Disk Space (Ubuntu) |
| 201 | + uses: jlumbroso/free-disk-space@main |
| 202 | + with: |
| 203 | + tool-cache: false |
| 204 | + android: true |
| 205 | + dotnet: true |
| 206 | + haskell: true |
| 207 | + large-packages: true |
| 208 | + docker-images: false |
| 209 | + swap-storage: true |
| 210 | + - uses: pyTooling/download-artifact@v4 |
| 211 | + with: |
| 212 | + name: github-pages |
| 213 | + tarball-name: artifact.tar |
| 214 | + path: . |
| 215 | + - name: Set up QEMU |
| 216 | + uses: docker/setup-qemu-action@v3 |
| 217 | + with: |
| 218 | + image: tonistiigi/binfmt:qemu-v7.0.0-28 |
| 219 | + - name: Set up Docker Buildx |
| 220 | + uses: docker/setup-buildx-action@v3 |
| 221 | + - name: Login to GitHub Package Registry |
| 222 | + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin |
| 223 | + - name: Build & Push Docker image |
| 224 | + run: cd ./dockers/remote_lab/ && docker buildx build -t ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}_creator_remote_lab:${GITHUB_SHA} -t ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}_creator_remote_lab -f ./Dockerfile --push --platform=linux/amd64,linux/arm64,linux/arm/v7 . |
| 225 | + |
| 226 | + push-creator-hw-lab: |
| 227 | + name: Push creator_remote_lab Docker Image |
| 228 | + needs: build-creator-hw-lab |
| 229 | + if: github.event_name != 'pull_request' && github.repository == 'creatorsim/creator' |
| 230 | + |
| 231 | + runs-on: ubuntu-latest |
| 232 | + |
| 233 | + steps: |
| 234 | + - name: Login to Docker Hub |
| 235 | + env: |
| 236 | + DH_TOKEN: ${{ secrets.DOCKER_HUB_PASSWORD }} |
| 237 | + run: docker login -u creatorsim -p ${DH_TOKEN} |
| 238 | + - name: Re-tag & Push Docker Image to Docker Hub |
| 239 | + run: | |
| 240 | + chmod +r $HOME/.docker/config.json |
| 241 | + docker container run --rm --network host -v regctl-conf:/home/appuser/.regctl/ -v $HOME/.docker/config.json:/home/appuser/.docker/config.json regclient/regctl:v0.3.9 image copy ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}_creator_remote_lab:${GITHUB_SHA} docker.io/creatorsim/creator_remote_lab:${GITHUB_SHA} |
| 242 | + docker container run --rm --network host -v regctl-conf:/home/appuser/.regctl/ -v $HOME/.docker/config.json:/home/appuser/.docker/config.json regclient/regctl:v0.3.9 image copy ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}_creator_remote_lab docker.io/creatorsim/creator_remote_lab |
0 commit comments