frontend #136
This file contains hidden or 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: Docker CI | |
| on: | |
| push: | |
| branches: ["humble"] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: epflxplore/cs | |
| jobs: | |
| delete-untagged-images: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Delete all untagged images from repository | |
| uses: Chizkiyahu/delete-untagged-ghcr-action@v3 | |
| with: | |
| token: ${{ secrets.PAT_TOKEN }} | |
| repository_owner: ${{ github.repository_owner }} | |
| owner_type: org | |
| repository: ${{ github.repository }} | |
| untagged_only: true | |
| # This workflow contains multiple jobs | |
| build_test: | |
| # The type of runner that the job will run on | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [14.x] | |
| # Steps represent a sequence of tasks that will be executed as part of the job | |
| steps: | |
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
| - uses: actions/checkout@v2 | |
| with: | |
| submodules: "true" | |
| token: ${{ secrets.PAT_TOKEN }} | |
| - name: setup node | |
| uses: actions/setup-node@master | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| # install applicaion dependencies | |
| - name: Install dependencies | |
| run: | | |
| npm cache clean --force | |
| rm -rf node_modules | |
| rm -rf package-lock.json | |
| npm install | |
| npm ci | |
| working-directory: ./cs_ws/src/control_station_pkg/control_station_pkg/csApp/frontend | |
| # build and test the apps | |
| - name: build | |
| run: | | |
| npm run build | |
| npm run test --passWithNoTests | |
| working-directory: ./cs_ws/src/control_station_pkg/control_station_pkg/csApp/frontend | |
| env: | |
| CI: false | |
| build-and-push-image: | |
| runs-on: ubuntu-latest | |
| # build docker image and push to docker hub | |
| # only if the app build and test successfully | |
| needs: [build_test] | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| node-version: [16] | |
| include: | |
| - dockerfile: ./docker_humble_desktop/Dockerfile | |
| context: . | |
| tag: humble-desktop | |
| platform: linux/amd64,linux/arm64 | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Check disk space | |
| run: df . -h | |
| - name: Free disk space | |
| run: | | |
| sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true | |
| sudo rm -rf \ | |
| /usr/share/dotnet /usr/local/lib/android /opt/ghc \ | |
| /usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \ | |
| /usr/lib/jvm || true | |
| echo "some directories deleted" | |
| sudo apt install aptitude -y >/dev/null 2>&1 | |
| sudo aptitude purge aria2 ansible azure-cli shellcheck rpm xorriso zsync \ | |
| esl-erlang firefox gfortran-8 gfortran-9 google-chrome-stable \ | |
| google-cloud-sdk imagemagick \ | |
| libmagickcore-dev libmagickwand-dev libmagic-dev ant ant-optional kubectl \ | |
| mercurial apt-transport-https mono-complete libmysqlclient \ | |
| unixodbc-dev yarn chrpath libssl-dev libxft-dev \ | |
| libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev \ | |
| snmp pollinate libpq-dev postgresql-client powershell ruby-full \ | |
| sphinxsearch subversion mongodb-org azure-cli microsoft-edge-stable \ | |
| -y -f >/dev/null 2>&1 | |
| sudo aptitude purge google-cloud-sdk -f -y >/dev/null 2>&1 | |
| sudo aptitude purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true | |
| sudo apt purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true | |
| sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1 | |
| sudo aptitude purge '~n ^php' -f -y >/dev/null 2>&1 | |
| sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1 | |
| sudo apt-get autoremove -y >/dev/null 2>&1 | |
| sudo apt-get autoclean -y >/dev/null 2>&1 | |
| echo "some packages purged" | |
| - name: Check disk space | |
| run: | | |
| sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head | |
| df . -h | |
| sudo du /usr/ -hx -d 4 --threshold=1G | sort -hr | head | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| with: | |
| submodules: "true" | |
| token: ${{ secrets.PAT_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to GitHub Docker Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| file: ${{ matrix.dockerfile }} | |
| context: ${{ matrix.context }} | |
| tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag }} | |
| platforms: ${{ matrix.platform }} | |
| no-cache: true | |
| pull: true | |
| push: true |