[EnvAction] fix actionStartDateTimeUtc in MissionEnvActionDataInput #1871
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: CI/CD Back & Front | |
on: | |
push: | |
paths: | |
- ".github/workflows/cicd-database.yml" | |
- ".github/workflows/cicd-app.yml" | |
- "infra/**" | |
- "backend/**" | |
- "frontend/**" | |
- "Makefile" | |
schedule: | |
- cron: "38 11 */3 * *" | |
jobs: | |
version: | |
name: Set application version and env profile | |
runs-on: ubuntu-22.04 | |
outputs: | |
ENV_PROFILE: ${{ steps.env_profile.outputs.ENV_PROFILE }} | |
VERSION: ${{ steps.version.outputs.VERSION }} | |
steps: | |
- name: Get last release version | |
id: lastrelease | |
uses: pozetroninc/github-action-get-latest-release@master | |
with: | |
repository: mtes-mct/monitorenv | |
- id: step1 | |
name: Set ENV profile as dev by default | |
run: echo "ENV_PROFILE=dev" >> $GITHUB_ENV | |
- name: Set ENV profile as PROD when it is a release | |
if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/v') | |
run: echo "ENV_PROFILE=prod" >> $GITHUB_ENV | |
- id: env_profile | |
name: Set ENV profile output | |
run: ENV_PROFILE=${{ env.ENV_PROFILE }} && echo "ENV_PROFILE=$ENV_PROFILE" >> $GITHUB_OUTPUT | |
- id: version | |
name: Set VERSION env | |
run: | | |
if [ "${ENV_PROFILE}" != "prod" ]; then\ | |
if [ "${{github.ref}}" == "refs/heads/main" ]; then\ | |
export VERSION=${{ steps.lastrelease.outputs.release }}_snapshot | |
else\ | |
export REF_NAME=${{ github.ref_name }} | |
export VERSION=${REF_NAME//\//_} | |
fi | |
else\ | |
export VERSION=${{ steps.lastrelease.outputs.release }} | |
fi | |
echo $VERSION | |
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
build: | |
name: Run unit tests, build and package | |
needs: version | |
runs-on: ubuntu-22.04 | |
env: | |
ENV_PROFILE: ${{needs.version.outputs.ENV_PROFILE}} | |
VERSION: ${{needs.version.outputs.VERSION}} | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
steps: | |
- name: Show version | |
run: echo "VERSION:${{ env.VERSION }} ENV_PROFILE:${{ env.ENV_PROFILE }}" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Java JDK | |
uses: actions/[email protected] | |
with: | |
java-version: 17 | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
cache: npm | |
cache-dependency-path: ./frontend/package-lock.json | |
node-version: 18 | |
- name: Install Node.js dependencies | |
# TODO Remove `--legacy-peer-deps` option as soon as we replace `react-scripts` by something else. | |
run: npm ci --legacy-peer-deps | |
working-directory: ./frontend | |
- name: Lint Frontend | |
run: npm run test:lint:partial | |
working-directory: ./frontend | |
- name: Check Frontend types | |
run: npm run test:type:partial | |
working-directory: ./frontend | |
- name: Unit test | |
run: make test | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@master | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache-app | |
key: ${{ runner.os }}-single-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-single-buildx | |
- name: Build image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
load: true | |
builder: ${{ steps.buildx.outputs.name }} | |
file: infra/docker/app/Dockerfile | |
push: false | |
tags: monitorenv-app:${{ env.VERSION }} | |
cache-from: type=local,src=/tmp/.buildx-cache-app | |
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache-app-new | |
build-args: | | |
VERSION=${{ env.VERSION }} | |
ENV_PROFILE=${{ env.ENV_PROFILE }} | |
GITHUB_SHA=${{ github.sha }} | |
SENTRY_URL=${{ secrets.SENTRY_URL }} | |
SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG=${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT=${{ secrets.SENTRY_PROJECT }} | |
# Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache-app | |
mv /tmp/.buildx-cache-app-new /tmp/.buildx-cache-app | |
- name: Upload image to artifacts | |
uses: ishworkh/docker-image-artifact-upload@v1 | |
with: | |
image: monitorenv-app:${{ env.VERSION }} | |
e2e_test: | |
name: Run E2E tests | |
needs: [version, build] | |
runs-on: ubuntu-22.04 | |
strategy: | |
# when one test fails, DO NOT cancel the other | |
# containers, because this will kill Cypress processes | |
# leaving the Dashboard hanging ... | |
# https://github.com/cypress-io/github-action/issues/48 | |
fail-fast: false | |
matrix: | |
# run 4 copies of the current job in parallel | |
containers: [1, 2, 3, 4] | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
CYPRESS_PROJECT_ID: ${{ secrets.CYPRESS_PROJECT_ID }} | |
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} | |
ENV_PROFILE: ${{needs.version.outputs.ENV_PROFILE}} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
MONITORENV_VERSION: ${{ needs.version.outputs.VERSION }} | |
REACT_APP_CYPRESS_PORT: 8880 | |
VERSION: ${{needs.version.outputs.VERSION}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download image | |
uses: ishworkh/docker-image-artifact-download@v1 | |
with: | |
image: monitorenv-app:${{ env.VERSION }} | |
- name: Run docker images | |
run: make run-infra-for-frontend-tests | |
- name: Setup Node.js | |
uses: actions/setup-node@v3 | |
with: | |
cache: npm | |
cache-dependency-path: ./frontend/package-lock.json | |
node-version: 18 | |
- name: Setup Firefox | |
uses: browser-actions/setup-firefox@latest | |
with: | |
firefox-version: 104.0.2 | |
- name: Check versions | |
run: | | |
cat /etc/lsb-release | |
node -v | |
npm -v | |
docker -v | |
docker compose version | |
firefox -v | |
which firefox | |
- name: Curl stubbed geoserver check | |
run: until $(curl --output /dev/null --silent --fail "http://localhost:8081/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&typename=monitorenv:regulations&outputFormat=application/json&CQL_FILTER=topic=%27Ouest%20Cotentin%20Bivalves%27%20AND%20zone=%27Praires%20Ouest%20cotentin%27"); do printf '.'; sleep 5; done; | |
- uses: cypress-io/github-action@v6 | |
with: | |
browser: firefox | |
config-file: config/cypress.config.ts | |
env: PORT=8880 | |
install: true | |
# TODO Remove `--legacy-peer-deps` option as soon as we replace `react-scripts` by something else. | |
install-command: npm ci --legacy-peer-deps | |
parallel: true | |
record: true | |
wait-on: "http://localhost:8880" | |
working-directory: ./frontend | |
push_to_registry: | |
name: Push to registry | |
needs: [version, e2e_test] | |
runs-on: ubuntu-22.04 | |
if: startsWith(github.ref, 'refs/heads/dependabot') == false | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
ENV_PROFILE: ${{needs.version.outputs.ENV_PROFILE}} | |
VERSION: ${{needs.version.outputs.VERSION}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Download image | |
uses: ishworkh/docker-image-artifact-download@v1 | |
with: | |
image: monitorenv-app:${{ env.VERSION }} | |
- name: Push docker image to registry | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${GITHUB_ACTOR} --password-stdin | |
make docker-tag-app | |
make docker-push-app |