Merge pull request #6 from OliverSchmitz/run-tests-in-ci #14
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: Build and deploy | |
on: | |
pull_request: | |
push: | |
branches: | |
- "master" | |
workflow_dispatch: | |
env: | |
source-directory: $GITHUB_WORKSPACE | |
build-directory: /tmp/build | |
ftp_server: ${{ secrets.FTP_SERVER }} | |
ftp_port: ${{ secrets.FTP_PORT }} | |
ftp_username: ${{ secrets.FTP_USERNAME }} | |
ftp_password: ${{ secrets.FTP_PASSWORD }} | |
remote_dir1: ${{ secrets.FTP_REMOTE_DIR1 }} | |
remote_dir2: ${{ secrets.FTP_REMOTE_DIR2 }} | |
remote_dir3: ${{ secrets.FTP_REMOTE_DIR3 }} | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
name: "Build and deploy" | |
timeout-minutes: 8 | |
steps: | |
- name: Checkout Campo | |
uses: actions/checkout@v4 | |
- name: configure system | |
run: | | |
# sudo apt-get update | |
# sudo apt-get upgrade | |
# sudo apt-get autoremove | |
sudo apt-get --yes install lftp | |
- uses: conda-incubator/setup-miniconda@v3 | |
with: | |
activate-environment: campo_dev | |
environment-file: environment/configuration/campo_dev.yaml | |
python-version: 3.11 | |
auto-activate-base: false | |
- name: Configure Campo | |
shell: bash -l {0} | |
run: | | |
mkdir ${{ env.build-directory }} | |
cmake \ | |
-S ${{ env.source-directory }} \ | |
-B ${{ env.build-directory }} \ | |
-D CAMPO_BUILD_WHEEL=ON | |
- name: Build Campo | |
shell: bash -l {0} | |
run: | | |
cmake --build ${{ env.build-directory }} --target documentation | |
cmake --build ${{ env.build-directory }} --target install | |
rm -f ${{ env.build-directory }}/package/dist/*gz | |
- name: Test Campo | |
shell: bash -l {0} | |
run: | | |
ctest --test-dir ${{ env.build-directory }} --output-on-failure | |
- name: Deploy documentation | |
if: github.repository == 'computationalgeography/campo' && github.ref == 'refs/heads/master' | |
run: | | |
cd ${{ env.build-directory }} | |
# lftp -c "open --user ${{ env.ftp_username }} --password ${{ env.ftp_password }} -p ${{ env.ftp_port }} ${{ env.ftp_server }};set sftp:auto-confirm yes;set ssl:verify-certificate false;mirror --verbose --reverse --continue --parallel=2 documentation/_build/ ${{ env.remote_dir1 }}" | |
- name: Deploy wheel | |
if: github.repository == 'computationalgeography/campo' && github.ref == 'refs/heads/master' | |
run: | | |
mkdir -p $HOME/.ssh | |
echo "HostKeyAlgorithms ssh-rsa" >> $HOME/.ssh/config | |
echo "PubkeyAcceptedKeyTypes ssh-rsa" >> $HOME/.ssh/config | |
echo "StrictHostKeyChecking no" >> $HOME/.ssh/config | |
cd ${{ env.build-directory }} | |
lftp -c "open --user ${{ env.ftp_username }} --password ${{ env.ftp_password }} -p ${{ env.ftp_port }} ${{ env.ftp_server }};set sftp:auto-confirm yes;set ssl:verify-certificate false;mirror --verbose --reverse --continue package/dist/ ${{ env.remote_dir2 }}" | |
- name: Deploy development documentation | |
if: github.repository == 'computationalgeography/campo' && github.ref == 'refs/heads/master' | |
run: | | |
cd ${{ env.build-directory }} | |
lftp -c "open --user ${{ env.ftp_username }} --password ${{ env.ftp_password }} -p ${{ env.ftp_port }} ${{ env.ftp_server }};set sftp:auto-confirm yes;set ssl:verify-certificate false;mirror --verbose --reverse --continue --parallel=2 documentation/_build/ ${{ env.remote_dir3 }}" |