From bba7de283cdd08f7a3e80cf5ffae51782db6dd42 Mon Sep 17 00:00:00 2001 From: Michael O'Keefe Date: Fri, 15 Dec 2023 11:19:19 -0700 Subject: [PATCH 01/13] Try out github action --- .github/workflows/cli-app-build.yaml | 102 +++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .github/workflows/cli-app-build.yaml diff --git a/.github/workflows/cli-app-build.yaml b/.github/workflows/cli-app-build.yaml new file mode 100644 index 00000000..ceb34e30 --- /dev/null +++ b/.github/workflows/cli-app-build.yaml @@ -0,0 +1,102 @@ +name: wheels + +on: + push: + tags: + # 'v[0-9]+.[0-9]+.[0-9]+' to match semantic version tag, e.g. v2.0.8 + - "v[0-9]+.[0-9]+.[0-9]+" + workflow_dispatch: + +jobs: + build: + name: build command line interfaces for ${{ matrix.platform || matrix.os }} + strategy: + fail-fast: true + matrix: + os: + - ubuntu + - macos + - windows + include: + - os: ubuntu + platform: linux + - os: windows + ls: dir + + runs-on: ${{ format('{0}-latest', matrix.os) }} + steps: + - uses: actions/checkout@v3 + + - name: set up rust + if: matrix.os != 'ubuntu' + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - name: set up rust for ubuntu + if: matrix.os == 'ubuntu' + bash: > + curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y && + rustup show + + - run: rustup target add aarch64-apple-darwin + if: matrix.os == 'macos' + + - name: run cargo tests + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + override: true + + - run: cd rust/ && cargo test + + - name: build ${{ matrix.platform || matrix.os }} binaries + run: cibuildwheel --output-dir dist + env: + CIBW_BUILD: "cp3${{ matrix.python-version }}-*" + CIBW_SKIP: "*-win32 *-musllinux* *i686 *ppc64le *s390x *aarch64" + CIBW_PLATFORM: ${{ matrix.platform || matrix.os }} + # TODO: why doesn't pytest work with cibuildwheel? + # CIBW_TEST_COMMAND: "pytest -v {project}/python/fastsim/tests" + CIBW_TEST_COMMAND: "python -m unittest discover {project}/python/fastsim/tests" + CIBW_ARCHS_MACOS: 'universal2' + # see https://cibuildwheel.readthedocs.io/en/stable/faq/#universal2 + CIBW_TEST_SKIP: '*_universal2:arm64' + CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH"' + CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"' + CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" + CIBW_MANYLINUX_I686_IMAGE: "manylinux2014" + CIBW_BEFORE_BUILD: > + pip install -U setuptools-rust && + rustup default stable && + rustup show + CIBW_BEFORE_BUILD_LINUX: > + pip install -U setuptools-rust && + curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y && + rustup show + + # - name: build windows 32bit binaries + # if: matrix.os == 'windows' + # run: cibuildwheel --output-dir dist + # env: + # CIBW_BUILD: 'cp3${{ matrix.python-version }}-win32' + # CIBW_PLATFORM: windows + # CIBW_TEST_REQUIRES: 'pytest' + # CIBW_TEST_COMMAND: 'pytest {project}/tests -s' + # CIBW_ENVIRONMENT: 'PATH="$UserProfile\.cargo\bin;$PATH"' + # CIBW_BEFORE_BUILD: > + # pip install -U setuptools-rust && + # rustup toolchain install nightly-i686-pc-windows-msvc && + # rustup default nightly-i686-pc-windows-msvc && + # rustup override set nightly-i686-pc-windows-msvc && + # rustup show + + - name: list dist files + run: ${{ matrix.ls || 'ls -lh' }} dist/ + + - uses: actions/upload-artifact@v3 + with: + path: ./target/release/ From e9fe1db844362cb6c8bd6debfd3a42bf22d4e26f Mon Sep 17 00:00:00 2001 From: Michael O'Keefe Date: Fri, 15 Dec 2023 11:22:55 -0700 Subject: [PATCH 02/13] Ensure we have run or uses on each step --- .github/workflows/cli-app-build.yaml | 45 ++-------------------------- 1 file changed, 2 insertions(+), 43 deletions(-) diff --git a/.github/workflows/cli-app-build.yaml b/.github/workflows/cli-app-build.yaml index ceb34e30..c8665a48 100644 --- a/.github/workflows/cli-app-build.yaml +++ b/.github/workflows/cli-app-build.yaml @@ -1,4 +1,4 @@ -name: wheels +name: cli-app-build on: push: @@ -37,7 +37,7 @@ jobs: - name: set up rust for ubuntu if: matrix.os == 'ubuntu' - bash: > + run: > curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y && rustup show @@ -53,47 +53,6 @@ jobs: - run: cd rust/ && cargo test - - name: build ${{ matrix.platform || matrix.os }} binaries - run: cibuildwheel --output-dir dist - env: - CIBW_BUILD: "cp3${{ matrix.python-version }}-*" - CIBW_SKIP: "*-win32 *-musllinux* *i686 *ppc64le *s390x *aarch64" - CIBW_PLATFORM: ${{ matrix.platform || matrix.os }} - # TODO: why doesn't pytest work with cibuildwheel? - # CIBW_TEST_COMMAND: "pytest -v {project}/python/fastsim/tests" - CIBW_TEST_COMMAND: "python -m unittest discover {project}/python/fastsim/tests" - CIBW_ARCHS_MACOS: 'universal2' - # see https://cibuildwheel.readthedocs.io/en/stable/faq/#universal2 - CIBW_TEST_SKIP: '*_universal2:arm64' - CIBW_ENVIRONMENT: 'PATH="$HOME/.cargo/bin:$PATH"' - CIBW_ENVIRONMENT_WINDOWS: 'PATH="$UserProfile\.cargo\bin;$PATH"' - CIBW_MANYLINUX_X86_64_IMAGE: "manylinux2014" - CIBW_MANYLINUX_I686_IMAGE: "manylinux2014" - CIBW_BEFORE_BUILD: > - pip install -U setuptools-rust && - rustup default stable && - rustup show - CIBW_BEFORE_BUILD_LINUX: > - pip install -U setuptools-rust && - curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=nightly --profile=minimal -y && - rustup show - - # - name: build windows 32bit binaries - # if: matrix.os == 'windows' - # run: cibuildwheel --output-dir dist - # env: - # CIBW_BUILD: 'cp3${{ matrix.python-version }}-win32' - # CIBW_PLATFORM: windows - # CIBW_TEST_REQUIRES: 'pytest' - # CIBW_TEST_COMMAND: 'pytest {project}/tests -s' - # CIBW_ENVIRONMENT: 'PATH="$UserProfile\.cargo\bin;$PATH"' - # CIBW_BEFORE_BUILD: > - # pip install -U setuptools-rust && - # rustup toolchain install nightly-i686-pc-windows-msvc && - # rustup default nightly-i686-pc-windows-msvc && - # rustup override set nightly-i686-pc-windows-msvc && - # rustup show - - name: list dist files run: ${{ matrix.ls || 'ls -lh' }} dist/ From d3343f2fe53a182933b52eeefe8a5d2bd7e9103f Mon Sep 17 00:00:00 2001 From: Michael O'Keefe Date: Fri, 15 Dec 2023 11:38:36 -0700 Subject: [PATCH 03/13] Rename action --- .github/workflows/{cli-app-build.yaml => build-cli.yaml} | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) rename .github/workflows/{cli-app-build.yaml => build-cli.yaml} (94%) diff --git a/.github/workflows/cli-app-build.yaml b/.github/workflows/build-cli.yaml similarity index 94% rename from .github/workflows/cli-app-build.yaml rename to .github/workflows/build-cli.yaml index c8665a48..1accc338 100644 --- a/.github/workflows/cli-app-build.yaml +++ b/.github/workflows/build-cli.yaml @@ -1,4 +1,4 @@ -name: cli-app-build +name: build-cli on: push: @@ -24,6 +24,7 @@ jobs: ls: dir runs-on: ${{ format('{0}-latest', matrix.os) }} + steps: - uses: actions/checkout@v3 @@ -32,9 +33,9 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: stable override: true - + - name: set up rust for ubuntu if: matrix.os == 'ubuntu' run: > @@ -48,7 +49,7 @@ jobs: uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: stable + toolchain: stable override: true - run: cd rust/ && cargo test From a45a1a772324fb028a8a098bb5e6e4aadb9a505e Mon Sep 17 00:00:00 2001 From: Michael O'Keefe Date: Fri, 15 Dec 2023 11:47:00 -0700 Subject: [PATCH 04/13] Add code to trigger workflow on push --- .github/workflows/build-cli.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-cli.yaml b/.github/workflows/build-cli.yaml index 1accc338..e1b99e01 100644 --- a/.github/workflows/build-cli.yaml +++ b/.github/workflows/build-cli.yaml @@ -5,6 +5,8 @@ on: tags: # 'v[0-9]+.[0-9]+.[0-9]+' to match semantic version tag, e.g. v2.0.8 - "v[0-9]+.[0-9]+.[0-9]+" + branches: + - feature/github-action-for-cli workflow_dispatch: jobs: From 01925c7bf64c67ee3050943bf4624b836c88f3f0 Mon Sep 17 00:00:00 2001 From: Michael O'Keefe Date: Fri, 15 Dec 2023 11:56:43 -0700 Subject: [PATCH 05/13] Fix issue with listing irrelevant and non-existing directory --- .github/workflows/build-cli.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-cli.yaml b/.github/workflows/build-cli.yaml index e1b99e01..635d6fe0 100644 --- a/.github/workflows/build-cli.yaml +++ b/.github/workflows/build-cli.yaml @@ -56,8 +56,8 @@ jobs: - run: cd rust/ && cargo test - - name: list dist files - run: ${{ matrix.ls || 'ls -lh' }} dist/ + - name: list current directory files + run: ${{ matrix.ls || 'ls -lh' }} . - uses: actions/upload-artifact@v3 with: From 3e1e1250cc0f853ba6832c97c80daa33ba20f986 Mon Sep 17 00:00:00 2001 From: Michael O'Keefe Date: Fri, 15 Dec 2023 12:52:30 -0700 Subject: [PATCH 06/13] Update artifact path --- .github/workflows/build-cli.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-cli.yaml b/.github/workflows/build-cli.yaml index 635d6fe0..b7165876 100644 --- a/.github/workflows/build-cli.yaml +++ b/.github/workflows/build-cli.yaml @@ -61,4 +61,4 @@ jobs: - uses: actions/upload-artifact@v3 with: - path: ./target/release/ + path: ./rust/target/release/ From d0fb3a4139a3a747e48e9930dcd8b7a87dec7e50 Mon Sep 17 00:00:00 2001 From: Michael O'Keefe Date: Fri, 15 Dec 2023 12:55:51 -0700 Subject: [PATCH 07/13] Adjust paths to artifacts and build release --- .github/workflows/build-cli.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-cli.yaml b/.github/workflows/build-cli.yaml index b7165876..02996130 100644 --- a/.github/workflows/build-cli.yaml +++ b/.github/workflows/build-cli.yaml @@ -56,8 +56,10 @@ jobs: - run: cd rust/ && cargo test + - run: cd rust/ && cargo build --release + - name: list current directory files - run: ${{ matrix.ls || 'ls -lh' }} . + run: ${{ matrix.ls || 'ls -lh' }} ./rust/target/release/ - uses: actions/upload-artifact@v3 with: From 9b2dd12d4dbc75f45ce373fd0a9ecfc9253a50f4 Mon Sep 17 00:00:00 2001 From: Michael O'Keefe Date: Fri, 15 Dec 2023 13:08:50 -0700 Subject: [PATCH 08/13] copy out cli programs for clarity --- .github/workflows/build-cli.yaml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-cli.yaml b/.github/workflows/build-cli.yaml index 02996130..3f66f3d4 100644 --- a/.github/workflows/build-cli.yaml +++ b/.github/workflows/build-cli.yaml @@ -54,13 +54,27 @@ jobs: toolchain: stable override: true - - run: cd rust/ && cargo test + - run: cd rust/fastsim-cli/ && cargo test - - run: cd rust/ && cargo build --release + - run: cd rust/fastsim-cli/ && cargo build --release - name: list current directory files run: ${{ matrix.ls || 'ls -lh' }} ./rust/target/release/ + + - name: copy cli programs to new directory + if: matrix.os == 'windows' + run: | + mkdir cli + copy ./rust/target/release/vehicle-import-cli.exe cli + copy ./rust/target/release/fastsim-cli.exe cli + + - name: copy cli programs to new directory (non-windows) + if: matrix.os != 'windows' + run: | + mkdir cli + cp ./rust/target/release/vehicle-import-cli cli + cp ./rust/target/release/fastsim-cli cli - uses: actions/upload-artifact@v3 with: - path: ./rust/target/release/ + path: ./cli From 331e5d92d5d9dffadcb17383eff343fcc74b300c Mon Sep 17 00:00:00 2001 From: Michael O'Keefe Date: Fri, 15 Dec 2023 13:21:50 -0700 Subject: [PATCH 09/13] Name artifacts --- .github/workflows/build-cli.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-cli.yaml b/.github/workflows/build-cli.yaml index 3f66f3d4..584dfa33 100644 --- a/.github/workflows/build-cli.yaml +++ b/.github/workflows/build-cli.yaml @@ -75,6 +75,7 @@ jobs: cp ./rust/target/release/vehicle-import-cli cli cp ./rust/target/release/fastsim-cli cli - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: + name: cli path: ./cli From 6f275445955f04e07e1c64bd3ea14fb9c0821b77 Mon Sep 17 00:00:00 2001 From: Michael O'Keefe Date: Fri, 15 Dec 2023 13:28:49 -0700 Subject: [PATCH 10/13] Undo naming --- .github/workflows/build-cli.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-cli.yaml b/.github/workflows/build-cli.yaml index 584dfa33..c6ba79ff 100644 --- a/.github/workflows/build-cli.yaml +++ b/.github/workflows/build-cli.yaml @@ -77,5 +77,4 @@ jobs: - uses: actions/upload-artifact@v4 with: - name: cli path: ./cli From 740a684606fdc88ea5e1f3744a8ecdfbcd7e4069 Mon Sep 17 00:00:00 2001 From: Michael O'Keefe Date: Fri, 15 Dec 2023 13:31:21 -0700 Subject: [PATCH 11/13] Add OS name to artifact name for CLI programs --- .github/workflows/build-cli.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-cli.yaml b/.github/workflows/build-cli.yaml index c6ba79ff..79760494 100644 --- a/.github/workflows/build-cli.yaml +++ b/.github/workflows/build-cli.yaml @@ -77,4 +77,5 @@ jobs: - uses: actions/upload-artifact@v4 with: + name: ${{ matrix.os }}-cli path: ./cli From 7e422e9f4f781dcdff249bdc5b4721bb89ed0acf Mon Sep 17 00:00:00 2001 From: Michael O'Keefe Date: Fri, 15 Dec 2023 13:47:12 -0700 Subject: [PATCH 12/13] Remove branch build --- .github/workflows/build-cli.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-cli.yaml b/.github/workflows/build-cli.yaml index 79760494..037f54d1 100644 --- a/.github/workflows/build-cli.yaml +++ b/.github/workflows/build-cli.yaml @@ -5,8 +5,6 @@ on: tags: # 'v[0-9]+.[0-9]+.[0-9]+' to match semantic version tag, e.g. v2.0.8 - "v[0-9]+.[0-9]+.[0-9]+" - branches: - - feature/github-action-for-cli workflow_dispatch: jobs: From b77b25413b9d67e11703f53af51bfd7dbbc7a6dc Mon Sep 17 00:00:00 2001 From: Chad Baker Date: Mon, 8 Jan 2024 09:09:57 -0700 Subject: [PATCH 13/13] changed to build on release --- .github/workflows/build-cli.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-cli.yaml b/.github/workflows/build-cli.yaml index 037f54d1..41bbc342 100644 --- a/.github/workflows/build-cli.yaml +++ b/.github/workflows/build-cli.yaml @@ -1,10 +1,8 @@ name: build-cli on: - push: - tags: - # 'v[0-9]+.[0-9]+.[0-9]+' to match semantic version tag, e.g. v2.0.8 - - "v[0-9]+.[0-9]+.[0-9]+" + release: + types: [published] workflow_dispatch: jobs: