extra command 2 #3892
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: Centos7 CI (push and/or release) | |
on: | |
release: | |
types: [ created ] | |
push: | |
branches: | |
- develop | |
- fix/centos-build | |
- dependabot/* | |
schedule: | |
- cron: '21 2 * * *' | |
workflow_call: | |
inputs: | |
run-tests: | |
required: true | |
type: string | |
target_branch: | |
required: true | |
type: string | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
IS_RELEASE: ${{ github.event_name == 'workflow_dispatch' }} | |
IS_PUSH: ${{ github.event_name == 'push' }} | |
REF: ${{ inputs.target_branch =='' && github.ref_name || inputs.target_branch}} | |
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
#sparse checkout -- only needed files | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
sparse-checkout: | | |
docker | |
src/vcpkg.json | |
ref: ${{ env.REF }} | |
- name: set env variables -- DockerFiles | |
run: | | |
echo "DOCKERFILE=$(pwd)/docker/Dockerfile" >> $GITHUB_ENV | |
echo "DOCKERDIR=$(pwd)/docker" >> $GITHUB_ENV | |
- name: Get changed files | |
id: changed-files | |
uses: tj-actions/changed-files@v45 | |
with: | |
files: | | |
docker/AntaresDeps | |
- name: Docker file push | |
id: docker_push | |
if: steps.changed-files.outputs.any_changed == 'true' | |
uses: elgohr/Publish-Docker-Github-Action@main | |
with: | |
name: antaresrte/antaressystemdeps | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
workdir: ${{ env.DOCKERDIR }} | |
dockerfile: ${{ env.DOCKERDIR }}/AntaresDeps | |
cache: false | |
tags: latest | |
- name: create vcpkg cache dir | |
run: | | |
echo "VCPKG_CACHE_DIR=$GITHUB_WORKSPACE/vcpkg_cache" >> $GITHUB_ENV | |
mkdir -p ${{ github.workspace }}/vcpkg_cache | |
- name: Restore vcpkg binary dir from cache | |
id: cache-vcpkg-binary | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{ github.workspace }}/vcpkg_cache | |
key: vcpkg-cache-centos7-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} | |
# Allows to restore a cache when deps have only partially changed (like adding a dependency) | |
restore-keys: vcpkg-cache-centos7- | |
- name: Build the image and Antares | |
run: | | |
docker build \ | |
-t antares:centos7 \ | |
--build-arg="BRANCH=${{ env.REF }}" \ | |
--build-arg="NPROC=$(nproc)" \ | |
--build-arg="VCPKG_CACHE_DIR=./vcpkg_cache" \ | |
-f ${{ env.DOCKERFILE }} . | |
- name: create a container without starting it && retrieve the .tgz | |
run: | | |
container_id=$(docker create antares:centos7) | |
docker cp $container_id:/workspace/Antares_Simulator/_build/archive archive | |
ls archive | |
echo "-----------------" | |
ls ${{ env.VCPKG_CACHE_DIR }} | |
echo "-----------------" | |
docker cp $container_id:/workspace/vcpkg_cache ${{ env.VCPKG_CACHE_DIR }} | |
ls ${{ env.VCPKG_CACHE_DIR }} | |
echo "-----------------" | |
ls archive | |
docker rm $container_id | |
- name: Publish assets | |
if: ${{ env.IS_RELEASE == 'true' }} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
tag: ${{ github.event.inputs.release_tag }} | |
run: | | |
gh release upload "$tag" archive/*.tar.gz archive/*.rpm | |
- name: Cache vcpkg binary dir | |
if: always() | |
id: save-cache-vcpkg-binary | |
uses: actions/cache/save@v4 | |
with: | |
path: ${{ github.workspace }}/vcpkg_cache | |
key: vcpkg-cache-centos7-${{ hashFiles('src/vcpkg.json', '.git/modules/vcpkg/HEAD') }} | |